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