[BRANCHES]
[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;
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,
2262 0, 0, 0, 0, 0, 0, &Group) ||
2263 !pCheckTokenMembership(NULL, Group, &IsInGroup))
2264 {
2265 trace("Could not check if the current user is an administrator\n");
2266 return FALSE;
2267 }
2268 if (!IsInGroup)
2269 {
2270 /* Only administrators have enough privileges for these tests */
2271 return TRUE;
2272 }
2273
2274 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2275 {
2276 BOOL ret;
2277 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2278 DWORD size;
2279
2280 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2281 CloseHandle(token);
2282 return (ret && type == TokenElevationTypeLimited);
2283 }
2284 return FALSE;
2285 }
2286
2287 static char *get_user_sid(void)
2288 {
2289 HANDLE token;
2290 DWORD size = 0;
2291 TOKEN_USER *user;
2292 char *usersid = NULL;
2293
2294 if (!pConvertSidToStringSidA)
2295 {
2296 win_skip("ConvertSidToStringSidA is not available\n");
2297 return NULL;
2298 }
2299 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
2300 GetTokenInformation(token, TokenUser, NULL, size, &size);
2301
2302 user = HeapAlloc(GetProcessHeap(), 0, size);
2303 GetTokenInformation(token, TokenUser, user, size, &size);
2304 pConvertSidToStringSidA(user->User.Sid, &usersid);
2305 HeapFree(GetProcessHeap(), 0, user);
2306
2307 CloseHandle(token);
2308 return usersid;
2309 }
2310
2311 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2312 {
2313 LPSTR tempname;
2314
2315 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2316 GetTempFileNameA(".", "xx", 0, tempname);
2317
2318 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2319 {
2320 lstrcpyA(pszTempName, tempname);
2321 HeapFree(GetProcessHeap(), 0, tempname);
2322 return TRUE;
2323 }
2324
2325 HeapFree(GetProcessHeap(), 0, tempname);
2326
2327 return FALSE;
2328 }
2329
2330 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2331 USHORT *pattribs, int *err, void *pv)
2332 {
2333 BY_HANDLE_FILE_INFORMATION finfo;
2334 FILETIME filetime;
2335 HANDLE handle;
2336 DWORD attrs;
2337 BOOL res;
2338
2339 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2340 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2341
2342 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2343
2344 res = GetFileInformationByHandle(handle, &finfo);
2345 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2346
2347 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2348 FileTimeToDosDateTime(&filetime, pdate, ptime);
2349
2350 attrs = GetFileAttributesA(pszName);
2351 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2352
2353 return (INT_PTR)handle;
2354 }
2355
2356 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2357 {
2358 char path[MAX_PATH];
2359 char filename[MAX_PATH];
2360
2361 lstrcpyA(path, CURR_DIR);
2362 lstrcatA(path, "\\");
2363 lstrcatA(path, file);
2364
2365 lstrcpyA(filename, file);
2366
2367 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2368 progress, get_open_info, compress);
2369 }
2370
2371 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2372 {
2373 ZeroMemory(pCabParams, sizeof(CCAB));
2374
2375 pCabParams->cb = max_size;
2376 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2377 pCabParams->setID = 0xbeef;
2378 pCabParams->iCab = 1;
2379 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2380 lstrcatA(pCabParams->szCabPath, "\\");
2381 lstrcpyA(pCabParams->szCab, name);
2382 }
2383
2384 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2385 {
2386 CCAB cabParams;
2387 LPCSTR ptr;
2388 HFCI hfci;
2389 ERF erf;
2390 BOOL res;
2391
2392 set_cab_parameters(&cabParams, name, max_size);
2393
2394 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2395 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2396 get_temp_file, &cabParams, NULL);
2397
2398 ok(hfci != NULL, "Failed to create an FCI context\n");
2399
2400 ptr = files;
2401 while (*ptr)
2402 {
2403 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2404 ok(res, "Failed to add file: %s\n", ptr);
2405 ptr += lstrlenA(ptr) + 1;
2406 }
2407
2408 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2409 ok(res, "Failed to flush the cabinet\n");
2410
2411 res = FCIDestroy(hfci);
2412 ok(res, "Failed to destroy the cabinet\n");
2413 }
2414
2415 static BOOL get_user_dirs(void)
2416 {
2417 HKEY hkey;
2418 DWORD type, size;
2419
2420 if (RegOpenKeyA(HKEY_CURRENT_USER,
2421 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2422 return FALSE;
2423
2424 size = MAX_PATH;
2425 if (RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size))
2426 {
2427 RegCloseKey(hkey);
2428 return FALSE;
2429 }
2430
2431 RegCloseKey(hkey);
2432 return TRUE;
2433 }
2434
2435 static BOOL get_system_dirs(void)
2436 {
2437 HKEY hkey;
2438 DWORD type, size;
2439
2440 if (RegOpenKeyA(HKEY_LOCAL_MACHINE,
2441 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2442 return FALSE;
2443
2444 size = MAX_PATH;
2445 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2446 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size))
2447 {
2448 RegCloseKey(hkey);
2449 return FALSE;
2450 }
2451
2452 size = MAX_PATH;
2453 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2454 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size))
2455 {
2456 RegCloseKey(hkey);
2457 return FALSE;
2458 }
2459
2460 RegCloseKey(hkey);
2461
2462 if (!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2463 return FALSE;
2464
2465 return TRUE;
2466 }
2467
2468 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2469 {
2470 HANDLE file;
2471 DWORD written;
2472
2473 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2474 if (file == INVALID_HANDLE_VALUE)
2475 return;
2476
2477 WriteFile(file, data, strlen(data), &written, NULL);
2478
2479 if (size)
2480 {
2481 SetFilePointer(file, size, NULL, FILE_BEGIN);
2482 SetEndOfFile(file);
2483 }
2484
2485 CloseHandle(file);
2486 }
2487
2488 #define create_file(name, size) create_file_data(name, name, size)
2489
2490 static void create_test_files(void)
2491 {
2492 CreateDirectoryA("msitest", NULL);
2493 create_file("msitest\\one.txt", 100);
2494 CreateDirectoryA("msitest\\first", NULL);
2495 create_file("msitest\\first\\two.txt", 100);
2496 CreateDirectoryA("msitest\\second", NULL);
2497 create_file("msitest\\second\\three.txt", 100);
2498
2499 create_file("four.txt", 100);
2500 create_file("five.txt", 100);
2501 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2502
2503 create_file("msitest\\filename", 100);
2504 create_file("msitest\\service.exe", 100);
2505 create_file("msitest\\service2.exe", 100);
2506
2507 DeleteFileA("four.txt");
2508 DeleteFileA("five.txt");
2509 }
2510
2511 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2512 {
2513 CHAR path[MAX_PATH];
2514
2515 lstrcpyA(path, PROG_FILES_DIR);
2516 lstrcatA(path, "\\");
2517 lstrcatA(path, rel_path);
2518
2519 if (is_file)
2520 return DeleteFileA(path);
2521 else
2522 return RemoveDirectoryA(path);
2523 }
2524
2525 static void delete_test_files(void)
2526 {
2527 DeleteFileA("msitest.msi");
2528 DeleteFileA("msitest.cab");
2529 DeleteFileA("msitest\\second\\three.txt");
2530 DeleteFileA("msitest\\first\\two.txt");
2531 DeleteFileA("msitest\\one.txt");
2532 DeleteFileA("msitest\\service.exe");
2533 DeleteFileA("msitest\\service2.exe");
2534 DeleteFileA("msitest\\filename");
2535 RemoveDirectoryA("msitest\\second");
2536 RemoveDirectoryA("msitest\\first");
2537 RemoveDirectoryA("msitest");
2538 }
2539
2540 static void write_file(const CHAR *filename, const char *data, int data_size)
2541 {
2542 DWORD size;
2543 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2544 WriteFile(hf, data, data_size, &size, NULL);
2545 CloseHandle(hf);
2546 }
2547
2548 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template)
2549 {
2550 MSIHANDLE summary;
2551 UINT r;
2552
2553 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2555
2556 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2558
2559 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2560 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2561 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2562
2563 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2565
2566 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2568
2569 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2570 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2571
2572 /* write the summary changes back to the stream */
2573 r = MsiSummaryInfoPersist(summary);
2574 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2575
2576 MsiCloseHandle(summary);
2577 }
2578
2579 #define create_database(name, tables, num_tables) \
2580 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
2581
2582 #define create_database_template(name, tables, num_tables, version, template) \
2583 create_database_wordcount(name, tables, num_tables, version, 0, template);
2584
2585 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2586 int num_tables, INT version, INT wordcount,
2587 const char *template)
2588 {
2589 MSIHANDLE db;
2590 UINT r;
2591 WCHAR *nameW;
2592 int j, len;
2593
2594 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2595 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2596 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2597
2598 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2599 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2600
2601 /* import the tables into the database */
2602 for (j = 0; j < num_tables; j++)
2603 {
2604 const msi_table *table = &tables[j];
2605
2606 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2607
2608 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2610
2611 DeleteFileA(table->filename);
2612 }
2613
2614 write_msi_summary_info(db, version, wordcount, template);
2615
2616 r = MsiDatabaseCommit(db);
2617 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2618
2619 MsiCloseHandle(db);
2620 HeapFree( GetProcessHeap(), 0, nameW );
2621 }
2622
2623 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2624 {
2625 RESTOREPOINTINFOA spec;
2626
2627 spec.dwEventType = event_type;
2628 spec.dwRestorePtType = APPLICATION_INSTALL;
2629 spec.llSequenceNumber = status->llSequenceNumber;
2630 lstrcpyA(spec.szDescription, "msitest restore point");
2631
2632 return pSRSetRestorePointA(&spec, status);
2633 }
2634
2635 static void remove_restore_point(DWORD seq_number)
2636 {
2637 DWORD res;
2638
2639 res = pSRRemoveRestorePoint(seq_number);
2640 if (res != ERROR_SUCCESS)
2641 trace("Failed to remove the restore point : %08x\n", res);
2642 }
2643
2644 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2645 {
2646 if (pRegDeleteKeyExA)
2647 return pRegDeleteKeyExA( key, subkey, access, 0 );
2648 return RegDeleteKeyA( key, subkey );
2649 }
2650
2651 static BOOL file_exists(LPCSTR file)
2652 {
2653 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
2654 }
2655
2656 static BOOL pf_exists(LPCSTR file)
2657 {
2658 CHAR path[MAX_PATH];
2659
2660 lstrcpyA(path, PROG_FILES_DIR);
2661 lstrcatA(path, "\\");
2662 lstrcatA(path, file);
2663
2664 return file_exists(path);
2665 }
2666
2667 static void delete_pfmsitest_files(void)
2668 {
2669 SHFILEOPSTRUCTA shfl;
2670 CHAR path[MAX_PATH+11];
2671
2672 lstrcpyA(path, PROG_FILES_DIR);
2673 lstrcatA(path, "\\msitest\\*");
2674 path[strlen(path) + 1] = '\0';
2675
2676 shfl.hwnd = NULL;
2677 shfl.wFunc = FO_DELETE;
2678 shfl.pFrom = path;
2679 shfl.pTo = NULL;
2680 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
2681
2682 SHFileOperationA(&shfl);
2683
2684 lstrcpyA(path, PROG_FILES_DIR);
2685 lstrcatA(path, "\\msitest");
2686 RemoveDirectoryA(path);
2687 }
2688
2689 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2690 {
2691 char val[MAX_PATH];
2692 DWORD size, type;
2693 LONG res;
2694
2695 size = MAX_PATH;
2696 val[0] = '\0';
2697 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2698
2699 if (res != ERROR_SUCCESS ||
2700 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2701 {
2702 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2703 return;
2704 }
2705
2706 if (!expected)
2707 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
2708 else
2709 {
2710 if (bcase)
2711 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2712 else
2713 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2714 }
2715 }
2716
2717 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2718 {
2719 DWORD val, size, type;
2720 LONG res;
2721
2722 size = sizeof(DWORD);
2723 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2724
2725 if (res != ERROR_SUCCESS || type != REG_DWORD)
2726 {
2727 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2728 return;
2729 }
2730
2731 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2732 }
2733
2734 static void check_reg_dword4(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2735 DWORD expected4, DWORD line)
2736 {
2737 DWORD val, size, type;
2738 LONG res;
2739
2740 size = sizeof(DWORD);
2741 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2742
2743 if (res != ERROR_SUCCESS || type != REG_DWORD)
2744 {
2745 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2746 return;
2747 }
2748
2749 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4,
2750 "Expected %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, val);
2751 }
2752
2753 static void check_reg_dword5(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2754 DWORD expected4, DWORD expected5, DWORD line)
2755 {
2756 DWORD val, size, type;
2757 LONG res;
2758
2759 size = sizeof(DWORD);
2760 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2761
2762 if (res != ERROR_SUCCESS || type != REG_DWORD)
2763 {
2764 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2765 return;
2766 }
2767
2768 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4 ||
2769 val == expected5,
2770 "Expected %d, %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, expected5, val);
2771 }
2772
2773 #define CHECK_REG_STR(prodkey, name, expected) \
2774 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2775
2776 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2777 do { \
2778 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2779 RegDeleteValueA(prodkey, name); \
2780 } while(0)
2781
2782 #define CHECK_REG_ISTR(prodkey, name, expected) \
2783 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2784
2785 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2786 do { \
2787 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2788 RegDeleteValueA(prodkey, name); \
2789 } while(0)
2790
2791 #define CHECK_REG_DWORD(prodkey, name, expected) \
2792 check_reg_dword(prodkey, name, expected, __LINE__);
2793
2794 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2795 do { \
2796 check_reg_dword(prodkey, name, expected, __LINE__); \
2797 RegDeleteValueA(prodkey, name); \
2798 } while(0)
2799
2800 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
2801 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
2802
2803 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
2804 do { \
2805 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
2806 RegDeleteValueA(prodkey, name); \
2807 } while(0)
2808
2809 #define CHECK_REG_DWORD4(prodkey, name, expected1, expected2, expected3, expected4) \
2810 check_reg_dword4(prodkey, name, expected1, expected2, expected3, expected4, __LINE__);
2811
2812 #define CHECK_DEL_REG_DWORD5(prodkey, name, expected1, expected2, expected3, expected4 ,expected5) \
2813 do { \
2814 check_reg_dword5(prodkey, name, expected1, expected2, expected3, expected4, expected5, __LINE__); \
2815 RegDeleteValueA(prodkey, name); \
2816 } while(0)
2817
2818 static void get_date_str(LPSTR date)
2819 {
2820 SYSTEMTIME systime;
2821
2822 static const char date_fmt[] = "%d%02d%02d";
2823 GetLocalTime(&systime);
2824 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2825 }
2826
2827 static void test_register_product(void)
2828 {
2829 UINT r;
2830 LONG res;
2831 HKEY hkey, props, usage;
2832 LPSTR usersid;
2833 char date[MAX_PATH], temp[MAX_PATH], keypath[MAX_PATH], path[MAX_PATH];
2834 DWORD size, type;
2835 REGSAM access = KEY_ALL_ACCESS;
2836
2837 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2838 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2839 static const CHAR uninstall_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion"
2840 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2841 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2842 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2843 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2844 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2845 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2846 "\\51AAE0C44620A5E4788506E91F249BD2";
2847
2848 if (is_process_limited())
2849 {
2850 skip("process is limited\n");
2851 return;
2852 }
2853
2854 if (!(usersid = get_user_sid()))
2855 return;
2856
2857 get_date_str(date);
2858 GetTempPathA(MAX_PATH, temp);
2859
2860 CreateDirectoryA("msitest", NULL);
2861 create_file("msitest\\maximus", 500);
2862
2863 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2864
2865 if (is_wow64)
2866 access |= KEY_WOW64_64KEY;
2867
2868 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2869
2870 /* RegisterProduct */
2871 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2872 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2873 {
2874 skip("Not enough rights to perform tests\n");
2875 goto error;
2876 }
2877 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2878 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2879 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2880
2881 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2882 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2883
2884 if (is_64bit)
2885 {
2886 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2887 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2888 }
2889 else
2890 {
2891 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2892 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2893 }
2894
2895 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2896 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2897 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2898 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2899 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2900 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2901 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2902 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2903 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2904 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2905 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2906 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2907 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2908 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2909 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2910 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2911 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2912 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2913 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2914 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2915 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2916 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2917 todo_wine
2918 {
2919 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
2920 }
2921
2922 delete_key(hkey, "", access);
2923 RegCloseKey(hkey);
2924
2925 sprintf(keypath, userdata, usersid);
2926 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2927 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2928
2929 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2930 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2931
2932 size = sizeof(path);
2933 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
2934 DeleteFileA(path);
2935 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2936
2937 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2938 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2939 CHECK_DEL_REG_STR(props, "InstallDate", date);
2940 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2941 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2942 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2943 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2944 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2945 CHECK_DEL_REG_STR(props, "Comments", NULL);
2946 CHECK_DEL_REG_STR(props, "Contact", NULL);
2947 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2948 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2949 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2950 CHECK_DEL_REG_STR(props, "Readme", NULL);
2951 CHECK_DEL_REG_STR(props, "Size", NULL);
2952 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2953 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2954 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2955 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2956 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2957 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2958 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2959 todo_wine
2960 {
2961 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
2962 }
2963
2964 delete_key(props, "", access);
2965 RegCloseKey(props);
2966
2967 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2968 todo_wine
2969 {
2970 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2971 }
2972
2973 delete_key(usage, "", access);
2974 RegCloseKey(usage);
2975 delete_key(hkey, "", access);
2976 RegCloseKey(hkey);
2977
2978 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2979 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2980
2981 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2982
2983 delete_key(hkey, "", access);
2984 RegCloseKey(hkey);
2985
2986 /* RegisterProduct, machine */
2987 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
2988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2989 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2990 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2991
2992 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, userugkey, 0, access, &hkey);
2993 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2994
2995 if (is_64bit)
2996 {
2997 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2998 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2999 }
3000 else
3001 {
3002 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
3003 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3004 }
3005
3006 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
3007 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
3008 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
3009 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
3010 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3011 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
3012 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3013 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
3014 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
3015 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
3016 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
3017 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
3018 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
3019 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
3020 CHECK_DEL_REG_STR(hkey, "Size", NULL);
3021 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
3022 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
3023 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3024 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3025 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
3026 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
3027 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
3028 todo_wine
3029 {
3030 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
3031 }
3032
3033 delete_key(hkey, "", access);
3034 RegCloseKey(hkey);
3035
3036 sprintf(keypath, userdata, "S-1-5-18");
3037 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3038 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3039
3040 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3041 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3042
3043 size = sizeof(path);
3044 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
3045 DeleteFileA(path);
3046 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
3047
3048 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
3049 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
3050 CHECK_DEL_REG_STR(props, "InstallDate", date);
3051 CHECK_DEL_REG_STR(props, "InstallSource", temp);
3052 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3053 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
3054 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3055 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
3056 CHECK_DEL_REG_STR(props, "Comments", NULL);
3057 CHECK_DEL_REG_STR(props, "Contact", NULL);
3058 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
3059 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
3060 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
3061 CHECK_DEL_REG_STR(props, "Readme", NULL);
3062 CHECK_DEL_REG_STR(props, "Size", NULL);
3063 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
3064 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
3065 CHECK_DEL_REG_DWORD(props, "Language", 1033);
3066 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
3067 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
3068 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
3069 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
3070 todo_wine
3071 {
3072 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
3073 }
3074
3075 delete_key(props, "", access);
3076 RegCloseKey(props);
3077
3078 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
3079 todo_wine
3080 {
3081 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3082 }
3083
3084 delete_key(usage, "", access);
3085 RegCloseKey(usage);
3086 delete_key(hkey, "", access);
3087 RegCloseKey(hkey);
3088
3089 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
3090 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3091
3092 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3093
3094 delete_key(hkey, "", access);
3095 RegCloseKey(hkey);
3096
3097 error:
3098 DeleteFileA(msifile);
3099 DeleteFileA("msitest\\maximus");
3100 RemoveDirectoryA("msitest");
3101 HeapFree(GetProcessHeap(), 0, usersid);
3102 }
3103
3104 static void test_publish_product(void)
3105 {
3106 static const char prodpath[] =
3107 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3108 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3109 static const char cuprodpath[] =
3110 "Software\\Microsoft\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3111 static const char cuupgrades[] =
3112 "Software\\Microsoft\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3113 static const char badprod[] =
3114 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products"
3115 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3116 static const char machprod[] =
3117 "Software\\Classes\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3118 static const char machup[] =
3119 "Software\\Classes\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3120 UINT r;
3121 LONG res;
3122 LPSTR usersid;
3123 HKEY sourcelist, net, props;
3124 HKEY hkey, patches, media;
3125 CHAR keypath[MAX_PATH];
3126 CHAR temp[MAX_PATH];
3127 CHAR path[MAX_PATH];
3128 BOOL old_installer = FALSE;
3129 REGSAM access = KEY_ALL_ACCESS;
3130
3131 if (is_process_limited())
3132 {
3133 skip("process is limited\n");
3134 return;
3135 }
3136
3137 if (!(usersid = get_user_sid()))
3138 return;
3139
3140 GetTempPathA(MAX_PATH, temp);
3141
3142 CreateDirectoryA("msitest", NULL);
3143 create_file("msitest\\maximus", 500);
3144
3145 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3146
3147 if (is_wow64)
3148 access |= KEY_WOW64_64KEY;
3149
3150 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3151
3152 /* PublishProduct, current user */
3153 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3154 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3155 {
3156 skip("Not enough rights to perform tests\n");
3157 goto error;
3158 }
3159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3160 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3161 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3162
3163 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3164 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3165
3166 sprintf(keypath, prodpath, usersid);
3167 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3168 if (res == ERROR_FILE_NOT_FOUND)
3169 {
3170 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3171 if (res == ERROR_SUCCESS)
3172 {
3173 win_skip("Windows Installer < 3.0 detected\n");
3174 RegCloseKey(hkey);
3175 old_installer = TRUE;
3176 goto currentuser;
3177 }
3178 else
3179 {
3180 win_skip("Install failed, no need to continue\n");
3181 return;
3182 }
3183 }
3184 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3185
3186 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3187 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3188
3189 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3190 todo_wine
3191 {
3192 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3193 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3194 }
3195
3196 delete_key(patches, "", access);
3197 RegCloseKey(patches);
3198 delete_key(hkey, "", access);
3199 RegCloseKey(hkey);
3200
3201 currentuser:
3202 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3203 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3204
3205 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3206 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3207 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3208 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3209 if (!old_installer)
3210 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3211 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
3212 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3213 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3214 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3215
3216 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
3217 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3218
3219 lstrcpyA(path, "n;1;");
3220 lstrcatA(path, temp);
3221 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3222 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3223
3224 res = RegOpenKeyA(sourcelist, "Net", &net);
3225 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3226
3227 CHECK_DEL_REG_STR(net, "1", temp);
3228
3229 RegDeleteKeyA(net, "");
3230 RegCloseKey(net);
3231
3232 res = RegOpenKeyA(sourcelist, "Media", &media);
3233 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3234
3235 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3236
3237 RegDeleteKeyA(media, "");
3238 RegCloseKey(media);
3239 RegDeleteKeyA(sourcelist, "");
3240 RegCloseKey(sourcelist);
3241 RegDeleteKeyA(hkey, "");
3242 RegCloseKey(hkey);
3243
3244 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
3245 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3246
3247 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3248
3249 RegDeleteKeyA(hkey, "");
3250 RegCloseKey(hkey);
3251
3252 /* PublishProduct, machine */
3253 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
3254 if (old_installer)
3255 goto machprod;
3256 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3257 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3258 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3259
3260 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3261 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3262
3263 sprintf(keypath, prodpath, "S-1-5-18");
3264 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3265 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3266
3267 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3268 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3269
3270 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3271 todo_wine
3272 {
3273 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3274 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3275 }
3276
3277 delete_key(patches, "", access);
3278 RegCloseKey(patches);
3279 delete_key(hkey, "", access);
3280 RegCloseKey(hkey);
3281
3282 machprod:
3283 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machprod, 0, access, &hkey);
3284 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3285
3286 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3287 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3288 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3289 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3290 if (!old_installer)
3291 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3292 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
3293 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3294 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3295 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3296
3297 res = RegOpenKeyExA(hkey, "SourceList", 0, access, &sourcelist);
3298 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3299
3300 lstrcpyA(path, "n;1;");
3301 lstrcatA(path, temp);
3302 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3303 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3304
3305 res = RegOpenKeyExA(sourcelist, "Net", 0, access, &net);
3306 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3307
3308 CHECK_DEL_REG_STR(net, "1", temp);
3309
3310 res = delete_key(net, "", access);
3311 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3312 RegCloseKey(net);
3313
3314 res = RegOpenKeyExA(sourcelist, "Media", 0, access, &media);
3315 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3316
3317 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3318
3319 res = delete_key(media, "", access);
3320 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3321 RegCloseKey(media);
3322 res = delete_key(sourcelist, "", access);
3323 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3324 RegCloseKey(sourcelist);
3325 res = delete_key(hkey, "", access);
3326 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3327 RegCloseKey(hkey);
3328
3329 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machup, 0, access, &hkey);
3330 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3331
3332 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3333
3334 res = delete_key(hkey, "", access);
3335 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3336 RegCloseKey(hkey);
3337
3338 error:
3339 DeleteFileA(msifile);
3340 DeleteFileA("msitest\\maximus");
3341 RemoveDirectoryA("msitest");
3342 HeapFree(GetProcessHeap(), 0, usersid);
3343 }
3344
3345 static void test_publish_features(void)
3346 {
3347 static const char cupath[] =
3348 "Software\\Microsoft\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3349 static const char udfeatpath[] =
3350 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3351 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
3352 static const char udpridpath[] =
3353 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3354 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3355 static const char featkey[] =
3356 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Features";
3357 static const char classfeat[] =
3358 "Software\\Classes\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3359 UINT r;
3360 LONG res;
3361 HKEY hkey;
3362 LPSTR usersid;
3363 CHAR keypath[MAX_PATH];
3364 REGSAM access = KEY_ALL_ACCESS;
3365
3366 if (is_process_limited())
3367 {
3368 skip("process is limited\n");
3369 return;
3370 }
3371
3372 if (!(usersid = get_user_sid()))
3373 return;
3374
3375 CreateDirectoryA("msitest", NULL);
3376 create_file("msitest\\maximus", 500);
3377
3378 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3379
3380 if (is_wow64)
3381 access |= KEY_WOW64_64KEY;
3382
3383 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3384
3385 /* PublishFeatures, current user */
3386 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3387 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3388 {
3389 skip("Not enough rights to perform tests\n");
3390 goto error;
3391 }
3392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3393 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3394 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3395
3396 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3397 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3398
3399 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3400 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3401
3402 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3403 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3404
3405 CHECK_REG_STR(hkey, "feature", "");
3406 CHECK_REG_STR(hkey, "montecristo", "");
3407
3408 RegDeleteValueA(hkey, "feature");
3409 RegDeleteValueA(hkey, "montecristo");
3410 delete_key(hkey, "", access);
3411 RegCloseKey(hkey);
3412
3413 sprintf(keypath, udfeatpath, usersid);
3414 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3415 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3416
3417 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3418 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3419
3420 RegDeleteValueA(hkey, "feature");
3421 RegDeleteValueA(hkey, "montecristo");
3422 delete_key(hkey, "", access);
3423 RegCloseKey(hkey);
3424 sprintf(keypath, udpridpath, usersid);
3425 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3426
3427 /* PublishFeatures, machine */
3428 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
3429 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3430 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3431 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3432
3433 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3434 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3435
3436 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3437 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3438 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3439 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3440
3441 CHECK_REG_STR(hkey, "feature", "");
3442 CHECK_REG_STR(hkey, "montecristo", "");
3443
3444 RegDeleteValueA(hkey, "feature");
3445 RegDeleteValueA(hkey, "montecristo");
3446 delete_key(hkey, "", access);
3447 RegCloseKey(hkey);
3448
3449 sprintf(keypath, udfeatpath, "S-1-5-18");
3450 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3451 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3452
3453 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3454 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3455
3456 RegDeleteValueA(hkey, "feature");
3457 RegDeleteValueA(hkey, "montecristo");
3458 delete_key(hkey, "", access);
3459 RegCloseKey(hkey);
3460 sprintf(keypath, udpridpath, "S-1-5-18");
3461 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3462
3463 error:
3464 DeleteFileA(msifile);
3465 DeleteFileA("msitest\\maximus");
3466 RemoveDirectoryA("msitest");
3467 HeapFree(GetProcessHeap(), 0, usersid);
3468 }
3469
3470 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
3471 {
3472 DWORD len = 0;
3473 LPSTR val;
3474 LONG r;
3475
3476 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
3477 if (r != ERROR_SUCCESS)
3478 return NULL;
3479
3480 len += sizeof (WCHAR);
3481 val = HeapAlloc(GetProcessHeap(), 0, len);
3482 if (!val) return NULL;
3483 val[0] = 0;
3484 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
3485 return val;
3486 }
3487
3488 static void get_owner_company(LPSTR *owner, LPSTR *company)
3489 {
3490 LONG res;
3491 HKEY hkey;
3492 REGSAM access = KEY_ALL_ACCESS;
3493
3494 *owner = *company = NULL;
3495
3496 if (is_wow64)
3497 access |= KEY_WOW64_64KEY;
3498
3499 res = RegOpenKeyA(HKEY_CURRENT_USER,
3500 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
3501 if (res == ERROR_SUCCESS)
3502 {
3503 *owner = reg_get_val_str(hkey, "DefName");
3504 *company = reg_get_val_str(hkey, "DefCompany");
3505 RegCloseKey(hkey);
3506 }
3507
3508 if (!*owner || !*company)
3509 {
3510 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3511 "Software\\Microsoft\\Windows\\CurrentVersion", 0, access, &hkey);
3512 if (res == ERROR_SUCCESS)
3513 {
3514 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3515 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3516 RegCloseKey(hkey);
3517 }
3518 }
3519
3520 if (!*owner || !*company)
3521 {
3522 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3523 "Software\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey);
3524 if (res == ERROR_SUCCESS)
3525 {
3526 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3527 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3528 RegCloseKey(hkey);
3529 }
3530 }
3531 }
3532
3533 static void test_register_user(void)
3534 {
3535 UINT r;
3536 LONG res;
3537 HKEY props;
3538 LPSTR usersid;
3539 LPSTR owner, company;
3540 CHAR keypath[MAX_PATH];
3541 REGSAM access = KEY_ALL_ACCESS;
3542
3543 static const CHAR keypropsfmt[] =
3544 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3545 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
3546 static const CHAR keypridfmt[] =
3547 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3548 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3549
3550 if (is_process_limited())
3551 {
3552 skip("process is limited\n");
3553 return;
3554 }
3555
3556 if (!(usersid = get_user_sid()))
3557 return;
3558
3559 get_owner_company(&owner, &company);
3560
3561 CreateDirectoryA("msitest", NULL);
3562 create_file("msitest\\maximus", 500);
3563
3564 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3565
3566 if (is_wow64)
3567 access |= KEY_WOW64_64KEY;
3568
3569 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3570
3571 /* RegisterUser, per-user */
3572 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
3573 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3574 {
3575 skip("Not enough rights to perform tests\n");
3576 goto error;
3577 }
3578 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3579 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3580 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3581
3582 sprintf(keypath, keypropsfmt, usersid);
3583 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3584 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3585
3586 CHECK_REG_STR(props, "ProductID", "none");
3587 CHECK_REG_STR(props, "RegCompany", company);
3588 CHECK_REG_STR(props, "RegOwner", owner);
3589
3590 RegDeleteValueA(props, "ProductID");
3591 RegDeleteValueA(props, "RegCompany");
3592 RegDeleteValueA(props, "RegOwner");
3593 delete_key(props, "", access);
3594 RegCloseKey(props);
3595 sprintf(keypath, keypridfmt, usersid);
3596 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3597
3598 /* RegisterUser, machine */
3599 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3600 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3601 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3602 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3603
3604 sprintf(keypath, keypropsfmt, "S-1-5-18");
3605 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3606 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3607
3608 CHECK_REG_STR(props, "ProductID", "none");
3609 CHECK_REG_STR(props, "RegCompany", company);
3610 CHECK_REG_STR(props, "RegOwner", owner);
3611
3612 RegDeleteValueA(props, "ProductID");
3613 RegDeleteValueA(props, "RegCompany");
3614 RegDeleteValueA(props, "RegOwner");
3615 delete_key(props, "", access);
3616 RegCloseKey(props);
3617 sprintf(keypath, keypridfmt, "S-1-5-18");
3618 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3619
3620 error:
3621 HeapFree(GetProcessHeap(), 0, company);
3622 HeapFree(GetProcessHeap(), 0, owner);
3623
3624 DeleteFileA(msifile);
3625 DeleteFileA("msitest\\maximus");
3626 RemoveDirectoryA("msitest");
3627 LocalFree(usersid);
3628 }
3629
3630 static void test_process_components(void)
3631 {
3632 static const char keyfmt[] =
3633 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Components\\%s";
3634 static const char compkey[] =
3635 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3636 UINT r;
3637 LONG res;
3638 DWORD size;
3639 HKEY comp, hkey;
3640 LPSTR usersid;
3641 CHAR val[MAX_PATH];
3642 CHAR keypath[MAX_PATH];
3643 CHAR program_files_maximus[MAX_PATH];
3644 REGSAM access = KEY_ALL_ACCESS;
3645
3646 if (is_process_limited())
3647 {
3648 skip("process is limited\n");
3649 return;
3650 }
3651
3652 if (!(usersid = get_user_sid()))
3653 return;
3654
3655 CreateDirectoryA("msitest", NULL);
3656 create_file("msitest\\maximus", 500);
3657
3658 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3659
3660 if (is_wow64)
3661 access |= KEY_WOW64_64KEY;
3662
3663 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3664
3665 /* ProcessComponents, per-user */
3666 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3667 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3668 {
3669 skip("Not enough rights to perform tests\n");
3670 goto error;
3671 }
3672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3673 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3674 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3675
3676 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3677 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3678 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3679
3680 size = MAX_PATH;
3681 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3682 NULL, NULL, (LPBYTE)val, &size);
3683 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3684
3685 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
3686 lstrcatA(program_files_maximus,"\\msitest\\maximus");
3687
3688 ok(!lstrcmpiA(val, program_files_maximus),
3689 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3690
3691 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3692 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3693
3694 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3695 delete_key(comp, "", access);
3696 RegCloseKey(comp);
3697
3698 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3699 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3700 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3701
3702 size = MAX_PATH;
3703 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3704 NULL, NULL, (LPBYTE)val, &size);
3705 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3706 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3707 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3708
3709 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3710 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3711
3712 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3713 delete_key(comp, "", access);
3714 RegCloseKey(comp);
3715
3716 /* ProcessComponents, machine */
3717 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3719 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3720 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3721
3722 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3723 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3724 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3725
3726 size = MAX_PATH;
3727 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3728 NULL, NULL, (LPBYTE)val, &size);
3729 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3730 ok(!lstrcmpiA(val, program_files_maximus),
3731 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3732
3733 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3734 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3735
3736 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3737 delete_key(comp, "", access);
3738 RegCloseKey(comp);
3739
3740 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3741 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3742 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3743
3744 size = MAX_PATH;
3745 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3746 NULL, NULL, (LPBYTE)val, &size);
3747 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3748 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3749 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3750
3751 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3752 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3753
3754 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3755 delete_key(comp, "", access);
3756 RegCloseKey(comp);
3757
3758 error:
3759 DeleteFileA(msifile);
3760 DeleteFileA("msitest\\maximus");
3761 RemoveDirectoryA("msitest");
3762 LocalFree(usersid);
3763 }
3764
3765 static void test_publish(void)
3766 {
3767 static const char subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3768 static const char subkey_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3769 UINT r;
3770 LONG res;
3771 HKEY uninstall, prodkey, uninstall_32node = NULL;
3772 INSTALLSTATE state;
3773 char date[MAX_PATH], temp[MAX_PATH], prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3774 REGSAM access = KEY_ALL_ACCESS;
3775 DWORD error;
3776
3777 if (!pMsiQueryFeatureStateExA)
3778 {
3779 win_skip("MsiQueryFeatureStateExA is not available\n");
3780 return;
3781 }
3782 if (is_process_limited())
3783 {
3784 skip("process is limited\n");
3785 return;
3786 }
3787
3788 get_date_str(date);
3789 GetTempPathA(MAX_PATH, temp);
3790
3791 if (is_wow64)
3792 access |= KEY_WOW64_64KEY;
3793
3794 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, KEY_ALL_ACCESS, &uninstall);
3795 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3796
3797 if (is_64bit)
3798 {
3799 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey_32node, 0, KEY_ALL_ACCESS, &uninstall_32node);
3800 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3801 }
3802
3803 CreateDirectoryA("msitest", NULL);
3804 create_file("msitest\\maximus", 500);
3805
3806 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3807
3808 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3809
3810 state = MsiQueryProductStateA(prodcode);
3811 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3812
3813 state = MsiQueryFeatureStateA(prodcode, "feature");
3814 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3815
3816 state = 0xdead;
3817 SetLastError(0xdeadbeef);
3818 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3819 error = GetLastError();
3820 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3821 ok(state == 0xdead, "got %d\n", state);
3822 ok(error == 0xdeadbeef, "got %u\n", error);
3823
3824 state = 0xdead;
3825 SetLastError(0xdeadbeef);
3826 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3827 error = GetLastError();
3828 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3829 ok(state == 0xdead, "got %d\n", state);
3830 ok(error == ERROR_SUCCESS, "got %u\n", error);
3831
3832 state = 0xdead;
3833 SetLastError(0xdeadbeef);
3834 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3835 error = GetLastError();
3836 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3837 ok(state == 0xdead, "got %d\n", state);
3838 ok(error == ERROR_SUCCESS, "got %u\n", error);
3839
3840 state = MsiQueryFeatureStateA(prodcode, "feature");
3841 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3842
3843 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3844 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3845
3846 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3847 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3848 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3849 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3850
3851 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3852 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3853
3854 /* nothing published */
3855 r = MsiInstallProductA(msifile, NULL);
3856 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3857 {
3858 skip("Not enough rights to perform tests\n");
3859 goto error;
3860 }
3861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3862 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3863 ok(pf_exists("msitest"), "File not installed\n");
3864
3865 state = MsiQueryProductStateA(prodcode);
3866 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3867
3868 state = MsiQueryFeatureStateA(prodcode, "feature");
3869 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3870
3871 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3872 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3873
3874 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3875 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3876 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3877 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3878
3879 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3880 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3881
3882 /* PublishProduct and RegisterProduct */
3883 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3884 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3885 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3886 ok(pf_exists("msitest"), "File not installed\n");
3887
3888 state = MsiQueryProductStateA(prodcode);
3889 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3890
3891 state = MsiQueryFeatureStateA(prodcode, "feature");
3892 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3893
3894 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3895 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3896
3897 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3898 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3899 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3900 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3901
3902 if (is_64bit)
3903 {
3904 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3905 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3906 }
3907 else
3908 {
3909 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3910 if (is_wow64 && res == ERROR_FILE_NOT_FOUND) /* XP - Vista, Wow64 */
3911 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3912 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3913 }
3914
3915 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3916 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3917 CHECK_REG_STR(prodkey, "InstallDate", date);
3918 CHECK_REG_STR(prodkey, "InstallSource", temp);
3919 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3920 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3921 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3922 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3923 CHECK_REG_STR(prodkey, "Comments", NULL);
3924 CHECK_REG_STR(prodkey, "Contact", NULL);
3925 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3926 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3927 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3928 CHECK_REG_STR(prodkey, "Readme", NULL);
3929 CHECK_REG_STR(prodkey, "Size", NULL);
3930 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3931 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3932 CHECK_REG_DWORD(prodkey, "Language", 1033);
3933 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3934 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3935 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3936 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3937 todo_wine
3938 {
3939 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3940 }
3941
3942 RegCloseKey(prodkey);
3943
3944 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3945 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3946 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3947 ok(pf_exists("msitest"), "File deleted\n");
3948
3949 state = MsiQueryProductStateA(prodcode);
3950 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3951
3952 state = MsiQueryFeatureStateA(prodcode, "feature");
3953 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3954
3955 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3956 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3957
3958 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3959 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3960 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3961 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3962
3963 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3964 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3965
3966 /* complete install */
3967 r = MsiInstallProductA(msifile, "FULL=1");
3968 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3969 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3970 ok(pf_exists("msitest"), "File not installed\n");
3971
3972 state = MsiQueryProductStateA(prodcode);
3973 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3974
3975 state = MsiQueryFeatureStateA(prodcode, "feature");
3976 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3977
3978 state = 0xdead;
3979 SetLastError(0xdeadbeef);
3980 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3981 error = GetLastError();
3982 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3983 ok(state == 0xdead, "got %d\n", state);
3984 ok(error == 0xdeadbeef, "got %u\n", error);
3985
3986 state = 0xdead;
3987 SetLastError(0xdeadbeef);
3988 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3989 error = GetLastError();
3990 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3991 ok(state == 0xdead, "got %d\n", state);
3992 ok(error == ERROR_SUCCESS, "got %u\n", error);
3993
3994 state = 0xdead;
3995 SetLastError(0xdeadbeef);
3996 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3997 error = GetLastError();
3998 ok(r == ERROR_SUCCESS, "got %u\n", r);
3999 ok(state == INSTALLSTATE_LOCAL, "got %d\n", state);
4000 ok(error == ERROR_SUCCESS, "got %u\n", error);
4001
4002 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4003 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4004
4005 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4006 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4007 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4008 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4009
4010 if (is_64bit)
4011 {
4012 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4013 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4014 }
4015 else
4016 {
4017 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4018 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4019 }
4020
4021 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4022 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4023 CHECK_REG_STR(prodkey, "InstallDate", date);
4024 CHECK_REG_STR(prodkey, "InstallSource", temp);
4025 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4026 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4027 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4028 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4029 CHECK_REG_STR(prodkey, "Comments", NULL);
4030 CHECK_REG_STR(prodkey, "Contact", NULL);
4031 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4032 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4033 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4034 CHECK_REG_STR(prodkey, "Readme", NULL);
4035 CHECK_REG_STR(prodkey, "Size", NULL);
4036 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4037 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4038 CHECK_REG_DWORD(prodkey, "Language", 1033);
4039 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4040 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4041 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4042 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4043 todo_wine
4044 {
4045 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4046 }
4047
4048 RegCloseKey(prodkey);
4049
4050 /* no UnpublishFeatures */
4051 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4052 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4053 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4054 ok(!pf_exists("msitest"), "Directory not deleted\n");
4055
4056 state = MsiQueryProductStateA(prodcode);
4057 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4058
4059 state = MsiQueryFeatureStateA(prodcode, "feature");
4060 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4061
4062 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4063 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4064
4065 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4066 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4067 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4068 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4069
4070 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4071 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4072
4073 /* complete install */
4074 r = MsiInstallProductA(msifile, "FULL=1");
4075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4076 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4077 ok(pf_exists("msitest"), "File not installed\n");
4078
4079 state = MsiQueryProductStateA(prodcode);
4080 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4081
4082 state = MsiQueryFeatureStateA(prodcode, "feature");
4083 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4084
4085 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4086 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4087
4088 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4089 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4091 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4092
4093 if (is_64bit)
4094 {
4095 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4096 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4097 }
4098 else
4099 {
4100 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4101 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4102 }
4103
4104 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4105 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4106 CHECK_REG_STR(prodkey, "InstallDate", date);
4107 CHECK_REG_STR(prodkey, "InstallSource", temp);
4108 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4109 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4110 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4111 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4112 CHECK_REG_STR(prodkey, "Comments", NULL);
4113 CHECK_REG_STR(prodkey, "Contact", NULL);
4114 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4115 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4116 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4117 CHECK_REG_STR(prodkey, "Readme", NULL);
4118 CHECK_REG_STR(prodkey, "Size", NULL);
4119 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4120 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4121 CHECK_REG_DWORD(prodkey, "Language", 1033);
4122 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4123 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4124 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4125 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4126 todo_wine
4127 {
4128 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4129 }
4130
4131 RegCloseKey(prodkey);
4132
4133 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
4134 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
4135 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4136 ok(pf_exists("msitest\\maximus"), "File deleted\n");
4137 ok(pf_exists("msitest"), "Directory deleted\n");
4138
4139 state = MsiQueryProductStateA(prodcode);
4140 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4141
4142 state = MsiQueryFeatureStateA(prodcode, "feature");
4143 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4144
4145 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4146 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4147
4148 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4149 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4150 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4151 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4152
4153 if (is_64bit)
4154 {
4155 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4156 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4157 }
4158 else
4159 {
4160 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4161 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4162 }
4163
4164 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4165 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4166 CHECK_REG_STR(prodkey, "InstallDate", date);
4167 CHECK_REG_STR(prodkey, "InstallSource", temp);
4168 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4169 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4170 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4171 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4172 CHECK_REG_STR(prodkey, "Comments", NULL);
4173 CHECK_REG_STR(prodkey, "Contact", NULL);
4174 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4175 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4176 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4177 CHECK_REG_STR(prodkey, "Readme", NULL);
4178 CHECK_REG_STR(prodkey, "Size", NULL);
4179 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4180 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4181 CHECK_REG_DWORD(prodkey, "Language", 1033);
4182 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4183 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4184 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4185 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4186 todo_wine
4187 {
4188 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4189 }
4190
4191 RegCloseKey(prodkey);
4192
4193 /* complete install */
4194 r = MsiInstallProductA(msifile, "FULL=1");
4195 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4196 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4197 ok(pf_exists("msitest"), "File not installed\n");
4198
4199 state = MsiQueryProductStateA(prodcode);
4200 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4201
4202 state = MsiQueryFeatureStateA(prodcode, "feature");
4203 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4204
4205 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4206 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4207
4208 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4209 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4210 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4211 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4212
4213 if (is_64bit)
4214 {
4215 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4216 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4217 }
4218 else
4219 {
4220 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4221 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4222 }
4223
4224 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4225 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4226 CHECK_REG_STR(prodkey, "InstallDate", date);
4227 CHECK_REG_STR(prodkey, "InstallSource", temp);
4228 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4229 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4230 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4231 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4232 CHECK_REG_STR(prodkey, "Comments", NULL);
4233 CHECK_REG_STR(prodkey, "Contact", NULL);
4234 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4235 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4236 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4237 CHECK_REG_STR(prodkey, "Readme", NULL);
4238 CHECK_REG_STR(prodkey, "Size", NULL);
4239 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4240 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4241 CHECK_REG_DWORD(prodkey, "Language", 1033);
4242 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4243 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4244 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4245 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4246 todo_wine
4247 {
4248 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -20, 10, 24);
4249 }
4250
4251 RegCloseKey(prodkey);
4252
4253 /* UnpublishFeatures, both features removed */
4254 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
4255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4256 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4257 ok(!pf_exists("msitest"), "Directory not deleted\n");
4258
4259 state = MsiQueryProductStateA(prodcode);
4260 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4261
4262 state = MsiQueryFeatureStateA(prodcode, "feature");
4263 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4264
4265 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4266 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4267
4268 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4269 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4270 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4271 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4272
4273 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4274 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4275
4276 /* complete install */
4277 r = MsiInstallProductA(msifile, "FULL=1");
4278 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4279 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4280 ok(pf_exists("msitest"), "File not installed\n");
4281
4282 state = MsiQueryProductStateA(prodcode);
4283 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4284
4285 state = MsiQueryFeatureStateA(prodcode, "feature");
4286 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4287
4288 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4289 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4290
4291 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4292 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4294 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4295
4296 if (is_64bit)
4297 {
4298 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4299 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4300 }
4301 else
4302 {
4303 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4304 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4305 }
4306
4307 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4308 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4309 CHECK_REG_STR(prodkey, "InstallDate", date);
4310 CHECK_REG_STR(prodkey, "InstallSource", temp);
4311 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4312 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4313 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4314 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4315 CHECK_REG_STR(prodkey, "Comments", NULL);
4316 CHECK_REG_STR(prodkey, "Contact", NULL);
4317 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4318 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4319 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4320 CHECK_REG_STR(prodkey, "Readme", NULL);
4321 CHECK_REG_STR(prodkey, "Size", NULL);
4322 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4323 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4324 CHECK_REG_DWORD(prodkey, "Language", 1033);
4325 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4326 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4327 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4328 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4329 todo_wine
4330 {
4331 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4332 }
4333
4334 RegCloseKey(prodkey);
4335
4336 /* complete uninstall */
4337 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4338 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4339 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4340 ok(!pf_exists("msitest"), "Directory not deleted\n");
4341
4342 state = MsiQueryProductStateA(prodcode);
4343 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4344
4345 state = MsiQueryFeatureStateA(prodcode, "feature");
4346 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4347
4348 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4349 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4350
4351 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4352 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4353 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4354 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4355
4356 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4357 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4358
4359 /* make sure 'Program Files\msitest' is removed */
4360 delete_pfmsitest_files();
4361
4362 error:
4363 RegCloseKey(uninstall);
4364 RegCloseKey(uninstall_32node);
4365 DeleteFileA(msifile);
4366 DeleteFileA("msitest\\maximus");
4367 RemoveDirectoryA("msitest");
4368 }
4369
4370 static void test_publish_sourcelist(void)
4371 {
4372 UINT r;
4373 DWORD size;
4374 CHAR value[MAX_PATH];
4375 CHAR path[MAX_PATH];
4376 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4377
4378 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
4379 {
4380 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
4381 return;
4382 }
4383 if (is_process_limited())
4384 {
4385 skip("process is limited\n");
4386 return;
4387 }
4388
4389 CreateDirectoryA("msitest", NULL);
4390 create_file("msitest\\maximus", 500);
4391
4392 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4393
4394 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4395
4396 r = MsiInstallProductA(msifile, NULL);
4397 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4398 {
4399 skip("Not enough rights to perform tests\n");
4400 goto error;
4401 }
4402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4403 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4404 ok(pf_exists("msitest"), "File not installed\n");
4405
4406 /* nothing published */
4407 size = MAX_PATH;
4408 lstrcpyA(value, "aaa");
4409 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4410 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4411 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4412 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4413 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4414
4415 size = MAX_PATH;
4416 lstrcpyA(value, "aaa");
4417 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4418 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4419 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4420 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4421 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4422
4423 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
4424 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4425 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4426 ok(pf_exists("msitest"), "File not installed\n");
4427
4428 /* after RegisterProduct */
4429 size = MAX_PATH;
4430 lstrcpyA(value, "aaa");
4431 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4432 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4433 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4434 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4435 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4436
4437 size = MAX_PATH;
4438 lstrcpyA(value, "aaa");
4439 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4440 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4441 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4442 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4443 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4444
4445 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4446 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4447 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4448 ok(pf_exists("msitest"), "File not installed\n");
4449
4450 /* after ProcessComponents */
4451 size = MAX_PATH;
4452 lstrcpyA(value, "aaa");
4453 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4454 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4455 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4456 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4457 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4458
4459 size = MAX_PATH;
4460 lstrcpyA(value, "aaa");
4461 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4462 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4463 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4464 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4465 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4466
4467 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4468 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4469 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4470 ok(pf_exists("msitest"), "File not installed\n");
4471
4472 /* after PublishFeatures */
4473 size = MAX_PATH;
4474 lstrcpyA(value, "aaa");
4475 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4476 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4477 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4478 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4479 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4480
4481 size = MAX_PATH;
4482 lstrcpyA(value, "aaa");
4483 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4484 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4485 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4486 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4487 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4488
4489 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
4490 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4491 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4492 ok(pf_exists("msitest"), "File not installed\n");
4493
4494 /* after PublishProduct */
4495 size = MAX_PATH;
4496 lstrcpyA(value, "aaa");
4497 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4498 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4500 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
4501 ok(size == 11, "Expected 11, got %d\n", size);
4502
4503 size = MAX_PATH;
4504 lstrcpyA(value, "aaa");
4505 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4506 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size);
4507 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4508 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4509 ok(size == 0, "Expected 0, got %d\n", size);
4510
4511 size = MAX_PATH;
4512 lstrcpyA(value, "aaa");
4513 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4514 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size);
4515 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4516 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4517 ok(size == 0, "Expected 0, got %d\n", size);
4518
4519 lstrcpyA(path, CURR_DIR);
4520 lstrcatA(path, "\\");
4521
4522 size = MAX_PATH;
4523 lstrcpyA(value, "aaa");
4524 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4525 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size);
4526 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4527 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4528 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4529
4530 size = MAX_PATH;
4531 lstrcpyA(value, "aaa");
4532 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4533 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size);
4534 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4535 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
4536 ok(size == 1, "Expected 1, got %d\n", size);
4537
4538 size = MAX_PATH;
4539 lstrcpyA(value, "aaa");
4540 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4541 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4542 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4543 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4544 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4545
4546 size = MAX_PATH;
4547 lstrcpyA(value, "aaa");
4548 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4549 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
4550 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4551 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4552 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4553
4554 size = MAX_PATH;
4555 lstrcpyA(value, "aaa");
4556 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4557 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
4558 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4559 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4560 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4561
4562 /* complete uninstall */
4563 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4565 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4566 ok(!pf_exists("msitest"), "Directory not deleted\n");
4567
4568 /* make sure 'Program Files\msitest' is removed */
4569 delete_pfmsitest_files();
4570
4571 error:
4572 DeleteFileA(msifile);
4573 DeleteFileA("msitest\\maximus");
4574 RemoveDirectoryA("msitest");
4575 }
4576
4577 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4578 {
4579 CHAR path[MAX_PATH];
4580
4581 lstrcpyA(path, PROG_FILES_DIR);
4582 lstrcatA(path, "\\");
4583 lstrcatA(path, file);
4584
4585 if (is_file)
4586 create_file_data(path, data, 500);
4587 else
4588 CreateDirectoryA(path, NULL);
4589 }
4590
4591 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4592
4593 static void test_remove_files(void)
4594 {
4595 UINT r;
4596
4597 if (is_process_limited())
4598 {
4599 skip("process is limited\n");
4600 return;
4601 }
4602
4603 CreateDirectoryA("msitest", NULL);
4604 create_file("msitest\\hydrogen", 500);
4605 create_file("msitest\\helium", 500);
4606 create_file("msitest\\lithium", 500);
4607
4608 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4609
4610 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4611
4612 r = MsiInstallProductA(msifile, NULL);
4613 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4614 {
4615 skip("Not enough rights to perform tests\n");
4616 goto error;
4617 }
4618 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4619 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4620 ok(!pf_exists("msitest\\helium"), "File installed\n");
4621 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4622 ok(pf_exists("msitest"), "File not installed\n");
4623
4624 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4626 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4627 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4628 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4629 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4630
4631 create_pf("msitest", FALSE);
4632 create_pf("msitest\\hydrogen", TRUE);
4633 create_pf("msitest\\helium", TRUE);
4634 create_pf("msitest\\lithium", TRUE);
4635
4636 r = MsiInstallProductA(msifile, NULL);
4637 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4638 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4639 ok(pf_exists("msitest\\helium"), "File not installed\n");
4640 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4641 ok(pf_exists("msitest"), "File not installed\n");
4642
4643 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4644 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4645 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4646 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4647 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4648 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4649
4650 create_pf("msitest", FALSE);
4651 create_pf("msitest\\furlong", TRUE);
4652 create_pf("msitest\\firkin", TRUE);
4653 create_pf("msitest\\fortnight", TRUE);
4654 create_pf("msitest\\becquerel", TRUE);
4655 create_pf("msitest\\dioptre", TRUE);
4656 create_pf("msitest\\attoparsec", TRUE);
4657 create_pf("msitest\\storeys", TRUE);
4658 create_pf("msitest\\block", TRUE);
4659 create_pf("msitest\\siriometer", TRUE);
4660 create_pf("msitest\\cabout", FALSE);
4661 create_pf("msitest\\cabout\\blocker", TRUE);
4662
4663 r = MsiInstallProductA(msifile, NULL);
4664 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4665 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4666 ok(!pf_exists("msitest\\helium"), "File installed\n");
4667 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4668 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4669 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4670 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4671 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4672 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4673 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4674 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4675 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4676 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4677 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
4678 ok(pf_exists("msitest"), "File not installed\n");
4679
4680 create_pf("msitest\\furlong", TRUE);
4681 create_pf("msitest\\firkin", TRUE);
4682 create_pf("msitest\\fortnight", TRUE);
4683 create_pf("msitest\\storeys", TRUE);
4684 create_pf("msitest\\block", TRUE);
4685 create_pf("msitest\\siriometer", TRUE);
4686
4687 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4688 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4689 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4690 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4691 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4692 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4693 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4694 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4695 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4696 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4697 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4698 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4699 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4700 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4701 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4702 ok(pf_exists("msitest"), "Directory deleted\n");
4703
4704 r = MsiInstallProductA(msifile, NULL);
4705 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4706 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
4707 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
4708 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
4709 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4710 ok(pf_exists("msitest"), "Directory deleted\n");
4711
4712 delete_pf("msitest\\cabout\\blocker", TRUE);
4713
4714 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4715 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4716 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
4717 delete_pf("msitest", FALSE);
4718
4719 error:
4720 DeleteFileA(msifile);
4721 DeleteFileA("msitest\\hydrogen");
4722 DeleteFileA("msitest\\helium");
4723 DeleteFileA("msitest\\lithium");
4724 RemoveDirectoryA("msitest");
4725 }
4726
4727 static void test_move_files(void)
4728 {
4729 UINT r;
4730 char props[MAX_PATH];
4731
4732 if (is_process_limited())
4733 {
4734 skip("process is limited\n");
4735 return;
4736 }
4737
4738 CreateDirectoryA("msitest", NULL);
4739 create_file("msitest\\augustus", 100);
4740 create_file("cameroon", 100);
4741 create_file("djibouti", 100);
4742 create_file("egypt", 100);
4743 create_file("finland", 100);
4744 create_file("gambai", 100);
4745 create_file("honduras", 100);
4746 create_file("msitest\\india", 100);
4747 create_file("japan", 100);
4748 create_file("kenya", 100);
4749 CreateDirectoryA("latvia", NULL);
4750 create_file("nauru", 100);
4751 create_file("peru", 100);
4752 create_file("apple", 100);
4753 create_file("application", 100);
4754 create_file("ape", 100);
4755 create_file("foo", 100);
4756 create_file("fao", 100);
4757 create_file("fbod", 100);
4758 create_file("budding", 100);
4759 create_file("buddy", 100);
4760 create_file("bud", 100);
4761 create_file("bar", 100);
4762 create_file("bur", 100);
4763 create_file("bird", 100);
4764
4765 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4766
4767 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4768
4769 /* if the source or dest property is not a full path,
4770 * windows tries to access it as a network resource
4771 */
4772
4773 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4774 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4775 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4776
4777 r = MsiInstallProductA(msifile, props);
4778 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4779 {
4780 skip("Not enough rights to perform tests\n");
4781 goto error;
4782 }
4783 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4784 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4785 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4786 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4787 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4788 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4789 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4790 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4791 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4792 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4793 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4794 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4795 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4796 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4797 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
4798 /* either apple or application will be moved depending on directory order */
4799 if (!delete_pf("msitest\\apple", TRUE))
4800 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4801 else
4802 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4803 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4804 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4805 /* either fao or foo will be moved depending on directory order */
4806 if (delete_pf("msitest\\foo", TRUE))
4807 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4808 else
4809 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4810 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4811 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4812 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4813 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4814 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4815 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4816 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4817 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4818 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4819 ok(DeleteFileA("cameroon"), "File moved\n");
4820 ok(!DeleteFileA("djibouti"), "File not moved\n");
4821 ok(DeleteFileA("egypt"), "File moved\n");
4822 ok(DeleteFileA("finland"), "File moved\n");
4823 ok(DeleteFileA("gambai"), "File moved\n");
4824 ok(!DeleteFileA("honduras"), "File not moved\n");
4825 ok(DeleteFileA("msitest\\india"), "File moved\n");
4826 ok(DeleteFileA("japan"), "File moved\n");
4827 ok(!DeleteFileA("kenya"), "File not moved\n");
4828 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4829 ok(!DeleteFileA("nauru"), "File not moved\n");
4830 ok(!DeleteFileA("peru"), "File not moved\n");
4831 ok(!DeleteFileA("apple"), "File not moved\n");
4832 ok(!DeleteFileA("application"), "File not moved\n");
4833 ok(DeleteFileA("ape"), "File moved\n");
4834 ok(!DeleteFileA("foo"), "File not moved\n");
4835 ok(!DeleteFileA("fao"), "File not moved\n");
4836 ok(DeleteFileA("fbod"), "File moved\n");
4837 ok(!DeleteFileA("budding"), "File not moved\n");
4838 ok(!DeleteFileA("buddy"), "File not moved\n");
4839 ok(DeleteFileA("bud"), "File moved\n");
4840 ok(!DeleteFileA("bar"), "File not moved\n");
4841 ok(!DeleteFileA("bur"), "File not moved\n");
4842 ok(DeleteFileA("bird"), "File moved\n");
4843
4844 error:
4845 DeleteFileA("cameroon");
4846 DeleteFileA("djibouti");
4847 DeleteFileA("egypt");
4848 DeleteFileA("finland");
4849 DeleteFileA("gambai");
4850 DeleteFileA("honduras");
4851 DeleteFileA("japan");
4852 DeleteFileA("kenya");
4853 DeleteFileA("nauru");
4854 DeleteFileA("peru");
4855 DeleteFileA("apple");
4856 DeleteFileA("application");
4857 DeleteFileA("ape");
4858 DeleteFileA("foo");
4859 DeleteFileA("fao");
4860 DeleteFileA("fbod");
4861 DeleteFileA("budding");
4862 DeleteFileA("buddy");
4863 DeleteFileA("bud");
4864 DeleteFileA("bar");
4865 DeleteFileA("bur");
4866 DeleteFileA("bird");
4867 DeleteFileA("msitest\\india");
4868 DeleteFileA("msitest\\augustus");
4869 RemoveDirectoryA("latvia");
4870 RemoveDirectoryA("msitest");
4871 DeleteFileA(msifile);
4872 }
4873
4874 static void test_duplicate_files(void)
4875 {
4876 UINT r;
4877
4878 if (is_process_limited())
4879 {
4880 skip("process is limited\n");
4881 return;
4882 }
4883
4884 CreateDirectoryA("msitest", NULL);
4885 create_file("msitest\\maximus", 500);
4886 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4887
4888 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4889
4890 /* fails if the destination folder is not a valid property */
4891
4892 r = MsiInstallProductA(msifile, NULL);
4893 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4894 {
4895 skip("Not enough rights to perform tests\n");
4896 goto error;
4897 }
4898 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4899 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4900 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4901 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4902 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "Directory not created\n");
4903 ok(delete_pf("msitest\\this\\doesnot", FALSE), "Directory not created\n");
4904 ok(delete_pf("msitest\\this", FALSE), "Directory not created\n");
4905 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4906
4907 error:
4908 DeleteFileA("msitest\\maximus");
4909 RemoveDirectoryA("msitest");
4910 DeleteFileA(msifile);
4911 }
4912
4913 static void test_write_registry_values(void)
4914 {
4915 UINT r;
4916 LONG res;
4917 HKEY hkey;
4918 DWORD type, size;
4919 CHAR path[MAX_PATH];
4920
4921 if (is_process_limited())
4922 {
4923 skip("process is limited\n");
4924 return;
4925 }
4926
4927 CreateDirectoryA("msitest", NULL);
4928 create_file("msitest\\augustus", 500);
4929
4930 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4931
4932 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4933
4934 if (is_64bit)
4935 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, NULL, 0,
4936 KEY_ALL_ACCESS, NULL, &hkey, NULL);
4937 else
4938 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, NULL, 0, KEY_ALL_ACCESS,
4939 NULL, &hkey, NULL);
4940 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4941
4942 res = RegSetValueExA(hkey, "Value1", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4943 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4944 res = RegSetValueExA(hkey, "Value2", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4945 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4946 res = RegSetValueExA(hkey, "Value3", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4947 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4948 res = RegSetValueExA(hkey, "Value4", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4949 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4950 res = RegSetValueExA(hkey, "Value5", 0, REG_MULTI_SZ, (const BYTE *)"one\0two\0", 9);
4951 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4952 res = RegSetValueExA(hkey, "Value6", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4953 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4954 res = RegSetValueExA(hkey, "Value7", 0, REG_SZ, (const BYTE *)"one", 4);
4955 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4956 RegCloseKey(hkey);
4957
4958 r = MsiInstallProductA(msifile, NULL);
4959 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4960 {
4961 skip("Not enough rights to perform tests\n");
4962 goto error;
4963 }
4964 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4965 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4966 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4967
4968 if (is_64bit)
4969 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4970 else
4971 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4972 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4973
4974 size = MAX_PATH;
4975 type = 0xdeadbeef;
4976 memset(path, 'a', MAX_PATH);
4977 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
4978 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4979 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
4980 ok(size == 15, "Expected 15, got %d\n", size);
4981 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4982
4983 res = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL);
4984 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4985
4986 res = action_RegDeleteTreeA(hkey, "VisualStudio", KEY_ALL_ACCESS);
4987 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4988
4989 size = MAX_PATH;
4990 type = 0xdeadbeef;
4991 memset(path, 'a', MAX_PATH);
4992 res = RegQueryValueExA(hkey, "Value1", NULL, &type, (LPBYTE)path, &size);
4993 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4994 ok(!memcmp(path, "one\0", size), "Wrong multi-sz data\n");
4995 ok(size == 5, "Expected 5, got %d\n", size);
4996 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4997
4998 size = MAX_PATH;
4999 type = 0xdeadbeef;
5000 memset(path, 'a', MAX_PATH);
5001 res = RegQueryValueExA(hkey, "Value2", NULL, &type, (LPBYTE)path, &size);
5002 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5003 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
5004 ok(size == 9, "Expected 9, got %d\n", size);
5005 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5006
5007 size = MAX_PATH;
5008 type = 0xdeadbeef;
5009 memset(path, 'a', MAX_PATH);
5010 res = RegQueryValueExA(hkey, "Value3", NULL, &type, (LPBYTE)path, &size);
5011 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5012 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
5013 ok(size == 9, "Expected 9, got %d\n", size);
5014 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5015
5016 size = MAX_PATH;
5017 type = 0xdeadbeef;
5018 memset(path, 'a', MAX_PATH);
5019 res = RegQueryValueExA(hkey, "Value4", NULL, &type, (LPBYTE)path, &size);
5020 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5021 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
5022 ok(size == 9, "Expected 9, got %d\n", size);
5023 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5024
5025 size = MAX_PATH;
5026 type = 0xdeadbeef;
5027 memset(path, 'a', MAX_PATH);
5028 res = RegQueryValueExA(hkey, "Value5", NULL, &type, (LPBYTE)path, &size);
5029 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5030 ok(!memcmp(path, "one\0two\0three\0", size), "Wrong multi-sz data\n");
5031 ok(size == 15, "Expected 15, got %d\n", size);
5032 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5033
5034 size = MAX_PATH;
5035 type = 0xdeadbeef;
5036 memset(path, 'a', MAX_PATH);
5037 res = RegQueryValueExA(hkey, "Value6", NULL, &type, (LPBYTE)path, &size);
5038 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5039 ok(!memcmp(path, "", size), "Wrong multi-sz data\n");
5040 ok(size == 1, "Expected 1, got %d\n", size);
5041 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5042
5043 size = MAX_PATH;
5044 type = 0xdeadbeef;
5045 memset(path, 'a', MAX_PATH);
5046 res = RegQueryValueExA(hkey, "Value7", NULL, &type, (LPBYTE)path, &size);
5047 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5048 ok(!memcmp(path, "two\0", size), "Wrong multi-sz data\n");
5049 ok(size == 5, "Expected 5, got %d\n", size);
5050 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5051
5052 RegDeleteValueA(hkey, "Value");
5053 RegDeleteValueA(hkey, "Value1");
5054 RegDeleteValueA(hkey, "Value2");
5055 RegDeleteValueA(hkey, "Value3");
5056 RegDeleteValueA(hkey, "Value4");
5057 RegDeleteValueA(hkey, "Value5");
5058 RegDeleteValueA(hkey, "Value6");
5059 RegDeleteValueA(hkey, "Value7");
5060 RegCloseKey(hkey);
5061 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
5062
5063 error:
5064 DeleteFileA(msifile);
5065 DeleteFileA("msitest\\augustus");
5066 RemoveDirectoryA("msitest");
5067 }
5068
5069 static void test_envvar(void)
5070 {
5071 static const char *results[] =
5072 {
5073 "1;2", /* MSITESTVAR11 */
5074 "1", /* MSITESTVAR12 */
5075 "1;2", /* MSITESTVAR13 */
5076 ";1;", /* MSITESTVAR14 */
5077 ";;1;;", /* MSITESTVAR15 */
5078 " 1 ", /* MSITESTVAR16 */
5079 ";;2;;1", /* MSITESTVAR17 */
5080 "1;;2;;", /* MSITESTVAR18 */
5081 "1", /* MSITESTVAR19 */
5082 "1", /* MSITESTVAR20 */
5083 NULL
5084 };
5085 UINT r;
5086 HKEY env;
5087 LONG res;
5088 DWORD type, size;
5089 char buffer[16];
5090 UINT i;
5091
5092 if (is_process_limited())
5093 {
5094 skip("process is limited\n");
5095 return;
5096 }
5097
5098 create_test_files();
5099 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
5100
5101 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
5102 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5103
5104 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
5105 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5106
5107 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
5108 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5109
5110 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5111
5112 r = MsiInstallProductA(msifile, NULL);
5113 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5114 {
5115 skip("Not enough rights to perform tests\n");
5116 goto error;
5117 }
5118 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5119
5120 type = REG_NONE;
5121 size = sizeof(buffer);
5122 buffer[0] = 0;
5123 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
5124 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5125 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5126 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5127
5128 res = RegDeleteValueA(env, "MSITESTVAR1");
5129 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5130
5131 type = REG_NONE;
5132 size = sizeof(buffer);
5133 buffer[0] = 0;
5134 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
5135 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5136 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5137 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5138
5139 res = RegDeleteValueA(env, "MSITESTVAR2");
5140 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5141
5142 res = RegDeleteValueA(env, "MSITESTVAR3");
5143 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5144
5145 res = RegDeleteValueA(env, "MSITESTVAR4");
5146 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5147
5148 res = RegDeleteValueA(env, "MSITESTVAR5");
5149 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5150
5151 res = RegDeleteValueA(env, "MSITESTVAR6");
5152 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5153
5154 res = RegDeleteValueA(env, "MSITESTVAR7");
5155 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5156
5157 res = RegDeleteValueA(env, "MSITESTVAR8");
5158 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5159
5160 res = RegDeleteValueA(env, "MSITESTVAR9");
5161 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5162
5163 res = RegDeleteValueA(env, "MSITESTVAR10");
5164 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5165
5166 i = 11;
5167 while (results[i - 11])
5168 {
5169 char name[20];
5170 sprintf(name, "MSITESTVAR%d", i);
5171
5172 type = REG_NONE;
5173 size = sizeof(buffer);
5174 buffer[0] = 0;
5175 res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size);
5176 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5177 ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
5178 ok(!lstrcmpA(buffer, results[i - 11]), "%d: Expected %s, got %s\n", i, results[i - 11], buffer);
5179
5180 res = RegDeleteValueA(env, name);
5181 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5182 i++;
5183 }
5184
5185 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
5186 delete_pf("msitest\\cabout\\new", FALSE);
5187 delete_pf("msitest\\cabout\\four.txt", TRUE);
5188 delete_pf("msitest\\cabout", FALSE);
5189 delete_pf("msitest\\changed\\three.txt", TRUE);
5190 delete_pf("msitest\\changed", FALSE);
5191 delete_pf("msitest\\first\\two.txt", TRUE);
5192 delete_pf("msitest\\first", FALSE);
5193 delete_pf("msitest\\filename", TRUE);
5194 delete_pf("msitest\\one.txt", TRUE);
5195 delete_pf("msitest\\service.exe", TRUE);
5196 delete_pf("msitest\\service2.exe", TRUE);
5197 delete_pf("msitest", FALSE);
5198
5199 error:
5200 RegDeleteValueA(env, "MSITESTVAR1");
5201 RegDeleteValueA(env, "MSITESTVAR2");
5202 RegCloseKey(env);
5203
5204 delete_test_files();
5205 DeleteFileA(msifile);
5206 }
5207
5208 static void test_create_remove_folder(void)
5209 {
5210 UINT r;
5211
5212 if (is_process_limited())
5213 {
5214 skip("process is limited\n");
5215 return;
5216 }
5217
5218 CreateDirectoryA("msitest", NULL);
5219 CreateDirectoryA("msitest\\first", NULL);
5220 CreateDirectoryA("msitest\\second", NULL);
5221 create_file("msitest\\first\\one.txt", 1000);
5222 create_file("msitest\\second\\two.txt", 1000);
5223 create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
5224
5225 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5226
5227 r = MsiInstallProductA(msifile, NULL);
5228 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5229 {
5230 skip("Not enough rights to perform tests\n");
5231 goto error;
5232 }
5233 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5234
5235 ok(pf_exists("msitest\\first\\one.txt"), "file not installed\n");
5236 ok(pf_exists("msitest\\first"), "directory not created\n");
5237 ok(pf_exists("msitest\\second\\two.txt"), "file not installed\n");
5238 ok(pf_exists("msitest\\second"), "directory not created\n");
5239 ok(pf_exists("msitest\\third"), "directory not created\n");
5240 ok(pf_exists("msitest"), "directory not created\n");
5241
5242 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5244
5245 ok(!pf_exists("msitest\\first\\one.txt"), "file not removed\n");
5246 ok(!pf_exists("msitest\\first"), "directory not removed\n");
5247 ok(!pf_exists("msitest\\second\\two.txt"), "file not removed\n");
5248 ok(!pf_exists("msitest\\second"), "directory not removed\n");
5249 ok(!pf_exists("msitest\\third"), "directory not removed\n");
5250 todo_wine ok(!pf_exists("msitest"), "directory not removed\n");
5251
5252 error:
5253 DeleteFileA("msitest\\first\\one.txt");
5254 DeleteFileA("msitest\\second\\two.txt");
5255 RemoveDirectoryA("msitest\\first");
5256 RemoveDirectoryA("msitest\\second");
5257 RemoveDirectoryA("msitest");
5258 DeleteFileA(msifile);
5259 }
5260
5261 static void test_start_services(void)
5262 {
5263 UINT r;
5264 SC_HANDLE scm, service;
5265 BOOL ret;
5266 DWORD error = ERROR_SUCCESS;
5267
5268 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5269 if (!scm && GetLastError() == ERROR_ACCESS_DENIED)
5270 {
5271 skip("Not enough rights to perform tests\n");
5272 return;
5273 }
5274 ok(scm != NULL, "Failed to open the SC Manager\n");
5275 if (!scm) return;
5276
5277 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5278 if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
5279 {
5280 win_skip("The 'Spooler' service does not exist\n");
5281 CloseServiceHandle(scm);
5282 return;
5283 }
5284 ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
5285 if (!service) {
5286 CloseServiceHandle(scm);
5287 return;
5288 }
5289
5290 ret = StartServiceA(service, 0, NULL);
5291 if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
5292 {
5293 skip("Spooler service not available, skipping test\n");
5294 CloseServiceHandle(service);
5295 CloseServiceHandle(scm);
5296 return;
5297 }
5298
5299 CloseServiceHandle(service);
5300 CloseServiceHandle(scm);
5301
5302 create_test_files();
5303 create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
5304
5305 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5306
5307 r = MsiInstallProductA(msifile, NULL);
5308 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5309
5310 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5311 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5312 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5313 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5314 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5315 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5316 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5317 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5318 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5319 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5320 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5321 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5322 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5323
5324 delete_test_files();
5325 DeleteFileA(msifile);
5326
5327 if (error == ERROR_SUCCESS)
5328 {
5329 SERVICE_STATUS status;
5330
5331 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5332 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5333
5334 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
5335 ok(ret, "ControlService failed %u\n", GetLastError());
5336
5337 CloseServiceHandle(service);
5338 CloseServiceHandle(scm);
5339 }
5340 }
5341
5342 static void test_delete_services(void)
5343 {
5344 UINT r;
5345 SC_HANDLE manager, service;
5346 DWORD error;
5347
5348 if (is_process_limited())
5349 {
5350 skip("process is limited\n");
5351 return;
5352 }
5353
5354 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5355 ok(manager != NULL, "can't open service manager %u\n", GetLastError());
5356 if (!manager) return;
5357
5358 service = CreateServiceA(manager, "TestService3", "TestService3",
5359 SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START,
5360 SERVICE_ERROR_NORMAL, "C:\\doesnt_exist.exe", NULL, NULL, NULL, NULL, NULL);
5361 ok(service != NULL, "can't create service %u\n", GetLastError());
5362 CloseServiceHandle(service);
5363 CloseServiceHandle(manager);
5364 if (!service) goto error;
5365
5366 create_test_files();
5367 create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
5368
5369 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5370
5371 r = MsiInstallProductA(msifile, NULL);
5372 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5373 {
5374 skip("Not enough rights to perform tests\n");
5375 goto error;
5376 }
5377 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5378
5379 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5380 ok(manager != NULL, "can't open service manager\n");
5381 if (!manager) goto error;
5382
5383 service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
5384 error = GetLastError();
5385 ok(service == NULL, "TestService3 not deleted\n");
5386 ok(error == ERROR_SERVICE_DOES_NOT_EXIST, "wrong error %u\n", error);
5387 CloseServiceHandle(manager);
5388
5389 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5390 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5391
5392 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5393 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5394 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5395 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5396 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5397 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5398 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5399 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5400 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5401 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5402 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5403 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5404 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5405
5406 error:
5407 delete_test_files();
5408 DeleteFileA(msifile);
5409 }
5410
5411 static void test_install_services(void)
5412 {
5413 UINT r;
5414 SC_HANDLE manager, service;
5415 BOOL ret;
5416
5417 if (is_process_limited())
5418 {
5419 skip("process is limited\n");
5420 return;
5421 }
5422
5423 create_test_files();
5424 create_database(msifile, sis_tables, sizeof(sis_tables) / sizeof(msi_table));
5425
5426 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5427
5428 r = MsiInstallProductA(msifile, NULL);
5429 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5430 {
5431 skip("Not enough rights to perform tests\n");
5432 goto error;
5433 }
5434 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5435
5436 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5437 ok(manager != NULL, "can't open service manager\n");
5438 if (!manager) goto error;
5439
5440 service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5441 ok(service != NULL, "TestService not installed\n");
5442 CloseServiceHandle(service);
5443
5444 service = OpenServiceA(manager, "TestService4", GENERIC_ALL);
5445 ok(service == NULL, "TestService4 installed\n");
5446 CloseServiceHandle(manager);
5447
5448 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5449 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5450
5451 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5452 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5453 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5454 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5455 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5456 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5457 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5458 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5459 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5460 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5461 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5462 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5463 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5464
5465 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5466 ok(manager != NULL, "can't open service manager\n");
5467 if (!manager) goto error;
5468
5469 service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5470 ok(service != NULL, "TestService doesn't exist\n");
5471
5472 ret = DeleteService( service );
5473 ok( ret, "failed to delete service %u\n", GetLastError() );
5474
5475 CloseServiceHandle(service);
5476 CloseServiceHandle(manager);
5477
5478 error:
5479 delete_test_files();
5480 DeleteFileA(msifile);
5481 }
5482
5483 static void test_self_registration(void)
5484 {
5485 UINT r;
5486
5487 if (is_process_limited())
5488 {
5489 skip("process is limited\n");
5490 return;
5491 }
5492
5493 create_test_files();
5494 create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
5495
5496 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5497
5498 r = MsiInstallProductA(msifile, NULL);
5499 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5500 {
5501 skip("Not enough rights to perform tests\n");
5502 goto error;
5503 }
5504 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5505
5506 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5507 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5508 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5509 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5510 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5511 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5512 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5513 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5514 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5515 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5516 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5517 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5518 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5519
5520 error:
5521 delete_test_files();
5522 DeleteFileA(msifile);
5523 }
5524
5525 static void test_register_font(void)
5526 {
5527 static const char regfont1[] = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
5528 static const char regfont2[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Fonts";
5529 LONG ret;
5530 HKEY key;
5531 UINT r;
5532 REGSAM access = KEY_ALL_ACCESS;
5533
5534 if (is_process_limited())
5535 {
5536 skip("process is limited\n");
5537 return;
5538 }
5539
5540 create_test_files();
5541 create_file("msitest\\font.ttf", 1000);
5542 create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table));
5543
5544 if (is_wow64)
5545 access |= KEY_WOW64_64KEY;
5546
5547 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5548
5549 r = MsiInstallProductA(msifile, NULL);
5550 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5551 {
5552 skip("Not enough rights to perform tests\n");
5553 goto error;
5554 }
5555 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5556
5557 ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont1, 0, access, &key);
5558 if (ret)
5559 RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont2, 0, access, &key);
5560
5561 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5562 ok(ret != ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5563
5564 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5565 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5566
5567 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5568
5569 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5570 ok(ret == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5571
5572 RegDeleteValueA(key, "msi test font");
5573 RegCloseKey(key);
5574
5575 error:
5576 DeleteFileA("msitest\\font.ttf");
5577 delete_test_files();
5578 DeleteFileA(msifile);
5579 }
5580
5581 static void test_validate_product_id(void)
5582 {
5583 UINT r;
5584
5585 if (is_process_limited())
5586 {
5587 skip("process is limited\n");
5588 return;
5589 }
5590
5591 create_test_files();
5592 create_database(msifile, vp_tables, sizeof(vp_tables) / sizeof(msi_table));
5593
5594 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5595
5596 r = MsiInstallProductA(msifile, NULL);
5597 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5598 {
5599 skip("Not enough rights to perform tests\n");
5600 goto error;
5601 }
5602 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5603
5604 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=1");
5605 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5606
5607 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=2");
5608 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5609
5610 r = MsiInstallProductA(msifile, "PIDKEY=123-1234567");
5611 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5612
5613 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5614 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5615 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5616 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5617 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5618 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5619 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5620 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5621 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5622 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5623 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5624 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5625 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5626
5627 error:
5628 delete_test_files();
5629 DeleteFileA(msifile);
5630 }
5631
5632 static void test_install_remove_odbc(void)
5633 {
5634 UINT r;
5635
5636 if (is_process_limited())
5637 {
5638 skip("process is limited\n");
5639 return;
5640 }
5641
5642 create_test_files();
5643 create_file("msitest\\ODBCdriver.dll", 1000);
5644 create_file("msitest\\ODBCdriver2.dll", 1000);
5645 create_file("msitest\\ODBCtranslator.dll", 1000);
5646 create_file("msitest\\ODBCtranslator2.dll", 1000);
5647 create_file("msitest\\ODBCsetup.dll", 1000);
5648 create_database(msifile, odbc_tables, sizeof(odbc_tables) / sizeof(msi_table));
5649
5650 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5651
5652 r = MsiInstallProductA(msifile, NULL);
5653 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5654 {
5655 skip("Not enough rights to perform tests\n");
5656 goto error;
5657 }
5658 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5659
5660 ok(pf_exists("msitest\\ODBCdriver.dll"), "file not created\n");
5661 ok(pf_exists("msitest\\ODBCdriver2.dll"), "file not created\n");
5662 ok(pf_exists("msitest\\ODBCtranslator.dll"), "file not created\n");
5663 ok(pf_exists("msitest\\ODBCtranslator2.dll"), "file not created\n");
5664 ok(pf_exists("msitest\\ODBCsetup.dll"), "file not created\n");
5665
5666 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5667 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5668
5669 ok(!delete_pf("msitest\\ODBCdriver.dll", TRUE), "file not removed\n");
5670 ok(!delete_pf("msitest\\ODBCdriver2.dll", TRUE), "file not removed\n");
5671 ok(!delete_pf("msitest\\ODBCtranslator.dll", TRUE), "file not removed\n");
5672 ok(!delete_pf("msitest\\ODBCtranslator2.dll", TRUE), "file not removed\n");
5673 ok(!delete_pf("msitest\\ODBCsetup.dll", TRUE), "file not removed\n");
5674 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5675
5676 error:
5677 DeleteFileA("msitest\\ODBCdriver.dll");
5678 DeleteFileA("msitest\\ODBCdriver2.dll");
5679 DeleteFileA("msitest\\ODBCtranslator.dll");
5680 DeleteFileA("msitest\\ODBCtranslator2.dll");
5681 DeleteFileA("msitest\\ODBCsetup.dll");
5682 delete_test_files();
5683 DeleteFileA(msifile);
5684 }
5685
5686 static void test_register_typelib(void)
5687 {
5688 UINT r;
5689
5690 if (is_process_limited())
5691 {
5692 skip("process is limited\n");
5693 return;
5694 }
5695
5696 create_test_files();
5697 create_file("msitest\\typelib.dll", 1000);
5698 create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
5699
5700 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5701
5702 r = MsiInstallProductA(msifile, "REGISTER_TYPELIB=1");
5703 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5704 {
5705 skip("Not enough rights to perform tests\n");
5706 goto error;
5707 }
5708 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5709
5710 r = MsiInstallProductA(msifile, NULL);
5711 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5712
5713 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5715
5716 ok(!delete_pf("msitest\\typelib.dll", TRUE), "file not removed\n");
5717 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5718
5719 error:
5720 DeleteFileA("msitest\\typelib.dll");
5721 delete_test_files();
5722 DeleteFileA(msifile);
5723 }
5724
5725 static void test_create_remove_shortcut(void)
5726 {
5727 UINT r;
5728
5729 if (is_process_limited())
5730 {
5731 skip("process is limited\n");
5732 return;
5733 }
5734
5735 create_test_files();
5736 create_file("msitest\\target.txt", 1000);
5737 create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
5738
5739 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5740
5741 r = MsiInstallProductA(msifile, NULL);
5742 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5743 {
5744 skip("Not enough rights to perform tests\n");
5745 goto error;
5746 }
5747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5748
5749 ok(pf_exists("msitest\\target.txt"), "file not created\n");
5750 ok(pf_exists("msitest\\shortcut.lnk"), "file not created\n");
5751
5752 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5754
5755 ok(!delete_pf("msitest\\shortcut.lnk", TRUE), "file not removed\n");
5756 ok(!delete_pf("msitest\\target.txt", TRUE), "file not removed\n");
5757 todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5758
5759 error:
5760 DeleteFileA("msitest\\target.txt");
5761 delete_test_files();
5762 DeleteFileA(msifile);
5763 }
5764
5765 static void test_publish_components(void)
5766 {
5767 static const char keypath[] =
5768 "Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
5769
5770 UINT r;
5771 LONG res;
5772 HKEY key;
5773
5774 if (is_process_limited())
5775 {
5776 skip("process is limited\n");
5777 return;
5778 }
5779
5780 create_test_files();
5781 create_file("msitest\\english.txt", 1000);
5782 create_database(msifile, pub_tables, sizeof(pub_tables) / sizeof(msi_table));
5783
5784 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5785
5786 r = MsiInstallProductA(msifile, NULL);
5787 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5788 {
5789 skip("Not enough rights to perform tests\n");
5790 goto error;
5791 }
5792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5793
5794 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5795 ok(res == ERROR_SUCCESS, "components key not created %d\n", res);
5796
5797 res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, NULL);
5798 ok(res == ERROR_SUCCESS, "value not found %d\n", res);
5799 RegCloseKey(key);
5800
5801 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5802 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5803
5804 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5805 ok(res == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", res);
5806
5807 ok(!delete_pf("msitest\\english.txt", TRUE), "file not removed\n");
5808 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5809
5810 error:
5811 DeleteFileA("msitest\\english.txt");
5812 delete_test_files();
5813 DeleteFileA(msifile);
5814 }
5815
5816 static void test_remove_duplicate_files(void)
5817 {
5818 UINT r;
5819
5820 if (is_process_limited())
5821 {
5822 skip("process is limited\n");
5823 return;
5824 }
5825
5826 create_test_files();
5827 create_file("msitest\\original.txt", 1000);
5828 create_file("msitest\\original2.txt", 1000);
5829 create_file("msitest\\original3.txt", 1000);
5830 create_database(msifile, rd_tables, sizeof(rd_tables) / sizeof(msi_table));
5831
5832 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5833
5834 r = MsiInstallProductA(msifile, NULL);
5835 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5836 {
5837 skip("Not enough rights to perform tests\n");
5838 goto error;
5839 }
5840 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5841
5842 ok(pf_exists("msitest\\original.txt"), "file not created\n");
5843 ok(pf_exists("msitest\\original2.txt"), "file not created\n");
5844 ok(!pf_exists("msitest\\original3.txt"), "file created\n");
5845 ok(pf_exists("msitest\\duplicate.txt"), "file not created\n");
5846 ok(!pf_exists("msitest\\duplicate2.txt"), "file created\n");
5847
5848 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5850
5851 ok(delete_pf("msitest\\original.txt", TRUE), "file removed\n");
5852 ok(!delete_pf("msitest\\original2.txt", TRUE), "file not removed\n");
5853 ok(!delete_pf("msitest\\original3.txt", TRUE), "file not removed\n");
5854 ok(!delete_pf("msitest\\duplicate.txt", TRUE), "file not removed\n");
5855 ok(!delete_pf("msitest\\duplicate2.txt", TRUE), "file not removed\n");
5856 ok(delete_pf("msitest", FALSE), "directory removed\n");
5857
5858 error:
5859 DeleteFileA("msitest\\original.txt");
5860 DeleteFileA("msitest\\original2.txt");
5861 DeleteFileA("msitest\\original3.txt");
5862 delete_test_files();
5863 DeleteFileA(msifile);
5864 }
5865
5866 static void test_remove_registry_values(void)
5867 {
5868 UINT r;
5869 LONG res;
5870 HKEY key;
5871 REGSAM access = KEY_ALL_ACCESS;
5872
5873 if (is_process_limited())
5874 {
5875 skip("process is limited\n");
5876 return;
5877 }
5878
5879 create_test_files();
5880 create_file("msitest\\registry.txt", 1000);
5881 create_database(msifile, rrv_tables, sizeof(rrv_tables) / sizeof(msi_table));
5882
5883 if (is_wow64)
5884 access |= KEY_WOW64_64KEY;
5885
5886 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5887
5888 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, NULL, 0, access, NULL, &key, NULL);
5889 RegSetValueExA(key, "value1", 0, REG_SZ, (const BYTE *)"1", 2);
5890 RegCloseKey(key);
5891
5892 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5893 RegSetValueExA(key, "value2", 0, REG_SZ, (const BYTE *)"2", 2);
5894 RegCloseKey(key);
5895
5896 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, NULL, 0, access, NULL, &key, NULL);
5897 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5898 RegSetValueExA(key, "valueA", 0, REG_SZ, (const BYTE *)"A", 2);
5899 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5900 RegCloseKey(key);
5901
5902 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, NULL, 0, access, NULL, &key, NULL);
5903 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5904 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5905 RegCloseKey(key);
5906
5907 r = MsiInstallProductA(msifile, NULL);
5908 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5909 {
5910 skip("Not enough rights to perform tests\n");
5911 goto error;
5912 }
5913 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5914
5915 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, access, &key);
5916 ok(res == ERROR_SUCCESS, "key removed\n");
5917 RegCloseKey(key);
5918
5919 if (is_64bit)
5920 {
5921 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5922 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5923 }
5924 else
5925 {
5926 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5927 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5928 }
5929
5930 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5931 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5932 RegCloseKey(key);
5933
5934 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5935 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5936
5937 if (is_64bit)
5938 {
5939 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5940 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5941 }
5942 else
5943 {
5944 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5945 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5946 }
5947
5948 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, access, &key);
5949 ok(res == ERROR_SUCCESS, "key removed\n");
5950 RegCloseKey(key);
5951
5952 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, access, &key);
5953 ok(res == ERROR_SUCCESS, "key removed\n");
5954 RegCloseKey(key);
5955
5956 if (is_64bit)
5957 {
5958 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5959 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5960 }
5961 else
5962 {
5963 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5964 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5965 }
5966
5967 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5968 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5969 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine", access);
5970
5971 ok(!delete_pf("msitest\\registry.txt", TRUE), "file not removed\n");
5972 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5973
5974 error:
5975 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", access);
5976 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5977 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5978 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", access);
5979
5980 DeleteFileA("msitest\\registry.txt");
5981 delete_test_files();
5982 DeleteFileA(msifile);
5983 }
5984
5985 static void test_find_related_products(void)
5986 {
5987 UINT r;
5988
5989 if (is_process_limited())
5990 {
5991 skip("process is limited\n");
5992 return;
5993 }
5994
5995 create_test_files();
5996 create_file("msitest\\product.txt", 1000);
5997 create_database(msifile, frp_tables, sizeof(frp_tables) / sizeof(msi_table));
5998
5999 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6000
6001 r = MsiInstallProductA(msifile, NULL);
6002 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6003 {
6004 skip("Not enough rights to perform tests\n");
6005 goto error;
6006 }
6007 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6008
6009 /* install again, so it finds the upgrade code */
6010 r = MsiInstallProductA(msifile, NULL);
6011 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6012
6013 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6015
6016 ok(!delete_pf("msitest\\product.txt", TRUE), "file not removed\n");
6017 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6018
6019 error:
6020 DeleteFileA("msitest\\product.txt");
6021 delete_test_files();
6022 DeleteFileA(msifile);
6023 }
6024
6025 static void test_remove_ini_values(void)
6026 {
6027 UINT r;
6028 DWORD len;
6029 char inifile[MAX_PATH], buf[0x10];
6030 HANDLE file;
6031 BOOL ret;
6032
6033 if (is_process_limited())
6034 {
6035 skip("process is limited\n");
6036 return;
6037 }
6038
6039 create_test_files();
6040 create_file("msitest\\inifile.txt", 1000);
6041 create_database(msifile, riv_tables, sizeof(riv_tables) / sizeof(msi_table));
6042
6043 lstrcpyA(inifile, PROG_FILES_DIR);
6044 lstrcatA(inifile, "\\msitest");
6045 ret = CreateDirectoryA(inifile, NULL);
6046 if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
6047 {
6048 skip("Not enough rights to perform tests\n");
6049 goto error;
6050 }
6051 lstrcatA(inifile, "\\test.ini");
6052 file = CreateFileA(inifile, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, NULL);
6053 CloseHandle(file);
6054
6055 ret = WritePrivateProfileStringA("section1", "key1", "value1", inifile);
6056 ok(ret, "failed to write profile string %u\n", GetLastError());
6057
6058 ret = WritePrivateProfileStringA("sectionA", "keyA", "valueA", inifile);
6059 ok(ret, "failed to write profile string %u\n", GetLastError());
6060
6061 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6062
6063 r = MsiInstallProductA(msifile, NULL);
6064 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6065
6066 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
6067 ok(len == 6, "got %u expected 6\n", len);
6068
6069 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
6070 ok(!len, "got %u expected 0\n", len);
6071
6072 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6073 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6074
6075 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
6076 ok(!len, "got %u expected 0\n", len);
6077
6078 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
6079 ok(!len, "got %u expected 0\n", len);
6080
6081 todo_wine ok(!delete_pf("msitest\\test.ini", TRUE), "file removed\n");
6082 ok(!delete_pf("msitest\\inifile.txt", TRUE), "file not removed\n");
6083 ok(delete_pf("msitest", FALSE), "directory removed\n");
6084
6085 error:
6086 DeleteFileA("msitest\\inifile.txt");
6087 delete_test_files();
6088 DeleteFileA(msifile);
6089 }
6090
6091 static void test_remove_env_strings(void)
6092 {
6093 UINT r;
6094 LONG res;
6095 HKEY key;
6096 DWORD type, size;
6097 char buffer[0x10];
6098
6099 if (is_process_limited())
6100 {
6101 skip("process is limited\n");
6102 return;
6103 }
6104
6105 create_test_files();
6106 create_file("msitest\\envvar.txt", 1000);
6107 create_database(msifile, res_tables, sizeof(res_tables) / sizeof(msi_table));
6108
6109 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6110
6111 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6112 ok(!res, "failed to open environment key %d\n", res);
6113
6114 RegSetValueExA(key, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"1", 2);
6115 RegSetValueExA(key, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"1", 2);
6116 RegSetValueExA(key, "MSITESTVAR3", 0, REG_SZ, (const BYTE *)"1", 2);
6117 RegSetValueExA(key, "MSITESTVAR4", 0, REG_SZ, (const BYTE *)"1", 2);
6118 RegSetValueExA(key, "MSITESTVAR5", 0, REG_SZ, (const BYTE *)"1", 2);
6119
6120 RegCloseKey(key);
6121
6122 r = MsiInstallProductA(msifile, NULL);
6123 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6124 {
6125 skip("Not enough rights to perform tests\n");
6126 goto error;
6127 }
6128 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6129
6130 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6131 ok(!res, "failed to open environment key %d\n", res);
6132
6133 type = REG_NONE;
6134 buffer[0] = 0;
6135 size = sizeof(buffer);
6136 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
6137 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6138 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6139 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6140
6141 type = REG_NONE;
6142 buffer[0] = 0;
6143 size = sizeof(buffer);
6144 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
6145 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6146 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6147 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6148
6149 type = REG_NONE;
6150 buffer[0] = 0;
6151 size = sizeof(buffer);
6152 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
6153 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6154 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6155 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6156
6157 type = REG_NONE;
6158 buffer[0] = 0;
6159 size = sizeof(buffer);
6160 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, &type, (LPBYTE)buffer, &size);
6161 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6162 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6163 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6164
6165 type = REG_NONE;
6166 buffer[0] = 0;
6167 size = sizeof(buffer);
6168 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
6169 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6170 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6171 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6172
6173 RegCloseKey(key);
6174
6175 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6176 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6177
6178 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6179 ok(!res, "failed to open environment key %d\n", res);
6180
6181 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, NULL, NULL, NULL);
6182 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6183
6184 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, NULL, NULL, NULL);
6185 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6186
6187 type = REG_NONE;
6188 buffer[0] = 0;
6189 size = sizeof(buffer);
6190 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
6191 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6192 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6193 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6194 RegDeleteValueA(key, "MSITESTVAR3");
6195
6196 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, NULL, NULL, NULL);
6197 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6198
6199 type = REG_NONE;
6200 buffer[0] = 0;
6201 size = sizeof(buffer);
6202 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
6203 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6204 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6205 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6206 RegDeleteValueA(key, "MSITESTVAR5");
6207
6208 ok(!delete_pf("msitest\\envvar.txt", TRUE), "file not removed\n");
6209 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6210
6211 error:
6212 RegDeleteValueA(key, "MSITESTVAR1");
6213 RegDeleteValueA(key, "MSITESTVAR2");
6214 RegDeleteValueA(key, "MSITESTVAR3");
6215 RegDeleteValueA(key, "MSITESTVAR4");
6216 RegDeleteValueA(key, "MSITESTVAR5");
6217 RegCloseKey(key);
6218
6219 DeleteFileA("msitest\\envvar.txt");
6220 delete_test_files();
6221 DeleteFileA(msifile);
6222 }
6223
6224 static void test_register_class_info(void)
6225 {
6226 UINT r;
6227 LONG res;
6228 HKEY hkey;
6229
6230 if (is_process_limited())
6231 {
6232 skip("process is limited\n");
6233 return;
6234 }
6235
6236 create_test_files();
6237 create_file("msitest\\class.txt", 1000);
6238 create_database(msifile, rci_tables, sizeof(rci_tables) / sizeof(msi_table));
6239
6240 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6241
6242 r = MsiInstallProductA(msifile, NULL);
6243 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6244 {
6245 skip("Not enough rights to perform tests\n");
6246 goto error;
6247 }
6248 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6249
6250 if (is_64bit)
6251 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6252 else
6253 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6254 ok(res == ERROR_SUCCESS, "key not created\n");
6255 RegCloseKey(hkey);
6256
6257 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6258 ok(res == ERROR_SUCCESS, "key not created\n");
6259 RegCloseKey(hkey);
6260
6261 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6262 ok(res == ERROR_SUCCESS, "key not created\n");
6263 RegCloseKey(hkey);
6264
6265 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6266 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6267
6268 if (is_64bit)
6269 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6270 else
6271 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6272 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6273
6274 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6275 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6276
6277 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6278 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6279
6280 ok(!delete_pf("msitest\\class.txt", TRUE), "file not removed\n");
6281 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6282
6283 error:
6284 DeleteFileA("msitest\\class.txt");
6285 delete_test_files();
6286 DeleteFileA(msifile);
6287 }
6288
6289 static void test_register_extension_info(void)
6290 {
6291 UINT r;
6292 LONG res;
6293 HKEY hkey;
6294
6295 if (is_process_limited())
6296 {
6297 skip("process is limited\n");
6298 return;
6299 }
6300
6301 create_test_files();
6302 create_file("msitest\\extension.txt", 1000);
6303 create_database(msifile, rei_tables, sizeof(rei_tables) / sizeof(msi_table));
6304
6305 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6306
6307 r = MsiInstallProductA(msifile, NULL);
6308 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6309 {
6310 skip("Not enough rights to perform tests\n");
6311 goto error;
6312 }
6313 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6314
6315 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6316 ok(res == ERROR_SUCCESS, "key not created\n");
6317 RegCloseKey(hkey);
6318
6319 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &hkey);
6320 ok(res == ERROR_SUCCESS, "key not created\n");
6321 RegCloseKey(hkey);
6322
6323 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6325
6326 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6327 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6328
6329 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1", &hkey);
6330 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6331
6332 ok(!delete_pf("msitest\\extension.txt", TRUE), "file not removed\n");
6333 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6334
6335 error:
6336 DeleteFileA("msitest\\extension.txt");
6337 delete_test_files();
6338 DeleteFileA(msifile);
6339 }
6340
6341 static void test_register_progid_info(void)
6342 {
6343 UINT r;
6344 LONG res;
6345 HKEY hkey;
6346
6347 if (is_process_limited())
6348 {
6349 skip("process is limited\n");
6350 return;
6351 }
6352
6353 create_test_files();
6354 create_file("msitest\\progid.txt", 1000);
6355 create_database(msifile, rpi_tables, sizeof(rpi_tables) / sizeof(msi_table));
6356
6357 res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", 0, NULL, 0,
6358 KEY_ALL_ACCESS, NULL, &hkey, NULL);
6359 ok(res == ERROR_SUCCESS, "key not created\n");
6360 RegCloseKey(hkey);
6361
6362 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6363
6364 r = MsiInstallProductA(msifile, NULL);
6365 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6366 {
6367 skip("Not enough rights to perform tests\n");
6368 goto error;
6369 }
6370 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6371
6372 if (is_64bit)
6373 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6374 else
6375 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6376 ok(res == ERROR_SUCCESS, "key not created\n");
6377 RegCloseKey(hkey);
6378
6379 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey);
6380 ok(res == ERROR_SUCCESS, "key not created\n");
6381 RegCloseKey(hkey);
6382
6383 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey);
6384 ok(res == ERROR_SUCCESS, "key not created\n");
6385 RegCloseKey(hkey);
6386
6387 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey);
6388 ok(res == ERROR_SUCCESS, "key not created\n");
6389 RegCloseKey(hkey);
6390
6391 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey);
6392 ok(res == ERROR_SUCCESS, "key not created\n");
6393 RegCloseKey(hkey);
6394
6395 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey);
6396 ok(res == ERROR_SUCCESS, "key not created\n");
6397 RegCloseKey(hkey);
6398
6399 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey);
6400 ok(res == ERROR_FILE_NOT_FOUND, "key created\n");
6401 if (res == ERROR_SUCCESS) RegCloseKey(hkey);
6402
6403 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey);
6404 ok(res == ERROR_FILE_NOT_FOUND, "key created\n");
6405
6406 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey);
6407 ok(res == ERROR_SUCCESS, "key deleted\n");
6408 if (res == ERROR_SUCCESS) RegCloseKey(hkey);
6409
6410 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey);
6411 ok(res == ERROR_FILE_NOT_FOUND, "key created\n");
6412
6413 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey);
6414 ok(res == ERROR_SUCCESS, "key not created\n");
6415 RegCloseKey(hkey);
6416
6417 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6419
6420 if (is_64bit)
6421 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6422 else
6423 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6424 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6425
6426 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey);
6427 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6428
6429 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey);
6430 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6431
6432 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey);
6433 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6434
6435 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey);
6436 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6437
6438 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey);
6439 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6440
6441 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey);
6442 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6443
6444 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey);
6445 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6446
6447 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey);
6448 ok(res == ERROR_SUCCESS, "key deleted\n");
6449 if (res == ERROR_SUCCESS) RegCloseKey(hkey);
6450
6451 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey);
6452 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6453
6454 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey);
6455 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6456
6457 ok(!delete_pf("msitest\\progid.txt", TRUE), "file not removed\n");
6458 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6459
6460 error:
6461 DeleteFileA("msitest\\progid.txt");
6462 delete_test_files();
6463 DeleteFileA(msifile);
6464 RegDeleteKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned");
6465 }
6466
6467 static void test_register_mime_info(void)
6468 {
6469 UINT r;
6470 LONG res;
6471 HKEY hkey;
6472
6473 if (is_process_limited())
6474 {
6475 skip("process is limited\n");
6476 return;
6477 }
6478
6479 create_test_files();
6480 create_file("msitest\\mime.txt", 1000);
6481 create_database(msifile, rmi_tables, sizeof(rmi_tables) / sizeof(msi_table));
6482
6483 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6484
6485 r = MsiInstallProductA(msifile, NULL);
6486 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6487 {
6488 skip("Not enough rights to perform tests\n");
6489 goto error;
6490 }
6491 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6492
6493 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6494 ok(res == ERROR_SUCCESS, "key not created\n");
6495 RegCloseKey(hkey);
6496
6497 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6498 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6499
6500 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6501 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6502
6503 ok(!delete_pf("msitest\\mime.txt", TRUE), "file not removed\n");
6504 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6505
6506 error:
6507 DeleteFileA("msitest\\mime.txt");
6508 delete_test_files();
6509 DeleteFileA(msifile);
6510 }
6511
6512 static void test_publish_assemblies(void)
6513 {
6514 static const char manifest[] =
6515 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Assembly\" "
6516 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6517 "processorArchitecture=\"x86\"/>";
6518 static const char manifest_local[] =
6519 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Local.Assembly\" "
6520 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6521 "processorArchitecture=\"x86\"/>";
6522 static const char classes_path_dotnet[] =
6523 "Installer\\Assemblies\\Global";
6524 static const char classes_path_dotnet_local[] =
6525 "Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6526 static const char classes_path_dotnet_local_wow64[] =
6527 "Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6528 static const char classes_path_win32[] =
6529 "Installer\\Win32Assemblies\\Global";
6530 static const char classes_path_win32_local[] =
6531 "Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6532 static const char classes_path_win32_local_wow64[] =
6533 "Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6534 static const char path_dotnet[] =
6535 "Software\\Microsoft\\Installer\\Assemblies\\Global";
6536 static const char path_dotnet_local[] =
6537 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6538 static const char path_dotnet_local_wow64[] =
6539 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6540 static const char path_win32[] =
6541 "Software\\Microsoft\\Installer\\Win32Assemblies\\Global";
6542 static const char path_win32_local[] =
6543 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6544 static const char path_win32_local_wow64[] =
6545 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6546 static const char name_dotnet[] =
6547 "Wine.Dotnet.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6548 "version=\"1.0.0.0\",culture=\"neutral\"";
6549 static const char name_dotnet_local[] =
6550 "Wine.Dotnet.Local.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6551 "version=\"1.0.0.0\",culture=\"neutral\"";
6552 static const char name_win32[] =
6553 "Wine.Win32.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6554 "type=\"win32\",version=\"1.0.0.0\"";
6555 static const char name_win32_local[] =
6556 "Wine.Win32.Local.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6557 "type=\"win32\",version=\"1.0.0.0\"";
6558 UINT r;
6559 LONG res;
6560 HKEY hkey;
6561 const char *path;
6562 int access;
6563
6564 if (is_process_limited())
6565 {
6566 skip("process is limited\n");
6567 return;
6568 }
6569
6570 create_test_files();
6571 create_file("msitest\\win32.txt", 1000);
6572 create_file("msitest\\win32_local.txt", 1000);
6573 create_file("msitest\\dotnet.txt", 1000);
6574 create_file("msitest\\dotnet_local.txt", 1000);
6575 create_file_data("msitest\\manifest.txt", manifest, 0);
6576 create_file_data("msitest\\manifest_local.txt", manifest_local, 0);
6577 create_file("msitest\\application_win32.txt", 1000);
6578 create_file("msitest\\application_dotnet.txt", 1000);
6579 create_database(msifile, pa_tables, sizeof(pa_tables) / sizeof(msi_table));
6580
6581 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6582
6583 r = MsiInstallProductA(msifile, NULL);
6584 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6585 {
6586 skip("Not enough rights to perform tests\n");
6587 goto done;
6588 }
6589 if (r == ERROR_INSTALL_FAILURE)
6590 {
6591 skip("No support for installing side-by-side assemblies\n");
6592 goto done;
6593 }
6594 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6595
6596 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6597 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6598 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6599 RegCloseKey(hkey);
6600
6601 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6602 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6603 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6604 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6605 RegCloseKey(hkey);
6606
6607 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6608 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6609 "Expected ERROR_SUCCESS, got %d\n", res);
6610 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6611 RegCloseKey(hkey);
6612
6613 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6614 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6615 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6616 "Expected ERROR_SUCCESS, got %d\n", res);
6617 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6618 RegCloseKey(hkey);
6619
6620 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6621 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6622
6623 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6624 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6625 if (res == ERROR_SUCCESS)
6626 {
6627 res = RegDeleteValueA(hkey, name_dotnet);
6628 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6629 RegCloseKey(hkey);
6630 }
6631
6632 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6633 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6634 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6635
6636 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6637 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6638 if (res == ERROR_SUCCESS)
6639 {
6640 res = RegDeleteValueA(hkey, name_win32);
6641 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6642 RegCloseKey(hkey);
6643 }
6644
6645 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6646 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6647 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6648
6649 r = MsiInstallProductA(msifile, "ALLUSERS=1");
6650 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6651
6652 access = KEY_QUERY_VALUE;
6653 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6654 if (res == ERROR_FILE_NOT_FOUND && is_wow64) /* Vista WOW64 */
6655 {
6656 trace("Using 64-bit registry view for HKCR\\Installer\n");
6657 access = KEY_QUERY_VALUE | KEY_WOW64_64KEY;
6658 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6659 }
6660 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6661 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6662 RegCloseKey(hkey);
6663
6664 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6665 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6666 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6667 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6668 RegCloseKey(hkey);
6669
6670 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_win32, 0, access, &hkey);
6671 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6672 "Expected ERROR_SUCCESS, got %d\n", res);
6673 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6674 RegCloseKey(hkey);
6675
6676 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6677 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6678 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6679 "Expected ERROR_SUCCESS, got %d\n", res);
6680 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6681 RegCloseKey(hkey);
6682
6683 r = MsiInstallProductA(msifile, "REMOVE=ALL ALLUSERS=1");
6684 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6685
6686 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_dotnet, &hkey);
6687 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6688 if (res == ERROR_SUCCESS)
6689 {
6690 res = RegDeleteValueA(hkey, name_dotnet);
6691 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6692 RegCloseKey(hkey);
6693 }
6694
6695 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6696 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6697 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6698
6699 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_win32, &hkey);
6700 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6701 if (res == ERROR_SUCCESS)
6702 {
6703 res = RegDeleteValueA(hkey, name_win32);
6704 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6705 RegCloseKey(hkey);
6706 }
6707
6708 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6709 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6710 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6711
6712 done:
6713 DeleteFileA("msitest\\win32.txt");
6714 DeleteFileA("msitest\\win32_local.txt");
6715 DeleteFileA("msitest\\dotnet.txt");
6716 DeleteFileA("msitest\\dotnet_local.txt");
6717 DeleteFileA("msitest\\manifest.txt");
6718 DeleteFileA("msitest\\manifest_local.txt");
6719 DeleteFileA("msitest\\application_win32.txt");
6720 DeleteFileA("msitest\\application_dotnet.txt");
6721 delete_test_files();
6722 DeleteFileA(msifile);
6723 }
6724
6725 static void test_remove_existing_products(void)
6726 {
6727 UINT r;
6728
6729 if (is_process_limited())
6730 {
6731 skip("process is limited\n");
6732 return;
6733 }
6734
6735 create_test_files();
6736 create_file("msitest\\rep.txt", 1000);
6737 create_database(msifile, rep_tables, sizeof(rep_tables) / sizeof(msi_table));
6738
6739 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6740
6741 r = MsiInstallProductA(msifile, NULL);
6742 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6743 {
6744 skip("Not enough rights to perform tests\n");
6745 goto error;
6746 }
6747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6748
6749 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6750 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6751
6752 ok(!delete_pf("msitest\\rep.txt", TRUE), "file not removed\n");
6753 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6754
6755 error:
6756 DeleteFileA("msitest\\rep.txt");
6757 delete_test_files();
6758 DeleteFileA(msifile);
6759 }
6760
6761 START_TEST(action)
6762 {
6763 DWORD len;
6764 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6765 STATEMGRSTATUS status;
6766 BOOL ret = FALSE;
6767
6768 init_functionpointers();
6769
6770 if (pIsWow64Process)
6771 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6772
6773 GetCurrentDirectoryA(MAX_PATH, prev_path);
6774 GetTempPathA(MAX_PATH, temp_path);
6775 SetCurrentDirectoryA(temp_path);
6776
6777 lstrcpyA(CURR_DIR, temp_path);
6778 len = lstrlenA(CURR_DIR);
6779
6780 if(len && (CURR_DIR[len - 1] == '\\'))
6781 CURR_DIR[len - 1] = 0;
6782
6783 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6784 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6785
6786 /* Create a restore point ourselves so we circumvent the multitude of restore points
6787 * that would have been created by all the installation and removal tests.
6788 *
6789 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6790 * creation of restore points.
6791 */
6792 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6793 {
6794 memset(&status, 0, sizeof(status));
6795 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6796 }
6797
6798 /* Create only one log file and don't append. We have to pass something
6799 * for the log mode for this to work. The logfile needs to have an absolute
6800 * path otherwise we still end up with some extra logfiles as some tests
6801 * change the current directory.
6802 */
6803 lstrcpyA(log_file, temp_path);
6804 lstrcatA(log_file, "\\msitest.log");
6805 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6806
6807 test_register_product();
6808 test_publish_product();
6809 test_publish_features();
6810 test_register_user();
6811 test_process_components();
6812 test_publish();
6813 test_publish_sourcelist();
6814 test_remove_files();
6815 test_move_files();
6816 test_duplicate_files();
6817 test_write_registry_values();
6818 test_envvar();
6819 test_create_remove_folder();
6820 test_start_services();
6821 test_delete_services();
6822 test_install_services();
6823 test_self_registration();
6824 test_register_font();
6825 test_validate_product_id();
6826 test_install_remove_odbc();
6827 test_register_typelib();
6828 test_create_remove_shortcut();
6829 test_publish_components();
6830 test_remove_duplicate_files();
6831 test_remove_registry_values();
6832 test_find_related_products();
6833 test_remove_ini_values();
6834 test_remove_env_strings();
6835 test_register_class_info();
6836 test_register_extension_info();
6837 test_register_progid_info();
6838 test_register_mime_info();
6839 test_publish_assemblies();
6840 test_remove_existing_products();
6841
6842 DeleteFileA(log_file);
6843
6844 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6845 {
6846 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6847 if (ret)
6848 remove_restore_point(status.llSequenceNumber);
6849 }
6850 FreeLibrary(hsrclient);
6851
6852 SetCurrentDirectoryA(prev_path);
6853 }