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