msi/tests: Prepare action.c for the switch to -D__WINESRC__.
[wine.git] / dlls / msi / tests / action.c
blobd5ebab13e8069949cfa32c070485b6688d2d31e5
1 /*
2 * Copyright (C) 2006 James Hawkins
3 * Copyright 2010 Hans Leidekker for CodeWeavers
5 * Tests concentrating on standard actions
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define _WIN32_MSI 300
23 #include <stdio.h>
25 #include <windows.h>
26 #include <msiquery.h>
27 #include <msidefs.h>
28 #include <msi.h>
29 #include <fci.h>
30 #include <srrestoreptapi.h>
31 #include <wtypes.h>
32 #include <shellapi.h>
33 #include <winsvc.h>
35 #include "wine/test.h"
37 static UINT (WINAPI *pMsiQueryComponentStateA)
38 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
39 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
40 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
41 static UINT (WINAPI *pMsiSourceListGetInfoA)
42 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
43 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
44 (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
45 static UINT (WINAPI *pMsiQueryFeatureStateExA)
46 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
48 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *);
49 static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE);
50 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
51 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
53 static HMODULE hsrclient;
54 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
55 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA *, STATEMGRSTATUS *);
57 static BOOL is_wow64;
58 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
60 static const char *msifile = "msitest.msi";
61 static CHAR CURR_DIR[MAX_PATH];
62 static CHAR PROG_FILES_DIR[MAX_PATH];
63 static CHAR COMMON_FILES_DIR[MAX_PATH];
64 static CHAR APP_DATA_DIR[MAX_PATH];
65 static CHAR WINDOWS_DIR[MAX_PATH];
67 /* msi database data */
69 static const char component_dat[] =
70 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
71 "s72\tS38\ts72\ti2\tS255\tS72\n"
72 "Component\tComponent\n"
73 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
74 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
75 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
76 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
77 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
78 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
79 "component\t\tMSITESTDIR\t0\t1\tfile\n"
80 "service_comp\t{935A0A91-22A3-4F87-BCA8-928FFDFE2353}\tMSITESTDIR\t0\t\tservice_file\n"
81 "service_comp2\t{3F7B04A4-9521-4649-BDC9-0C8722740A49}\tMSITESTDIR\t0\t\tservice_file2";
83 static const char directory_dat[] =
84 "Directory\tDirectory_Parent\tDefaultDir\n"
85 "s72\tS72\tl255\n"
86 "Directory\tDirectory\n"
87 "CABOUTDIR\tMSITESTDIR\tcabout\n"
88 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
89 "FIRSTDIR\tMSITESTDIR\tfirst\n"
90 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
91 "NEWDIR\tCABOUTDIR\tnew\n"
92 "ProgramFilesFolder\tTARGETDIR\t.\n"
93 "TARGETDIR\t\tSourceDir";
95 static const char feature_dat[] =
96 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
97 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
98 "Feature\tFeature\n"
99 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
100 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
101 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
102 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
103 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
104 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
105 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
107 static const char feature_comp_dat[] =
108 "Feature_\tComponent_\n"
109 "s38\ts72\n"
110 "FeatureComponents\tFeature_\tComponent_\n"
111 "Five\tFive\n"
112 "Four\tFour\n"
113 "One\tOne\n"
114 "Three\tThree\n"
115 "Two\tTwo\n"
116 "feature\tcomponent\n"
117 "service_feature\tservice_comp\n"
118 "service_feature\tservice_comp2";
120 static const char file_dat[] =
121 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
122 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
123 "File\tFile\n"
124 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
125 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
126 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
127 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
128 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
129 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
130 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t6\n"
131 "service_file2\tservice_comp2\tservice2.exe\t100\t\t\t8192\t7";
133 static const char install_exec_seq_dat[] =
134 "Action\tCondition\tSequence\n"
135 "s72\tS255\tI2\n"
136 "InstallExecuteSequence\tAction\n"
137 "AllocateRegistrySpace\tNOT Installed\t1550\n"
138 "CostFinalize\t\t1000\n"
139 "CostInitialize\t\t800\n"
140 "FileCost\t\t900\n"
141 "ResolveSource\t\t950\n"
142 "MoveFiles\t\t1700\n"
143 "InstallFiles\t\t4000\n"
144 "DuplicateFiles\t\t4500\n"
145 "WriteEnvironmentStrings\t\t4550\n"
146 "CreateShortcuts\t\t4600\n"
147 "InstallServices\t\t5000\n"
148 "InstallFinalize\t\t6600\n"
149 "InstallInitialize\t\t1500\n"
150 "InstallValidate\t\t1400\n"
151 "LaunchConditions\t\t100\n"
152 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
154 static const char media_dat[] =
155 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
156 "i2\ti4\tL64\tS255\tS32\tS72\n"
157 "Media\tDiskId\n"
158 "1\t3\t\t\tDISK1\t\n"
159 "2\t7\t\tmsitest.cab\tDISK2\t\n";
161 static const char property_dat[] =
162 "Property\tValue\n"
163 "s72\tl0\n"
164 "Property\tProperty\n"
165 "DefaultUIFont\tDlgFont8\n"
166 "HASUIRUN\t0\n"
167 "INSTALLLEVEL\t3\n"
168 "InstallMode\tTypical\n"
169 "Manufacturer\tWine\n"
170 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
171 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
172 "ProductID\tnone\n"
173 "ProductLanguage\t1033\n"
174 "ProductName\tMSITEST\n"
175 "ProductVersion\t1.1.1\n"
176 "PROMPTROLLBACKCOST\tP\n"
177 "Setup\tSetup\n"
178 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
179 "AdminProperties\tPOSTADMIN\n"
180 "ROOTDRIVE\tC:\\\n"
181 "SERVNAME\tTestService\n"
182 "SERVNAME2\tTestService2\n"
183 "SERVDISP\tTestServiceDisp\n"
184 "SERVDISP2\tTestServiceDisp2\n"
185 "MSIFASTINSTALL\t1\n";
187 static const char environment_dat[] =
188 "Environment\tName\tValue\tComponent_\n"
189 "s72\tl255\tL255\ts72\n"
190 "Environment\tEnvironment\n"
191 "Var1\t=-MSITESTVAR1\t1\tOne\n"
192 "Var2\tMSITESTVAR2\t1\tOne\n"
193 "Var3\t=-MSITESTVAR3\t1\tOne\n"
194 "Var4\tMSITESTVAR4\t1\tOne\n"
195 "Var5\t-MSITESTVAR5\t\tOne\n"
196 "Var6\tMSITESTVAR6\t\tOne\n"
197 "Var7\t!-MSITESTVAR7\t\tOne\n"
198 "Var8\t!-*MSITESTVAR8\t\tOne\n"
199 "Var9\t=-MSITESTVAR9\t\tOne\n"
200 "Var10\t=MSITESTVAR10\t\tOne\n"
201 "Var11\t+-MSITESTVAR11\t[~];1\tOne\n"
202 "Var12\t+-MSITESTVAR11\t[~];2\tOne\n"
203 "Var13\t+-MSITESTVAR12\t[~];1\tOne\n"
204 "Var14\t=MSITESTVAR13\t[~];1\tOne\n"
205 "Var15\t=MSITESTVAR13\t[~];2\tOne\n"
206 "Var16\t=MSITESTVAR14\t;1;\tOne\n"
207 "Var17\t=MSITESTVAR15\t;;1;;\tOne\n"
208 "Var18\t=MSITESTVAR16\t 1 \tOne\n"
209 "Var19\t+-MSITESTVAR17\t1\tOne\n"
210 "Var20\t+-MSITESTVAR17\t;;2;;[~]\tOne\n"
211 "Var21\t+-MSITESTVAR18\t1\tOne\n"
212 "Var22\t+-MSITESTVAR18\t[~];;2;;\tOne\n"
213 "Var23\t+-MSITESTVAR19\t1\tOne\n"
214 "Var24\t+-MSITESTVAR19\t[~]2\tOne\n"
215 "Var25\t+-MSITESTVAR20\t1\tOne\n"
216 "Var26\t+-MSITESTVAR20\t2[~]\tOne\n";
218 static const char service_install_dat[] =
219 "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
220 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
221 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
222 "ServiceInstall\tServiceInstall\n"
223 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService\t\t-a arg\tservice_comp\tdescription\n"
224 "TestService2\tSERVNAME2]\t[SERVDISP2]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService2\t\t-a arg\tservice_comp2\tdescription";
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";
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\t0\tservice_comp";
239 static const char sss_install_exec_seq_dat[] =
240 "Action\tCondition\tSequence\n"
241 "s72\tS255\tI2\n"
242 "InstallExecuteSequence\tAction\n"
243 "LaunchConditions\t\t100\n"
244 "CostInitialize\t\t800\n"
245 "FileCost\t\t900\n"
246 "ResolveSource\t\t950\n"
247 "CostFinalize\t\t1000\n"
248 "InstallValidate\t\t1400\n"
249 "InstallInitialize\t\t1500\n"
250 "DeleteServices\t\t5000\n"
251 "MoveFiles\t\t5100\n"
252 "InstallFiles\t\t5200\n"
253 "DuplicateFiles\t\t5300\n"
254 "StartServices\t\t5400\n"
255 "InstallFinalize\t\t6000\n";
257 static const char sds_install_exec_seq_dat[] =
258 "Action\tCondition\tSequence\n"
259 "s72\tS255\tI2\n"
260 "InstallExecuteSequence\tAction\n"
261 "LaunchConditions\t\t100\n"
262 "CostInitialize\t\t800\n"
263 "FileCost\t\t900\n"
264 "ResolveSource\t\t950\n"
265 "CostFinalize\t\t1000\n"
266 "InstallValidate\t\t1400\n"
267 "InstallInitialize\t\t1500\n"
268 "StopServices\t\t5000\n"
269 "DeleteServices\t\t5050\n"
270 "MoveFiles\t\t5100\n"
271 "InstallFiles\t\t5200\n"
272 "DuplicateFiles\t\t5300\n"
273 "InstallServices\t\t5400\n"
274 "StartServices\t\t5450\n"
275 "RegisterProduct\t\t5500\n"
276 "PublishFeatures\t\t5600\n"
277 "PublishProduct\t\t5700\n"
278 "InstallFinalize\t\t6000\n";
280 static const char rof_component_dat[] =
281 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
282 "s72\tS38\ts72\ti2\tS255\tS72\n"
283 "Component\tComponent\n"
284 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
286 static const char rof_feature_dat[] =
287 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
288 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
289 "Feature\tFeature\n"
290 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
291 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
293 static const char rof_feature_comp_dat[] =
294 "Feature_\tComponent_\n"
295 "s38\ts72\n"
296 "FeatureComponents\tFeature_\tComponent_\n"
297 "feature\tmaximus\n"
298 "montecristo\tmaximus";
300 static const char rof_file_dat[] =
301 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
302 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
303 "File\tFile\n"
304 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
306 static const char rof_media_dat[] =
307 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
308 "i2\ti4\tL64\tS255\tS32\tS72\n"
309 "Media\tDiskId\n"
310 "1\t1\t\t\tDISK1\t\n";
312 static const char ci2_feature_comp_dat[] =
313 "Feature_\tComponent_\n"
314 "s38\ts72\n"
315 "FeatureComponents\tFeature_\tComponent_\n"
316 "feature\taugustus";
318 static const char ci2_file_dat[] =
319 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
320 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
321 "File\tFile\n"
322 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
324 static const char pp_install_exec_seq_dat[] =
325 "Action\tCondition\tSequence\n"
326 "s72\tS255\tI2\n"
327 "InstallExecuteSequence\tAction\n"
328 "ValidateProductID\t\t700\n"
329 "CostInitialize\t\t800\n"
330 "FileCost\t\t900\n"
331 "CostFinalize\t\t1000\n"
332 "InstallValidate\t\t1400\n"
333 "InstallInitialize\t\t1500\n"
334 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
335 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
336 "RemoveFiles\t\t3500\n"
337 "InstallFiles\t\t4000\n"
338 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
339 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
340 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
341 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
342 "InstallFinalize\t\t6600";
344 static const char pp_component_dat[] =
345 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
346 "s72\tS38\ts72\ti2\tS255\tS72\n"
347 "Component\tComponent\n"
348 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n";
350 static const char ppc_component_dat[] =
351 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
352 "s72\tS38\ts72\ti2\tS255\tS72\n"
353 "Component\tComponent\n"
354 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n"
355 "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n";
357 static const char ppc_file_dat[] =
358 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
359 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
360 "File\tFile\n"
361 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1\n"
362 "augustus\taugustus\taugustus\t500\t\t\t8192\t2";
364 static const char ppc_media_dat[] =
365 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
366 "i2\ti4\tL64\tS255\tS32\tS72\n"
367 "Media\tDiskId\n"
368 "1\t2\t\t\tDISK1\t\n";
370 static const char ppc_feature_comp_dat[] =
371 "Feature_\tComponent_\n"
372 "s38\ts72\n"
373 "FeatureComponents\tFeature_\tComponent_\n"
374 "feature\tmaximus\n"
375 "feature\taugustus\n"
376 "montecristo\tmaximus";
378 static const char cwd_component_dat[] =
379 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
380 "s72\tS38\ts72\ti2\tS255\tS72\n"
381 "Component\tComponent\n"
382 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
384 static const char rem_component_dat[] =
385 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
386 "s72\tS38\ts72\ti2\tS255\tS72\n"
387 "Component\tComponent\n"
388 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
389 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
390 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
392 static const char rem_feature_comp_dat[] =
393 "Feature_\tComponent_\n"
394 "s38\ts72\n"
395 "FeatureComponents\tFeature_\tComponent_\n"
396 "feature\thydrogen\n"
397 "feature\thelium\n"
398 "feature\tlithium";
400 static const char rem_file_dat[] =
401 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
402 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
403 "File\tFile\n"
404 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
405 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
406 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
408 static const char rem_install_exec_seq_dat[] =
409 "Action\tCondition\tSequence\n"
410 "s72\tS255\tI2\n"
411 "InstallExecuteSequence\tAction\n"
412 "ValidateProductID\t\t700\n"
413 "CostInitialize\t\t800\n"
414 "FileCost\t\t900\n"
415 "CostFinalize\t\t1000\n"
416 "InstallValidate\t\t1400\n"
417 "InstallInitialize\t\t1500\n"
418 "ProcessComponents\t\t1600\n"
419 "UnpublishFeatures\t\t1800\n"
420 "RemoveFiles\t\t3500\n"
421 "InstallFiles\t\t4000\n"
422 "RegisterProduct\t\t6100\n"
423 "PublishFeatures\t\t6300\n"
424 "PublishProduct\t\t6400\n"
425 "InstallFinalize\t\t6600";
427 static const char rem_remove_files_dat[] =
428 "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
429 "s72\ts72\tS255\ts72\tI2\n"
430 "RemoveFile\tFileKey\n"
431 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
432 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
433 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
434 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
435 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
436 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
437 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
438 "block\thelium\tblock\tMSITESTDIR\t3\n"
439 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n"
440 "nanoacre\thydrogen\t\tCABOUTDIR\t3\n";
442 static const char mov_move_file_dat[] =
443 "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
444 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
445 "MoveFile\tFileKey\n"
446 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
447 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
448 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
449 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
450 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
451 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
452 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
453 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
454 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
455 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
456 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
457 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
458 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
459 "pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
460 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
461 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
462 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
463 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
465 static const char df_directory_dat[] =
466 "Directory\tDirectory_Parent\tDefaultDir\n"
467 "s72\tS72\tl255\n"
468 "Directory\tDirectory\n"
469 "THIS\tMSITESTDIR\tthis\n"
470 "DOESNOT\tTHIS\tdoesnot\n"
471 "NONEXISTENT\tDOESNOT\texist\n"
472 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
473 "ProgramFilesFolder\tTARGETDIR\t.\n"
474 "TARGETDIR\t\tSourceDir";
476 static const char df_duplicate_file_dat[] =
477 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
478 "s72\ts72\ts72\tS255\tS72\n"
479 "DuplicateFile\tFileKey\n"
480 "maximus\tmaximus\tmaximus\taugustus\t\n"
481 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n"
482 "augustus\tnosuchcomponent\tmaximus\t\tMSITESTDIR\n";
484 static const char wrv_component_dat[] =
485 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
486 "s72\tS38\ts72\ti2\tS255\tS72\n"
487 "Component\tComponent\n"
488 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
490 static const char wrv_registry_dat[] =
491 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
492 "s72\ti2\tl255\tL255\tL0\ts72\n"
493 "Registry\tRegistry\n"
494 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus\n"
495 "regdata1\t2\tSOFTWARE\\Wine\\msitest\t*\t\taugustus\n"
496 "regdata2\t2\tSOFTWARE\\Wine\\msitest\t*\t#%\taugustus\n"
497 "regdata3\t2\tSOFTWARE\\Wine\\msitest\t*\t#x\taugustus\n"
498 "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"
499 "regdata5\t2\tSOFTWARE\\Wine\\msitest\tValue1\t[~]one[~]\taugustus\n"
500 "regdata6\t2\tSOFTWARE\\Wine\\msitest\tValue2\t[~]two\taugustus\n"
501 "regdata7\t2\tSOFTWARE\\Wine\\msitest\tValue3\tone[~]\taugustus\n"
502 "regdata8\t2\tSOFTWARE\\Wine\\msitest\tValue4\tone[~]two\taugustus\n"
503 "regdata9\t2\tSOFTWARE\\Wine\\msitest\tValue5\t[~]one[~]two[~]three\taugustus\n"
504 "regdata10\t2\tSOFTWARE\\Wine\\msitest\tValue6\t[~]\taugustus\n"
505 "regdata11\t2\tSOFTWARE\\Wine\\msitest\tValue7\t[~]two\taugustus\n";
507 static const char cf_directory_dat[] =
508 "Directory\tDirectory_Parent\tDefaultDir\n"
509 "s72\tS72\tl255\n"
510 "Directory\tDirectory\n"
511 "FIRSTDIR\tMSITESTDIR\tfirst\n"
512 "SECONDDIR\tMSITESTDIR\tsecond\n"
513 "THIRDDIR\tMSITESTDIR\tthird\n"
514 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
515 "ProgramFilesFolder\tTARGETDIR\t.\n"
516 "TARGETDIR\t\tSourceDir";
518 static const char cf_component_dat[] =
519 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
520 "s72\tS38\ts72\ti2\tS255\tS72\n"
521 "Component\tComponent\n"
522 "One\t{F8CD42AC-9C38-48FE-8664-B35FD121012A}\tFIRSTDIR\t0\t\tone.txt\n"
523 "Two\t{DE2DB02E-2DDF-4E34-8CF6-DCA13E29DF52}\tSECONDDIR\t0\t\ttwo.txt\n";
525 static const char cf_feature_dat[] =
526 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
527 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
528 "Feature\tFeature\n"
529 "One\t\tOne\tThe One Feature\t1\t3\tFIRSTDIR\t0\n"
530 "Two\t\tTwo\tThe Two Feature\t1\t3\tSECONDDIR\t0\n";
532 static const char cf_feature_comp_dat[] =
533 "Feature_\tComponent_\n"
534 "s38\ts72\n"
535 "FeatureComponents\tFeature_\tComponent_\n"
536 "One\tOne\n"
537 "Two\tTwo\n";
539 static const char cf_file_dat[] =
540 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
541 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
542 "File\tFile\n"
543 "one.txt\tOne\tone.txt\t0\t\t\t0\t1\n"
544 "two.txt\tTwo\ttwo.txt\t0\t\t\t0\t2\n";
546 static const char cf_create_folders_dat[] =
547 "Directory_\tComponent_\n"
548 "s72\ts72\n"
549 "CreateFolder\tDirectory_\tComponent_\n"
550 "FIRSTDIR\tOne\n"
551 "SECONDDIR\tTwo\n"
552 "THIRDDIR\tTwo\n";
554 static const char cf_install_exec_seq_dat[] =
555 "Action\tCondition\tSequence\n"
556 "s72\tS255\tI2\n"
557 "InstallExecuteSequence\tAction\n"
558 "CostFinalize\t\t1000\n"
559 "ValidateProductID\t\t700\n"
560 "CostInitialize\t\t800\n"
561 "FileCost\t\t900\n"
562 "RemoveFiles\t\t3500\n"
563 "CreateFolders\t\t3700\n"
564 "RemoveFolders\t\t3800\n"
565 "InstallFiles\t\t4000\n"
566 "RegisterUser\t\t6000\n"
567 "RegisterProduct\t\t6100\n"
568 "PublishFeatures\t\t6300\n"
569 "PublishProduct\t\t6400\n"
570 "InstallFinalize\t\t6600\n"
571 "InstallInitialize\t\t1500\n"
572 "ProcessComponents\t\t1600\n"
573 "UnpublishFeatures\t\t1800\n"
574 "InstallValidate\t\t1400\n"
575 "LaunchConditions\t\t100\n";
577 static const char sr_selfreg_dat[] =
578 "File_\tCost\n"
579 "s72\tI2\n"
580 "SelfReg\tFile_\n"
581 "one.txt\t1\n";
583 static const char sr_install_exec_seq_dat[] =
584 "Action\tCondition\tSequence\n"
585 "s72\tS255\tI2\n"
586 "InstallExecuteSequence\tAction\n"
587 "CostFinalize\t\t1000\n"
588 "CostInitialize\t\t800\n"
589 "FileCost\t\t900\n"
590 "ResolveSource\t\t950\n"
591 "MoveFiles\t\t1700\n"
592 "SelfUnregModules\t\t3900\n"
593 "InstallFiles\t\t4000\n"
594 "DuplicateFiles\t\t4500\n"
595 "WriteEnvironmentStrings\t\t4550\n"
596 "CreateShortcuts\t\t4600\n"
597 "InstallFinalize\t\t6600\n"
598 "InstallInitialize\t\t1500\n"
599 "InstallValidate\t\t1400\n"
600 "LaunchConditions\t\t100\n";
602 static const char font_media_dat[] =
603 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
604 "i2\ti4\tL64\tS255\tS32\tS72\n"
605 "Media\tDiskId\n"
606 "1\t3\t\t\tDISK1\t\n";
608 static const char font_file_dat[] =
609 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
610 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
611 "File\tFile\n"
612 "font.ttf\tfonts\tfont.ttf\t1000\t\t\t8192\t1\n";
614 static const char font_feature_dat[] =
615 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
616 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
617 "Feature\tFeature\n"
618 "fonts\t\t\tfont feature\t1\t2\tMSITESTDIR\t0\n";
620 static const char font_component_dat[] =
621 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
622 "s72\tS38\ts72\ti2\tS255\tS72\n"
623 "Component\tComponent\n"
624 "fonts\t{F5920ED0-1183-4B8F-9330-86CE56557C05}\tMSITESTDIR\t0\t\tfont.ttf\n";
626 static const char font_feature_comp_dat[] =
627 "Feature_\tComponent_\n"
628 "s38\ts72\n"
629 "FeatureComponents\tFeature_\tComponent_\n"
630 "fonts\tfonts\n";
632 static const char font_dat[] =
633 "File_\tFontTitle\n"
634 "s72\tS128\n"
635 "Font\tFile_\n"
636 "font.ttf\tmsi test font\n";
638 static const char font_install_exec_seq_dat[] =
639 "Action\tCondition\tSequence\n"
640 "s72\tS255\tI2\n"
641 "InstallExecuteSequence\tAction\n"
642 "ValidateProductID\t\t700\n"
643 "CostInitialize\t\t800\n"
644 "FileCost\t\t900\n"
645 "CostFinalize\t\t1000\n"
646 "InstallValidate\t\t1400\n"
647 "InstallInitialize\t\t1500\n"
648 "ProcessComponents\t\t1600\n"
649 "UnpublishFeatures\t\t1800\n"
650 "RemoveFiles\t\t3500\n"
651 "InstallFiles\t\t4000\n"
652 "RegisterFonts\t\t4100\n"
653 "UnregisterFonts\t\t4200\n"
654 "RegisterUser\t\t6000\n"
655 "RegisterProduct\t\t6100\n"
656 "PublishFeatures\t\t6300\n"
657 "PublishProduct\t\t6400\n"
658 "InstallFinalize\t\t6600";
660 static const char vp_property_dat[] =
661 "Property\tValue\n"
662 "s72\tl0\n"
663 "Property\tProperty\n"
664 "HASUIRUN\t0\n"
665 "INSTALLLEVEL\t3\n"
666 "InstallMode\tTypical\n"
667 "Manufacturer\tWine\n"
668 "PIDTemplate\t###-#######\n"
669 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
670 "ProductLanguage\t1033\n"
671 "ProductName\tMSITEST\n"
672 "ProductVersion\t1.1.1\n"
673 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
674 "MSIFASTINSTALL\t1\n";
676 static const char vp_custom_action_dat[] =
677 "Action\tType\tSource\tTarget\tISComments\n"
678 "s72\ti2\tS64\tS0\tS255\n"
679 "CustomAction\tAction\n"
680 "SetProductID1\t51\tProductID\t1\t\n"
681 "SetProductID2\t51\tProductID\t2\t\n"
682 "TestProductID1\t19\t\t\tHalts installation\n"
683 "TestProductID2\t19\t\t\tHalts installation\n";
685 static const char vp_install_exec_seq_dat[] =
686 "Action\tCondition\tSequence\n"
687 "s72\tS255\tI2\n"
688 "InstallExecuteSequence\tAction\n"
689 "LaunchConditions\t\t100\n"
690 "CostInitialize\t\t800\n"
691 "FileCost\t\t900\n"
692 "CostFinalize\t\t1000\n"
693 "InstallValidate\t\t1400\n"
694 "InstallInitialize\t\t1500\n"
695 "SetProductID1\tSET_PRODUCT_ID=1\t3000\n"
696 "SetProductID2\tSET_PRODUCT_ID=2\t3100\n"
697 "ValidateProductID\t\t3200\n"
698 "InstallExecute\t\t3300\n"
699 "TestProductID1\tProductID=1\t3400\n"
700 "TestProductID2\tProductID=\"123-1234567\"\t3500\n"
701 "InstallFiles\t\t4000\n"
702 "InstallFinalize\t\t6000\n";
704 static const char odbc_file_dat[] =
705 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
706 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
707 "File\tFile\n"
708 "ODBCdriver.dll\todbc\tODBCdriver.dll\t1000\t\t\t8192\t1\n"
709 "ODBCdriver2.dll\todbc\tODBCdriver2.dll\t1000\t\t\t8192\t2\n"
710 "ODBCtranslator.dll\todbc\tODBCtranslator.dll\t1000\t\t\t8192\t3\n"
711 "ODBCtranslator2.dll\todbc\tODBCtranslator2.dll\t1000\t\t\t8192\t4\n"
712 "ODBCsetup.dll\todbc\tODBCsetup.dll\t1000\t\t\t8192\t5\n";
714 static const char odbc_feature_dat[] =
715 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
716 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
717 "Feature\tFeature\n"
718 "odbc\t\t\todbc feature\t1\t2\tMSITESTDIR\t0\n";
720 static const char odbc_feature_comp_dat[] =
721 "Feature_\tComponent_\n"
722 "s38\ts72\n"
723 "FeatureComponents\tFeature_\tComponent_\n"
724 "odbc\todbc\n";
726 static const char odbc_component_dat[] =
727 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
728 "s72\tS38\ts72\ti2\tS255\tS72\n"
729 "Component\tComponent\n"
730 "odbc\t{B6F3E4AE-35D1-4B72-9044-989F03E20A43}\tMSITESTDIR\t0\t\tODBCdriver.dll\n";
732 static const char odbc_driver_dat[] =
733 "Driver\tComponent_\tDescription\tFile_\tFile_Setup\n"
734 "s72\ts72\ts255\ts72\tS72\n"
735 "ODBCDriver\tDriver\n"
736 "ODBC test driver\todbc\tODBC test driver\tODBCdriver.dll\t\n"
737 "ODBC test driver2\todbc\tODBC test driver2\tODBCdriver2.dll\tODBCsetup.dll\n";
739 static const char odbc_translator_dat[] =
740 "Translator\tComponent_\tDescription\tFile_\tFile_Setup\n"
741 "s72\ts72\ts255\ts72\tS72\n"
742 "ODBCTranslator\tTranslator\n"
743 "ODBC test translator\todbc\tODBC test translator\tODBCtranslator.dll\t\n"
744 "ODBC test translator2\todbc\tODBC test translator2\tODBCtranslator2.dll\tODBCsetup.dll\n";
746 static const char odbc_datasource_dat[] =
747 "DataSource\tComponent_\tDescription\tDriverDescription\tRegistration\n"
748 "s72\ts72\ts255\ts255\ti2\n"
749 "ODBCDataSource\tDataSource\n"
750 "ODBC data source\todbc\tODBC data source\tODBC driver\t0\n";
752 static const char odbc_install_exec_seq_dat[] =
753 "Action\tCondition\tSequence\n"
754 "s72\tS255\tI2\n"
755 "InstallExecuteSequence\tAction\n"
756 "LaunchConditions\t\t100\n"
757 "CostInitialize\t\t800\n"
758 "FileCost\t\t900\n"
759 "CostFinalize\t\t1000\n"
760 "InstallValidate\t\t1400\n"
761 "InstallInitialize\t\t1500\n"
762 "ProcessComponents\t\t1600\n"
763 "InstallODBC\t\t3000\n"
764 "RemoveODBC\t\t3100\n"
765 "RemoveFiles\t\t3900\n"
766 "InstallFiles\t\t4000\n"
767 "RegisterProduct\t\t5000\n"
768 "PublishFeatures\t\t5100\n"
769 "PublishProduct\t\t5200\n"
770 "InstallFinalize\t\t6000\n";
772 static const char odbc_media_dat[] =
773 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
774 "i2\ti4\tL64\tS255\tS32\tS72\n"
775 "Media\tDiskId\n"
776 "1\t5\t\t\tDISK1\t\n";
778 static const char tl_file_dat[] =
779 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
780 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
781 "File\tFile\n"
782 "typelib.dll\ttypelib\ttypelib.dll\t1000\t\t\t8192\t1\n";
784 static const char tl_feature_dat[] =
785 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
786 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
787 "Feature\tFeature\n"
788 "typelib\t\t\ttypelib feature\t1\t2\tMSITESTDIR\t0\n";
790 static const char tl_feature_comp_dat[] =
791 "Feature_\tComponent_\n"
792 "s38\ts72\n"
793 "FeatureComponents\tFeature_\tComponent_\n"
794 "typelib\ttypelib\n";
796 static const char tl_component_dat[] =
797 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
798 "s72\tS38\ts72\ti2\tS255\tS72\n"
799 "Component\tComponent\n"
800 "typelib\t{BB4C26FD-89D8-4E49-AF1C-DB4DCB5BF1B0}\tMSITESTDIR\t0\t\ttypelib.dll\n";
802 static const char tl_typelib_dat[] =
803 "LibID\tLanguage\tComponent_\tVersion\tDescription\tDirectory_\tFeature_\tCost\n"
804 "s38\ti2\ts72\tI4\tL128\tS72\ts38\tI4\n"
805 "TypeLib\tLibID\tLanguage\tComponent_\n"
806 "{EAC5166A-9734-4D91-878F-1DD02304C66C}\t0\ttypelib\t1793\t\tMSITESTDIR\ttypelib\t\n";
808 static const char tl_install_exec_seq_dat[] =
809 "Action\tCondition\tSequence\n"
810 "s72\tS255\tI2\n"
811 "InstallExecuteSequence\tAction\n"
812 "LaunchConditions\t\t100\n"
813 "CostInitialize\t\t800\n"
814 "FileCost\t\t900\n"
815 "CostFinalize\t\t1000\n"
816 "InstallValidate\t\t1400\n"
817 "InstallInitialize\t\t1500\n"
818 "ProcessComponents\t\t1600\n"
819 "RemoveFiles\t\t1700\n"
820 "InstallFiles\t\t2000\n"
821 "RegisterTypeLibraries\tREGISTER_TYPELIB=1\t3000\n"
822 "UnregisterTypeLibraries\t\t3100\n"
823 "RegisterProduct\t\t5100\n"
824 "PublishFeatures\t\t5200\n"
825 "PublishProduct\t\t5300\n"
826 "InstallFinalize\t\t6000\n";
828 static const char crs_file_dat[] =
829 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
830 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
831 "File\tFile\n"
832 "target.txt\tshortcut\ttarget.txt\t1000\t\t\t8192\t1\n";
834 static const char crs_feature_dat[] =
835 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
836 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
837 "Feature\tFeature\n"
838 "shortcut\t\t\tshortcut feature\t1\t2\tMSITESTDIR\t0\n";
840 static const char crs_feature_comp_dat[] =
841 "Feature_\tComponent_\n"
842 "s38\ts72\n"
843 "FeatureComponents\tFeature_\tComponent_\n"
844 "shortcut\tshortcut\n";
846 static const char crs_component_dat[] =
847 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
848 "s72\tS38\ts72\ti2\tS255\tS72\n"
849 "Component\tComponent\n"
850 "shortcut\t{5D20E3C6-7206-498F-AC28-87AF2F9AD4CC}\tMSITESTDIR\t0\t\ttarget.txt\n";
852 static const char crs_shortcut_dat[] =
853 "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
854 "s72\ts72\tl128\ts72\ts72\tL255\tL255\tI2\tS72\tI2\tI2\tS72\n"
855 "Shortcut\tShortcut\n"
856 "shortcut\tMSITESTDIR\tshortcut\tshortcut\t[MSITESTDIR]target.txt\t\t\t\t\t\t\t\n";
858 static const char crs_install_exec_seq_dat[] =
859 "Action\tCondition\tSequence\n"
860 "s72\tS255\tI2\n"
861 "InstallExecuteSequence\tAction\n"
862 "LaunchConditions\t\t100\n"
863 "CostInitialize\t\t800\n"
864 "FileCost\t\t900\n"
865 "CostFinalize\t\t1000\n"
866 "InstallValidate\t\t1400\n"
867 "InstallInitialize\t\t1500\n"
868 "ProcessComponents\t\t1600\n"
869 "RemoveFiles\t\t1700\n"
870 "InstallFiles\t\t2000\n"
871 "RemoveShortcuts\t\t3000\n"
872 "CreateShortcuts\t\t3100\n"
873 "RegisterProduct\t\t5000\n"
874 "PublishFeatures\t\t5100\n"
875 "PublishProduct\t\t5200\n"
876 "InstallFinalize\t\t6000\n";
878 static const char pub_file_dat[] =
879 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
880 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
881 "File\tFile\n"
882 "english.txt\tpublish\tenglish.txt\t1000\t\t\t8192\t1\n";
884 static const char pub_feature_dat[] =
885 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
886 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
887 "Feature\tFeature\n"
888 "publish\t\t\tpublish feature\t1\t2\tMSITESTDIR\t0\n";
890 static const char pub_feature_comp_dat[] =
891 "Feature_\tComponent_\n"
892 "s38\ts72\n"
893 "FeatureComponents\tFeature_\tComponent_\n"
894 "publish\tpublish\n";
896 static const char pub_component_dat[] =
897 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
898 "s72\tS38\ts72\ti2\tS255\tS72\n"
899 "Component\tComponent\n"
900 "publish\t{B4EA0ACF-6238-426E-9C6D-7869F0F9C768}\tMSITESTDIR\t0\t\tenglish.txt\n";
902 static const char pub_publish_component_dat[] =
903 "ComponentId\tQualifier\tComponent_\tAppData\tFeature_\n"
904 "s38\ts255\ts72\tL255\ts38\n"
905 "PublishComponent\tComponentId\tQualifier\tComponent_\n"
906 "{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}\tenglish.txt\tpublish\t\tpublish\n";
908 static const char pub_install_exec_seq_dat[] =
909 "Action\tCondition\tSequence\n"
910 "s72\tS255\tI2\n"
911 "InstallExecuteSequence\tAction\n"
912 "LaunchConditions\t\t100\n"
913 "CostInitialize\t\t800\n"
914 "FileCost\t\t900\n"
915 "CostFinalize\t\t1000\n"
916 "InstallValidate\t\t1400\n"
917 "InstallInitialize\t\t1500\n"
918 "ProcessComponents\t\t1600\n"
919 "RemoveFiles\t\t1700\n"
920 "InstallFiles\t\t2000\n"
921 "PublishComponents\t\t3000\n"
922 "UnpublishComponents\t\t3100\n"
923 "RegisterProduct\t\t5000\n"
924 "PublishFeatures\t\t5100\n"
925 "PublishProduct\t\t5200\n"
926 "InstallFinalize\t\t6000\n";
928 static const char rd_file_dat[] =
929 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
930 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
931 "File\tFile\n"
932 "original.txt\tduplicate\toriginal.txt\t1000\t\t\t8192\t1\n"
933 "original2.txt\tduplicate\toriginal2.txt\t1000\t\t\t8192\t2\n"
934 "original3.txt\tduplicate2\toriginal3.txt\t1000\t\t\t8192\t3\n";
936 static const char rd_feature_dat[] =
937 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
938 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
939 "Feature\tFeature\n"
940 "duplicate\t\t\tduplicate feature\t1\t2\tMSITESTDIR\t0\n";
942 static const char rd_feature_comp_dat[] =
943 "Feature_\tComponent_\n"
944 "s38\ts72\n"
945 "FeatureComponents\tFeature_\tComponent_\n"
946 "duplicate\tduplicate\n";
948 static const char rd_component_dat[] =
949 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
950 "s72\tS38\ts72\ti2\tS255\tS72\n"
951 "Component\tComponent\n"
952 "duplicate\t{EB45D06A-ADFE-44E3-8D41-B7DE150E41AD}\tMSITESTDIR\t0\t\toriginal.txt\n"
953 "duplicate2\t{B8BA60E0-B2E9-488E-9D0E-E60F25F04F97}\tMSITESTDIR\t0\tDUPLICATE2=1\toriginal3.txt\n";
955 static const char rd_duplicate_file_dat[] =
956 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
957 "s72\ts72\ts72\tS255\tS72\n"
958 "DuplicateFile\tFileKey\n"
959 "duplicate\tduplicate\toriginal.txt\tduplicate.txt\t\n"
960 "duplicate2\tduplicate\toriginal2.txt\t\tMSITESTDIR\n"
961 "duplicate3\tduplicate2\toriginal3.txt\tduplicate2.txt\t\n";
963 static const char rd_install_exec_seq_dat[] =
964 "Action\tCondition\tSequence\n"
965 "s72\tS255\tI2\n"
966 "InstallExecuteSequence\tAction\n"
967 "LaunchConditions\t\t100\n"
968 "CostInitialize\t\t800\n"
969 "FileCost\t\t900\n"
970 "CostFinalize\t\t1000\n"
971 "InstallValidate\t\t1400\n"
972 "InstallInitialize\t\t1500\n"
973 "ProcessComponents\t\t1600\n"
974 "RemoveDuplicateFiles\t\t1900\n"
975 "InstallFiles\t\t2000\n"
976 "DuplicateFiles\t\t2100\n"
977 "RegisterProduct\t\t5000\n"
978 "PublishFeatures\t\t5100\n"
979 "PublishProduct\t\t5200\n"
980 "InstallFinalize\t\t6000\n";
982 static const char rrv_file_dat[] =
983 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
984 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
985 "File\tFile\n"
986 "registry.txt\tregistry\tregistry.txt\t1000\t\t\t8192\t1\n";
988 static const char rrv_feature_dat[] =
989 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
990 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
991 "Feature\tFeature\n"
992 "registry\t\t\tregistry feature\t1\t2\tMSITESTDIR\t0\n";
994 static const char rrv_feature_comp_dat[] =
995 "Feature_\tComponent_\n"
996 "s38\ts72\n"
997 "FeatureComponents\tFeature_\tComponent_\n"
998 "registry\tregistry\n";
1000 static const char rrv_component_dat[] =
1001 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1002 "s72\tS38\ts72\ti2\tS255\tS72\n"
1003 "Component\tComponent\n"
1004 "registry\t{DA97585B-962D-45EB-AD32-DA15E60CA9EE}\tMSITESTDIR\t0\t\tregistry.txt\n";
1006 static const char rrv_registry_dat[] =
1007 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1008 "s72\ti2\tl255\tL255\tL0\ts72\n"
1009 "Registry\tRegistry\n"
1010 "reg1\t2\tSOFTWARE\\Wine\\keyA\t\tA\tregistry\n"
1011 "reg2\t2\tSOFTWARE\\Wine\\keyA\tvalueA\tA\tregistry\n"
1012 "reg3\t2\tSOFTWARE\\Wine\\key1\t-\t\tregistry\n";
1014 static const char rrv_remove_registry_dat[] =
1015 "RemoveRegistry\tRoot\tKey\tName\tComponent_\n"
1016 "s72\ti2\tl255\tL255\ts72\n"
1017 "RemoveRegistry\tRemoveRegistry\n"
1018 "reg1\t2\tSOFTWARE\\Wine\\keyB\t\tregistry\n"
1019 "reg2\t2\tSOFTWARE\\Wine\\keyB\tValueB\tregistry\n"
1020 "reg3\t2\tSOFTWARE\\Wine\\key2\t-\tregistry\n";
1022 static const char rrv_install_exec_seq_dat[] =
1023 "Action\tCondition\tSequence\n"
1024 "s72\tS255\tI2\n"
1025 "InstallExecuteSequence\tAction\n"
1026 "LaunchConditions\t\t100\n"
1027 "CostInitialize\t\t800\n"
1028 "FileCost\t\t900\n"
1029 "CostFinalize\t\t1000\n"
1030 "InstallValidate\t\t1400\n"
1031 "InstallInitialize\t\t1500\n"
1032 "ProcessComponents\t\t1600\n"
1033 "RemoveFiles\t\t1700\n"
1034 "InstallFiles\t\t2000\n"
1035 "RemoveRegistryValues\t\t3000\n"
1036 "RegisterProduct\t\t5000\n"
1037 "PublishFeatures\t\t5100\n"
1038 "PublishProduct\t\t5200\n"
1039 "InstallFinalize\t\t6000\n";
1041 static const char frp_file_dat[] =
1042 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1043 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1044 "File\tFile\n"
1045 "product.txt\tproduct\tproduct.txt\t1000\t\t\t8192\t1\n";
1047 static const char frp_feature_dat[] =
1048 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1049 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1050 "Feature\tFeature\n"
1051 "product\t\t\tproduct feature\t1\t2\tMSITESTDIR\t0\n";
1053 static const char frp_feature_comp_dat[] =
1054 "Feature_\tComponent_\n"
1055 "s38\ts72\n"
1056 "FeatureComponents\tFeature_\tComponent_\n"
1057 "product\tproduct\n";
1059 static const char frp_component_dat[] =
1060 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1061 "s72\tS38\ts72\ti2\tS255\tS72\n"
1062 "Component\tComponent\n"
1063 "product\t{44725EE0-EEA8-40BD-8162-A48224A2FEA1}\tMSITESTDIR\t0\t\tproduct.txt\n";
1065 static const char frp_custom_action_dat[] =
1066 "Action\tType\tSource\tTarget\tISComments\n"
1067 "s72\ti2\tS64\tS0\tS255\n"
1068 "CustomAction\tAction\n"
1069 "TestProp\t19\t\t\tPROP set\n";
1071 static const char frp_upgrade_dat[] =
1072 "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"
1073 "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"
1074 "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"
1075 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}\t1.1.1\t2.2.2\t\t768\t\tPROP\n";
1077 static const char frp_install_exec_seq_dat[] =
1078 "Action\tCondition\tSequence\n"
1079 "s72\tS255\tI2\n"
1080 "InstallExecuteSequence\tAction\n"
1081 "FindRelatedProducts\t\t50\n"
1082 "TestProp\tPROP AND NOT REMOVE\t51\n"
1083 "LaunchConditions\t\t100\n"
1084 "CostInitialize\t\t800\n"
1085 "FileCost\t\t900\n"
1086 "CostFinalize\t\t1000\n"
1087 "InstallValidate\t\t1400\n"
1088 "InstallInitialize\t\t1500\n"
1089 "ProcessComponents\t\t1600\n"
1090 "RemoveFiles\t\t1700\n"
1091 "InstallFiles\t\t2000\n"
1092 "RegisterProduct\t\t5000\n"
1093 "PublishFeatures\t\t5100\n"
1094 "PublishProduct\t\t5200\n"
1095 "InstallFinalize\t\t6000\n";
1097 static const char riv_file_dat[] =
1098 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1099 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1100 "File\tFile\n"
1101 "inifile.txt\tinifile\tinifile.txt\t1000\t\t\t8192\t1\n";
1103 static const char riv_feature_dat[] =
1104 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1105 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1106 "Feature\tFeature\n"
1107 "inifile\t\t\tinifile feature\t1\t2\tMSITESTDIR\t0\n";
1109 static const char riv_feature_comp_dat[] =
1110 "Feature_\tComponent_\n"
1111 "s38\ts72\n"
1112 "FeatureComponents\tFeature_\tComponent_\n"
1113 "inifile\tinifile\n";
1115 static const char riv_component_dat[] =
1116 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1117 "s72\tS38\ts72\ti2\tS255\tS72\n"
1118 "Component\tComponent\n"
1119 "inifile\t{A0F15705-4F57-4437-88C4-6C8B37ACC6DE}\tMSITESTDIR\t0\t\tinifile.txt\n";
1121 static const char riv_ini_file_dat[] =
1122 "IniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1123 "s72\tl255\tS72\tl96\tl128\tl255\ti2\ts72\n"
1124 "IniFile\tIniFile\n"
1125 "inifile1\ttest.ini\tMSITESTDIR\tsection1\tkey1\tvalue1\t0\tinifile\n";
1127 static const char riv_remove_ini_file_dat[] =
1128 "RemoveIniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1129 "s72\tl255\tS72\tl96\tl128\tL255\ti2\ts72\n"
1130 "RemoveIniFile\tRemoveIniFile\n"
1131 "inifile1\ttest.ini\tMSITESTDIR\tsectionA\tkeyA\tvalueA\t2\tinifile\n";
1133 static const char riv_install_exec_seq_dat[] =
1134 "Action\tCondition\tSequence\n"
1135 "s72\tS255\tI2\n"
1136 "InstallExecuteSequence\tAction\n"
1137 "LaunchConditions\t\t100\n"
1138 "CostInitialize\t\t800\n"
1139 "FileCost\t\t900\n"
1140 "CostFinalize\t\t1000\n"
1141 "InstallValidate\t\t1400\n"
1142 "InstallInitialize\t\t1500\n"
1143 "ProcessComponents\t\t1600\n"
1144 "RemoveFiles\t\t1700\n"
1145 "InstallFiles\t\t2000\n"
1146 "RemoveIniValues\t\t3000\n"
1147 "RegisterProduct\t\t5000\n"
1148 "PublishFeatures\t\t5100\n"
1149 "PublishProduct\t\t5200\n"
1150 "InstallFinalize\t\t6000\n";
1152 static const char res_file_dat[] =
1153 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1154 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1155 "File\tFile\n"
1156 "envvar.txt\tenvvar\tenvvar.txt\t1000\t\t\t8192\t1\n";
1158 static const char res_feature_dat[] =
1159 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1160 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1161 "Feature\tFeature\n"
1162 "envvar\t\t\tenvvar feature\t1\t2\tMSITESTDIR\t0\n";
1164 static const char res_feature_comp_dat[] =
1165 "Feature_\tComponent_\n"
1166 "s38\ts72\n"
1167 "FeatureComponents\tFeature_\tComponent_\n"
1168 "envvar\tenvvar\n";
1170 static const char res_component_dat[] =
1171 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1172 "s72\tS38\ts72\ti2\tS255\tS72\n"
1173 "Component\tComponent\n"
1174 "envvar\t{45EE9AF4-E5D1-445F-8BB7-B22D4EEBD29E}\tMSITESTDIR\t0\t\tenvvar.txt\n";
1176 static const char res_environment_dat[] =
1177 "Environment\tName\tValue\tComponent_\n"
1178 "s72\tl255\tL255\ts72\n"
1179 "Environment\tEnvironment\n"
1180 "var1\t=-MSITESTVAR1\t1\tenvvar\n"
1181 "var2\t=+-MSITESTVAR2\t1\tenvvar\n"
1182 "var3\t=MSITESTVAR3\t1\tenvvar\n"
1183 "var4\t=-MSITESTVAR4\t\tenvvar\n"
1184 "var5\t=MSITESTVAR5\t\tenvvar\n";
1186 static const char res_install_exec_seq_dat[] =
1187 "Action\tCondition\tSequence\n"
1188 "s72\tS255\tI2\n"
1189 "InstallExecuteSequence\tAction\n"
1190 "LaunchConditions\t\t100\n"
1191 "CostInitialize\t\t800\n"
1192 "FileCost\t\t900\n"
1193 "CostFinalize\t\t1000\n"
1194 "InstallValidate\t\t1400\n"
1195 "InstallInitialize\t\t1500\n"
1196 "ProcessComponents\t\t1600\n"
1197 "RemoveFiles\t\t1700\n"
1198 "InstallFiles\t\t2000\n"
1199 "RemoveEnvironmentStrings\t\t3000\n"
1200 "RegisterProduct\t\t5000\n"
1201 "PublishFeatures\t\t5100\n"
1202 "PublishProduct\t\t5200\n"
1203 "InstallFinalize\t\t6000\n";
1205 static const char rci_file_dat[] =
1206 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1207 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1208 "File\tFile\n"
1209 "class.txt\tclass\tclass.txt\t1000\t\t\t8192\t1\n";
1211 static const char rci_feature_dat[] =
1212 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1213 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1214 "Feature\tFeature\n"
1215 "class\t\t\tclass feature\t1\t2\tMSITESTDIR\t0\n";
1217 static const char rci_feature_comp_dat[] =
1218 "Feature_\tComponent_\n"
1219 "s38\ts72\n"
1220 "FeatureComponents\tFeature_\tComponent_\n"
1221 "class\tclass\n";
1223 static const char rci_component_dat[] =
1224 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1225 "s72\tS38\ts72\ti2\tS255\tS72\n"
1226 "Component\tComponent\n"
1227 "class\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tclass.txt\n";
1229 static const char rci_appid_dat[] =
1230 "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n"
1231 "s38\tS255\tS255\tS255\tS255\tI2\tI2\n"
1232 "AppId\tAppId\n"
1233 "{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n";
1235 static const char rci_class_dat[] =
1236 "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n"
1237 "s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n"
1238 "Class\tCLSID\tContext\tComponent_\n"
1239 "{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tclass\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tclass\t\n";
1241 static const char rci_install_exec_seq_dat[] =
1242 "Action\tCondition\tSequence\n"
1243 "s72\tS255\tI2\n"
1244 "InstallExecuteSequence\tAction\n"
1245 "LaunchConditions\t\t100\n"
1246 "CostInitialize\t\t800\n"
1247 "FileCost\t\t900\n"
1248 "CostFinalize\t\t1000\n"
1249 "InstallValidate\t\t1400\n"
1250 "InstallInitialize\t\t1500\n"
1251 "ProcessComponents\t\t1600\n"
1252 "RemoveFiles\t\t1700\n"
1253 "InstallFiles\t\t2000\n"
1254 "UnregisterClassInfo\t\t3000\n"
1255 "RegisterClassInfo\t\t4000\n"
1256 "RegisterProduct\t\t5000\n"
1257 "PublishFeatures\t\t5100\n"
1258 "PublishProduct\t\t5200\n"
1259 "InstallFinalize\t\t6000\n";
1261 static const char rei_file_dat[] =
1262 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1263 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1264 "File\tFile\n"
1265 "extension.txt\textension\textension.txt\t1000\t\t\t8192\t1\n";
1267 static const char rei_feature_dat[] =
1268 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1269 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1270 "Feature\tFeature\n"
1271 "extension\t\t\textension feature\t1\t2\tMSITESTDIR\t0\n";
1273 static const char rei_feature_comp_dat[] =
1274 "Feature_\tComponent_\n"
1275 "s38\ts72\n"
1276 "FeatureComponents\tFeature_\tComponent_\n"
1277 "extension\textension\n";
1279 static const char rei_component_dat[] =
1280 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1281 "s72\tS38\ts72\ti2\tS255\tS72\n"
1282 "Component\tComponent\n"
1283 "extension\t{9A3060D4-60BA-4A82-AB55-9FB148AD013C}\tMSITESTDIR\t0\t\textension.txt\n";
1285 static const char rei_extension_dat[] =
1286 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1287 "s255\ts72\tS255\tS64\ts38\n"
1288 "Extension\tExtension\tComponent_\n"
1289 "extension\textension\tProg.Id.1\t\textension\n";
1291 static const char rei_verb_dat[] =
1292 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1293 "s255\ts32\tI2\tL255\tL255\n"
1294 "Verb\tExtension_\tVerb\n"
1295 "extension\tOpen\t1\t&Open\t/argument\n";
1297 static const char rei_progid_dat[] =
1298 "ProgId\tProgId_Parent\tClass_\tDescription\tIcon_\tIconIndex\n"
1299 "s255\tS255\tS38\tL255\tS72\tI2\n"
1300 "ProgId\tProgId\n"
1301 "Prog.Id.1\t\t\tdescription\t\t\n";
1303 static const char rei_install_exec_seq_dat[] =
1304 "Action\tCondition\tSequence\n"
1305 "s72\tS255\tI2\n"
1306 "InstallExecuteSequence\tAction\n"
1307 "LaunchConditions\t\t100\n"
1308 "CostInitialize\t\t800\n"
1309 "FileCost\t\t900\n"
1310 "CostFinalize\t\t1000\n"
1311 "InstallValidate\t\t1400\n"
1312 "InstallInitialize\t\t1500\n"
1313 "ProcessComponents\t\t1600\n"
1314 "RemoveFiles\t\t1700\n"
1315 "InstallFiles\t\t2000\n"
1316 "UnregisterExtensionInfo\t\t3000\n"
1317 "RegisterExtensionInfo\t\t4000\n"
1318 "RegisterProduct\t\t5000\n"
1319 "PublishFeatures\t\t5100\n"
1320 "PublishProduct\t\t5200\n"
1321 "InstallFinalize\t\t6000\n";
1323 static const char rmi_file_dat[] =
1324 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1325 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1326 "File\tFile\n"
1327 "mime.txt\tmime\tmime.txt\t1000\t\t\t8192\t1\n";
1329 static const char rmi_feature_dat[] =
1330 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1331 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1332 "Feature\tFeature\n"
1333 "mime\t\t\tmime feature\t1\t2\tMSITESTDIR\t0\n";
1335 static const char rmi_feature_comp_dat[] =
1336 "Feature_\tComponent_\n"
1337 "s38\ts72\n"
1338 "FeatureComponents\tFeature_\tComponent_\n"
1339 "mime\tmime\n";
1341 static const char rmi_component_dat[] =
1342 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1343 "s72\tS38\ts72\ti2\tS255\tS72\n"
1344 "Component\tComponent\n"
1345 "mime\t{A1D630CE-13A7-4882-AFDD-148E2BBAFC6D}\tMSITESTDIR\t0\t\tmime.txt\n";
1347 static const char rmi_extension_dat[] =
1348 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1349 "s255\ts72\tS255\tS64\ts38\n"
1350 "Extension\tExtension\tComponent_\n"
1351 "mime\tmime\t\tmime/type\tmime\n";
1353 static const char rmi_verb_dat[] =
1354 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1355 "s255\ts32\tI2\tL255\tL255\n"
1356 "Verb\tExtension_\tVerb\n"
1357 "mime\tOpen\t1\t&Open\t/argument\n";
1359 static const char rmi_mime_dat[] =
1360 "ContentType\tExtension_\tCLSID\n"
1361 "s64\ts255\tS38\n"
1362 "MIME\tContentType\n"
1363 "mime/type\tmime\t\n";
1365 static const char rmi_install_exec_seq_dat[] =
1366 "Action\tCondition\tSequence\n"
1367 "s72\tS255\tI2\n"
1368 "InstallExecuteSequence\tAction\n"
1369 "LaunchConditions\t\t100\n"
1370 "CostInitialize\t\t800\n"
1371 "FileCost\t\t900\n"
1372 "CostFinalize\t\t1000\n"
1373 "InstallValidate\t\t1400\n"
1374 "InstallInitialize\t\t1500\n"
1375 "ProcessComponents\t\t1600\n"
1376 "RemoveFiles\t\t1700\n"
1377 "InstallFiles\t\t2000\n"
1378 "UnregisterExtensionInfo\t\t3000\n"
1379 "UnregisterMIMEInfo\t\t3500\n"
1380 "RegisterExtensionInfo\t\t4000\n"
1381 "RegisterMIMEInfo\t\t4500\n"
1382 "RegisterProduct\t\t5000\n"
1383 "PublishFeatures\t\t5100\n"
1384 "PublishProduct\t\t5200\n"
1385 "InstallFinalize\t\t6000\n";
1387 static const char pa_file_dat[] =
1388 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1389 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1390 "File\tFile\n"
1391 "win32.txt\twin32\twin32.txt\t1000\t\t\t8192\t1\n"
1392 "manifest.txt\twin32\tmanifest.txt\t1000\t\t\t8192\t1\n"
1393 "win32_local.txt\twin32_local\twin32_local.txt\t1000\t\t\t8192\t1\n"
1394 "manifest_local.txt\twin32_local\tmanifest_local.txt\t1000\t\t\t8192\t1\n"
1395 "dotnet.txt\tdotnet\tdotnet.txt\t1000\t\t\t8192\t1\n"
1396 "dotnet_local.txt\tdotnet_local\tdotnet_local.txt\t1000\t\t\t8192\t1\n"
1397 "application_win32.txt\twin32_local\tapplication_win32.txt\t1000\t\t\t8192\t1\n"
1398 "application_dotnet.txt\tdotnet_local\tapplication_dotnet.txt\t1000\t\t\t8192\t1\n";
1400 static const char pa_feature_dat[] =
1401 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1402 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1403 "Feature\tFeature\n"
1404 "assembly\t\t\tassembly feature\t1\t2\tMSITESTDIR\t0\n";
1406 static const char pa_feature_comp_dat[] =
1407 "Feature_\tComponent_\n"
1408 "s38\ts72\n"
1409 "FeatureComponents\tFeature_\tComponent_\n"
1410 "assembly\twin32\n"
1411 "assembly\twin32_local\n"
1412 "assembly\tdotnet\n"
1413 "assembly\tdotnet_local\n";
1415 static const char pa_component_dat[] =
1416 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1417 "s72\tS38\ts72\ti2\tS255\tS72\n"
1418 "Component\tComponent\n"
1419 "win32\t{F515549E-7E61-425D-AAC1-9BEF2E066D06}\tMSITESTDIR\t0\t\twin32.txt\n"
1420 "win32_local\t{D34D3FBA-6789-4E57-AD1A-1281297DC201}\tMSITESTDIR\t0\t\twin32_local.txt\n"
1421 "dotnet\t{8943164F-2B31-4C09-A894-493A8CBDE0A4}\tMSITESTDIR\t0\t\tdotnet.txt\n"
1422 "dotnet_local\t{4E8567E8-8EAE-4E36-90F1-B99D33C663F8}\tMSITESTDIR\t0\t\tdotnet_local.txt\n";
1424 static const char pa_msi_assembly_dat[] =
1425 "Component_\tFeature_\tFile_Manifest\tFile_Application\tAttributes\n"
1426 "s72\ts38\tS72\tS72\tI2\n"
1427 "MsiAssembly\tComponent_\n"
1428 "win32\tassembly\tmanifest.txt\t\t1\n"
1429 "win32_local\tassembly\tmanifest_local.txt\tapplication_win32.txt\t1\n"
1430 "dotnet\tassembly\t\t\t0\n"
1431 "dotnet_local\tassembly\t\tapplication_dotnet.txt\t0\n";
1433 static const char pa_msi_assembly_name_dat[] =
1434 "Component_\tName\tValue\n"
1435 "s72\ts255\ts255\n"
1436 "MsiAssemblyName\tComponent_\tName\n"
1437 "win32\tName\tWine.Win32.Assembly\n"
1438 "win32\tprocessorArchitecture\tx86\n"
1439 "win32\tpublicKeyToken\tabcdef0123456789\n"
1440 "win32\ttype\twin32\n"
1441 "win32\tversion\t1.0.0.0\n"
1442 "win32_local\tName\tWine.Win32.Local.Assembly\n"
1443 "win32_local\tprocessorArchitecture\tx86\n"
1444 "win32_local\tpublicKeyToken\tabcdef0123456789\n"
1445 "win32_local\ttype\twin32\n"
1446 "win32_local\tversion\t1.0.0.0\n"
1447 "dotnet\tName\tWine.Dotnet.Assembly\n"
1448 "dotnet\tprocessorArchitecture\tMSIL\n"
1449 "dotnet\tpublicKeyToken\tabcdef0123456789\n"
1450 "dotnet\tculture\tneutral\n"
1451 "dotnet\tversion\t1.0.0.0\n"
1452 "dotnet_local\tName\tWine.Dotnet.Local.Assembly\n"
1453 "dotnet_local\tprocessorArchitecture\tMSIL\n"
1454 "dotnet_local\tpublicKeyToken\tabcdef0123456789\n"
1455 "dotnet_local\tculture\tneutral\n"
1456 "dotnet_local\tversion\t1.0.0.0\n";
1458 static const char pa_install_exec_seq_dat[] =
1459 "Action\tCondition\tSequence\n"
1460 "s72\tS255\tI2\n"
1461 "InstallExecuteSequence\tAction\n"
1462 "LaunchConditions\t\t100\n"
1463 "CostInitialize\t\t800\n"
1464 "FileCost\t\t900\n"
1465 "CostFinalize\t\t1000\n"
1466 "InstallValidate\t\t1400\n"
1467 "InstallInitialize\t\t1500\n"
1468 "ProcessComponents\t\t1600\n"
1469 "MsiPublishAssemblies\t\t3000\n"
1470 "MsiUnpublishAssemblies\t\t4000\n"
1471 "RegisterProduct\t\t5000\n"
1472 "PublishFeatures\t\t5100\n"
1473 "PublishProduct\t\t5200\n"
1474 "InstallFinalize\t\t6000\n";
1476 static const char rep_file_dat[] =
1477 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1478 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1479 "File\tFile\n"
1480 "rep.txt\trep\trep.txt\t1000\t\t\t8192\t1\n";
1482 static const char rep_feature_dat[] =
1483 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1484 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1485 "Feature\tFeature\n"
1486 "rep\t\t\trep feature\t1\t2\tMSITESTDIR\t0\n";
1488 static const char rep_feature_comp_dat[] =
1489 "Feature_\tComponent_\n"
1490 "s38\ts72\n"
1491 "FeatureComponents\tFeature_\tComponent_\n"
1492 "rep\trep\n";
1494 static const char rep_component_dat[] =
1495 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1496 "s72\tS38\ts72\ti2\tS255\tS72\n"
1497 "Component\tComponent\n"
1498 "rep\t{A24FAF2A-3B2E-41EF-AA78-331542E1A29D}\tMSITESTDIR\t0\t\trep.txt\n";
1500 static const char rep_upgrade_dat[] =
1501 "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"
1502 "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"
1503 "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"
1504 "{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\t\t\t\t256\t\tPRODUCT\n";
1506 static const char rep_property_dat[] =
1507 "Property\tValue\n"
1508 "s72\tl0\n"
1509 "Property\tProperty\n"
1510 "HASUIRUN\t0\n"
1511 "INSTALLLEVEL\t3\n"
1512 "InstallMode\tTypical\n"
1513 "Manufacturer\tWine\n"
1514 "PIDTemplate\t###-#######\n"
1515 "ProductCode\t{1699F0BB-0B61-4A89-AFE4-CFD60DFD76F3}\n"
1516 "ProductLanguage\t1033\n"
1517 "ProductName\tMSITEST\n"
1518 "ProductVersion\t1.1.1\n"
1519 "UpgradeCode\t{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\n"
1520 "PRODUCT\t2F41860D-7B4C-4DA7-BED9-B64F26594C56\n"
1521 "MSIFASTINSTALL\t1\n";
1523 static const char rep_install_exec_seq_dat[] =
1524 "Action\tCondition\tSequence\n"
1525 "s72\tS255\tI2\n"
1526 "InstallExecuteSequence\tAction\n"
1527 "FindRelatedProducts\t\t100\n"
1528 "CostInitialize\t\t800\n"
1529 "FileCost\t\t900\n"
1530 "CostFinalize\t\t1000\n"
1531 "InstallValidate\t\t1400\n"
1532 "RemoveExistingProducts\t\t1499\n"
1533 "InstallInitialize\t\t1500\n"
1534 "ProcessComponents\t\t1600\n"
1535 "RemoveFiles\t\t1700\n"
1536 "InstallFiles\t\t2000\n"
1537 "UnregisterExtensionInfo\t\t3000\n"
1538 "UnregisterMIMEInfo\t\t3500\n"
1539 "RegisterExtensionInfo\t\t4000\n"
1540 "RegisterMIMEInfo\t\t4500\n"
1541 "RegisterProduct\t\t5000\n"
1542 "PublishFeatures\t\t5100\n"
1543 "PublishProduct\t\t5200\n"
1544 "InstallFinalize\t\t6000\n";
1546 typedef struct _msi_table
1548 const char *filename;
1549 const char *data;
1550 unsigned int size;
1551 } msi_table;
1553 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1555 static const msi_table env_tables[] =
1557 ADD_TABLE(component),
1558 ADD_TABLE(directory),
1559 ADD_TABLE(feature),
1560 ADD_TABLE(feature_comp),
1561 ADD_TABLE(file),
1562 ADD_TABLE(install_exec_seq),
1563 ADD_TABLE(media),
1564 ADD_TABLE(property),
1565 ADD_TABLE(environment)
1568 static const msi_table pp_tables[] =
1570 ADD_TABLE(pp_component),
1571 ADD_TABLE(directory),
1572 ADD_TABLE(rof_feature),
1573 ADD_TABLE(rof_feature_comp),
1574 ADD_TABLE(rof_file),
1575 ADD_TABLE(pp_install_exec_seq),
1576 ADD_TABLE(rof_media),
1577 ADD_TABLE(property),
1580 static const msi_table ppc_tables[] =
1582 ADD_TABLE(ppc_component),
1583 ADD_TABLE(directory),
1584 ADD_TABLE(rof_feature),
1585 ADD_TABLE(ppc_feature_comp),
1586 ADD_TABLE(ppc_file),
1587 ADD_TABLE(pp_install_exec_seq),
1588 ADD_TABLE(ppc_media),
1589 ADD_TABLE(property),
1592 static const msi_table rem_tables[] =
1594 ADD_TABLE(rem_component),
1595 ADD_TABLE(directory),
1596 ADD_TABLE(rof_feature),
1597 ADD_TABLE(rem_feature_comp),
1598 ADD_TABLE(rem_file),
1599 ADD_TABLE(rem_install_exec_seq),
1600 ADD_TABLE(rof_media),
1601 ADD_TABLE(property),
1602 ADD_TABLE(rem_remove_files),
1605 static const msi_table mov_tables[] =
1607 ADD_TABLE(cwd_component),
1608 ADD_TABLE(directory),
1609 ADD_TABLE(rof_feature),
1610 ADD_TABLE(ci2_feature_comp),
1611 ADD_TABLE(ci2_file),
1612 ADD_TABLE(install_exec_seq),
1613 ADD_TABLE(rof_media),
1614 ADD_TABLE(property),
1615 ADD_TABLE(mov_move_file),
1618 static const msi_table df_tables[] =
1620 ADD_TABLE(rof_component),
1621 ADD_TABLE(df_directory),
1622 ADD_TABLE(rof_feature),
1623 ADD_TABLE(rof_feature_comp),
1624 ADD_TABLE(rof_file),
1625 ADD_TABLE(install_exec_seq),
1626 ADD_TABLE(rof_media),
1627 ADD_TABLE(property),
1628 ADD_TABLE(df_duplicate_file),
1631 static const msi_table wrv_tables[] =
1633 ADD_TABLE(wrv_component),
1634 ADD_TABLE(directory),
1635 ADD_TABLE(rof_feature),
1636 ADD_TABLE(ci2_feature_comp),
1637 ADD_TABLE(ci2_file),
1638 ADD_TABLE(install_exec_seq),
1639 ADD_TABLE(rof_media),
1640 ADD_TABLE(property),
1641 ADD_TABLE(wrv_registry),
1644 static const msi_table cf_tables[] =
1646 ADD_TABLE(cf_component),
1647 ADD_TABLE(cf_directory),
1648 ADD_TABLE(cf_feature),
1649 ADD_TABLE(cf_feature_comp),
1650 ADD_TABLE(cf_file),
1651 ADD_TABLE(cf_create_folders),
1652 ADD_TABLE(cf_install_exec_seq),
1653 ADD_TABLE(media),
1654 ADD_TABLE(property)
1657 static const msi_table sss_tables[] =
1659 ADD_TABLE(component),
1660 ADD_TABLE(directory),
1661 ADD_TABLE(feature),
1662 ADD_TABLE(feature_comp),
1663 ADD_TABLE(file),
1664 ADD_TABLE(sss_install_exec_seq),
1665 ADD_TABLE(sss_service_control),
1666 ADD_TABLE(media),
1667 ADD_TABLE(property)
1670 static const msi_table sds_tables[] =
1672 ADD_TABLE(component),
1673 ADD_TABLE(directory),
1674 ADD_TABLE(feature),
1675 ADD_TABLE(feature_comp),
1676 ADD_TABLE(file),
1677 ADD_TABLE(sds_install_exec_seq),
1678 ADD_TABLE(service_control),
1679 ADD_TABLE(service_install),
1680 ADD_TABLE(media),
1681 ADD_TABLE(property)
1684 static const msi_table sr_tables[] =
1686 ADD_TABLE(component),
1687 ADD_TABLE(directory),
1688 ADD_TABLE(feature),
1689 ADD_TABLE(feature_comp),
1690 ADD_TABLE(file),
1691 ADD_TABLE(sr_selfreg),
1692 ADD_TABLE(sr_install_exec_seq),
1693 ADD_TABLE(media),
1694 ADD_TABLE(property)
1697 static const msi_table font_tables[] =
1699 ADD_TABLE(font_component),
1700 ADD_TABLE(directory),
1701 ADD_TABLE(font_feature),
1702 ADD_TABLE(font_feature_comp),
1703 ADD_TABLE(font_file),
1704 ADD_TABLE(font),
1705 ADD_TABLE(font_install_exec_seq),
1706 ADD_TABLE(font_media),
1707 ADD_TABLE(property)
1710 static const msi_table vp_tables[] =
1712 ADD_TABLE(component),
1713 ADD_TABLE(directory),
1714 ADD_TABLE(feature),
1715 ADD_TABLE(feature_comp),
1716 ADD_TABLE(file),
1717 ADD_TABLE(vp_custom_action),
1718 ADD_TABLE(vp_install_exec_seq),
1719 ADD_TABLE(media),
1720 ADD_TABLE(vp_property)
1723 static const msi_table odbc_tables[] =
1725 ADD_TABLE(odbc_component),
1726 ADD_TABLE(directory),
1727 ADD_TABLE(odbc_feature),
1728 ADD_TABLE(odbc_feature_comp),
1729 ADD_TABLE(odbc_file),
1730 ADD_TABLE(odbc_driver),
1731 ADD_TABLE(odbc_translator),
1732 ADD_TABLE(odbc_datasource),
1733 ADD_TABLE(odbc_install_exec_seq),
1734 ADD_TABLE(odbc_media),
1735 ADD_TABLE(property)
1738 static const msi_table tl_tables[] =
1740 ADD_TABLE(tl_component),
1741 ADD_TABLE(directory),
1742 ADD_TABLE(tl_feature),
1743 ADD_TABLE(tl_feature_comp),
1744 ADD_TABLE(tl_file),
1745 ADD_TABLE(tl_typelib),
1746 ADD_TABLE(tl_install_exec_seq),
1747 ADD_TABLE(media),
1748 ADD_TABLE(property)
1751 static const msi_table crs_tables[] =
1753 ADD_TABLE(crs_component),
1754 ADD_TABLE(directory),
1755 ADD_TABLE(crs_feature),
1756 ADD_TABLE(crs_feature_comp),
1757 ADD_TABLE(crs_file),
1758 ADD_TABLE(crs_shortcut),
1759 ADD_TABLE(crs_install_exec_seq),
1760 ADD_TABLE(media),
1761 ADD_TABLE(property)
1764 static const msi_table pub_tables[] =
1766 ADD_TABLE(directory),
1767 ADD_TABLE(pub_component),
1768 ADD_TABLE(pub_feature),
1769 ADD_TABLE(pub_feature_comp),
1770 ADD_TABLE(pub_file),
1771 ADD_TABLE(pub_publish_component),
1772 ADD_TABLE(pub_install_exec_seq),
1773 ADD_TABLE(media),
1774 ADD_TABLE(property)
1777 static const msi_table rd_tables[] =
1779 ADD_TABLE(directory),
1780 ADD_TABLE(rd_component),
1781 ADD_TABLE(rd_feature),
1782 ADD_TABLE(rd_feature_comp),
1783 ADD_TABLE(rd_file),
1784 ADD_TABLE(rd_duplicate_file),
1785 ADD_TABLE(rd_install_exec_seq),
1786 ADD_TABLE(media),
1787 ADD_TABLE(property)
1790 static const msi_table rrv_tables[] =
1792 ADD_TABLE(directory),
1793 ADD_TABLE(rrv_component),
1794 ADD_TABLE(rrv_feature),
1795 ADD_TABLE(rrv_feature_comp),
1796 ADD_TABLE(rrv_file),
1797 ADD_TABLE(rrv_registry),
1798 ADD_TABLE(rrv_remove_registry),
1799 ADD_TABLE(rrv_install_exec_seq),
1800 ADD_TABLE(media),
1801 ADD_TABLE(property)
1804 static const msi_table frp_tables[] =
1806 ADD_TABLE(directory),
1807 ADD_TABLE(frp_component),
1808 ADD_TABLE(frp_feature),
1809 ADD_TABLE(frp_feature_comp),
1810 ADD_TABLE(frp_file),
1811 ADD_TABLE(frp_upgrade),
1812 ADD_TABLE(frp_custom_action),
1813 ADD_TABLE(frp_install_exec_seq),
1814 ADD_TABLE(media),
1815 ADD_TABLE(property)
1818 static const msi_table riv_tables[] =
1820 ADD_TABLE(directory),
1821 ADD_TABLE(riv_component),
1822 ADD_TABLE(riv_feature),
1823 ADD_TABLE(riv_feature_comp),
1824 ADD_TABLE(riv_file),
1825 ADD_TABLE(riv_ini_file),
1826 ADD_TABLE(riv_remove_ini_file),
1827 ADD_TABLE(riv_install_exec_seq),
1828 ADD_TABLE(media),
1829 ADD_TABLE(property)
1832 static const msi_table res_tables[] =
1834 ADD_TABLE(directory),
1835 ADD_TABLE(res_component),
1836 ADD_TABLE(res_feature),
1837 ADD_TABLE(res_feature_comp),
1838 ADD_TABLE(res_file),
1839 ADD_TABLE(res_environment),
1840 ADD_TABLE(res_install_exec_seq),
1841 ADD_TABLE(media),
1842 ADD_TABLE(property)
1845 static const msi_table rci_tables[] =
1847 ADD_TABLE(directory),
1848 ADD_TABLE(rci_component),
1849 ADD_TABLE(rci_feature),
1850 ADD_TABLE(rci_feature_comp),
1851 ADD_TABLE(rci_file),
1852 ADD_TABLE(rci_appid),
1853 ADD_TABLE(rci_class),
1854 ADD_TABLE(rci_install_exec_seq),
1855 ADD_TABLE(media),
1856 ADD_TABLE(property)
1859 static const msi_table rei_tables[] =
1861 ADD_TABLE(directory),
1862 ADD_TABLE(rei_component),
1863 ADD_TABLE(rei_feature),
1864 ADD_TABLE(rei_feature_comp),
1865 ADD_TABLE(rei_file),
1866 ADD_TABLE(rei_extension),
1867 ADD_TABLE(rei_verb),
1868 ADD_TABLE(rei_progid),
1869 ADD_TABLE(rei_install_exec_seq),
1870 ADD_TABLE(media),
1871 ADD_TABLE(property)
1874 static const msi_table rmi_tables[] =
1876 ADD_TABLE(directory),
1877 ADD_TABLE(rmi_component),
1878 ADD_TABLE(rmi_feature),
1879 ADD_TABLE(rmi_feature_comp),
1880 ADD_TABLE(rmi_file),
1881 ADD_TABLE(rmi_extension),
1882 ADD_TABLE(rmi_verb),
1883 ADD_TABLE(rmi_mime),
1884 ADD_TABLE(rmi_install_exec_seq),
1885 ADD_TABLE(media),
1886 ADD_TABLE(property)
1889 static const msi_table pa_tables[] =
1891 ADD_TABLE(directory),
1892 ADD_TABLE(pa_component),
1893 ADD_TABLE(pa_feature),
1894 ADD_TABLE(pa_feature_comp),
1895 ADD_TABLE(pa_file),
1896 ADD_TABLE(pa_msi_assembly),
1897 ADD_TABLE(pa_msi_assembly_name),
1898 ADD_TABLE(pa_install_exec_seq),
1899 ADD_TABLE(media),
1900 ADD_TABLE(property)
1903 static const msi_table rep_tables[] =
1905 ADD_TABLE(directory),
1906 ADD_TABLE(rep_component),
1907 ADD_TABLE(rep_feature),
1908 ADD_TABLE(rep_feature_comp),
1909 ADD_TABLE(rep_file),
1910 ADD_TABLE(rep_upgrade),
1911 ADD_TABLE(rep_property),
1912 ADD_TABLE(rep_install_exec_seq),
1913 ADD_TABLE(media)
1916 /* based on RegDeleteTreeW from dlls/advapi32/registry.c */
1917 static LSTATUS action_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey, REGSAM access)
1919 LONG ret;
1920 DWORD dwMaxSubkeyLen, dwMaxValueLen;
1921 DWORD dwMaxLen, dwSize;
1922 char szNameBuf[MAX_PATH], *lpszName = szNameBuf;
1923 HKEY hSubKey = hKey;
1925 if(lpszSubKey)
1927 ret = RegOpenKeyExA(hKey, lpszSubKey, 0, access, &hSubKey);
1928 if (ret) return ret;
1931 ret = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, NULL,
1932 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
1933 if (ret) goto cleanup;
1935 dwMaxSubkeyLen++;
1936 dwMaxValueLen++;
1937 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
1938 if (dwMaxLen > sizeof(szNameBuf))
1940 /* Name too big: alloc a buffer for it */
1941 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen)))
1943 ret = ERROR_NOT_ENOUGH_MEMORY;
1944 goto cleanup;
1948 /* Recursively delete all the subkeys */
1949 while (TRUE)
1951 dwSize = dwMaxLen;
1952 if (RegEnumKeyExA(hSubKey, 0, lpszName, &dwSize, NULL,
1953 NULL, NULL, NULL)) break;
1955 ret = action_RegDeleteTreeA(hSubKey, lpszName, access);
1956 if (ret) goto cleanup;
1959 if (lpszSubKey)
1961 if (pRegDeleteKeyExA)
1962 ret = pRegDeleteKeyExA(hKey, lpszSubKey, access, 0);
1963 else
1964 ret = RegDeleteKeyA(hKey, lpszSubKey);
1966 else
1967 while (TRUE)
1969 dwSize = dwMaxLen;
1970 if (RegEnumValueA(hKey, 0, lpszName, &dwSize,
1971 NULL, NULL, NULL, NULL)) break;
1973 ret = RegDeleteValueA(hKey, lpszName);
1974 if (ret) goto cleanup;
1977 cleanup:
1978 if (lpszName != szNameBuf)
1979 HeapFree(GetProcessHeap(), 0, lpszName);
1980 if(lpszSubKey)
1981 RegCloseKey(hSubKey);
1982 return ret;
1985 /* cabinet definitions */
1987 /* make the max size large so there is only one cab file */
1988 #define MEDIA_SIZE 0x7FFFFFFF
1989 #define FOLDER_THRESHOLD 900000
1991 /* the FCI callbacks */
1993 static void * CDECL mem_alloc(ULONG cb)
1995 return HeapAlloc(GetProcessHeap(), 0, cb);
1998 static void CDECL mem_free(void *memory)
2000 HeapFree(GetProcessHeap(), 0, memory);
2003 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
2005 sprintf(pccab->szCab, pv, pccab->iCab);
2006 return TRUE;
2009 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
2011 return 0;
2014 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
2015 BOOL fContinuation, void *pv)
2017 return 0;
2020 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
2022 HANDLE handle;
2023 DWORD dwAccess = 0;
2024 DWORD dwShareMode = 0;
2025 DWORD dwCreateDisposition = OPEN_EXISTING;
2027 dwAccess = GENERIC_READ | GENERIC_WRITE;
2028 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
2030 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
2031 dwCreateDisposition = OPEN_EXISTING;
2032 else
2033 dwCreateDisposition = CREATE_NEW;
2035 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2036 dwCreateDisposition, 0, NULL);
2038 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2040 return (INT_PTR)handle;
2043 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2045 HANDLE handle = (HANDLE)hf;
2046 DWORD dwRead;
2047 BOOL res;
2049 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2050 ok(res, "Failed to ReadFile\n");
2052 return dwRead;
2055 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2057 HANDLE handle = (HANDLE)hf;
2058 DWORD dwWritten;
2059 BOOL res;
2061 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2062 ok(res, "Failed to WriteFile\n");
2064 return dwWritten;
2067 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2069 HANDLE handle = (HANDLE)hf;
2070 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2072 return 0;
2075 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2077 HANDLE handle = (HANDLE)hf;
2078 DWORD ret;
2080 ret = SetFilePointer(handle, dist, NULL, seektype);
2081 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2083 return ret;
2086 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2088 BOOL ret = DeleteFileA(pszFile);
2089 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2091 return 0;
2094 static void init_functionpointers(void)
2096 HMODULE hmsi = GetModuleHandleA("msi.dll");
2097 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2098 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2100 #define GET_PROC(mod, func) \
2101 p ## func = (void*)GetProcAddress(mod, #func); \
2102 if(!p ## func) \
2103 trace("GetProcAddress(%s) failed\n", #func);
2105 GET_PROC(hmsi, MsiQueryComponentStateA);
2106 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2107 GET_PROC(hmsi, MsiSourceListGetInfoA);
2108 GET_PROC(hmsi, MsiGetComponentPathExA);
2109 GET_PROC(hmsi, MsiQueryFeatureStateExA);
2111 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2112 GET_PROC(hadvapi32, OpenProcessToken);
2113 GET_PROC(hadvapi32, RegDeleteKeyExA)
2114 GET_PROC(hkernel32, IsWow64Process)
2116 hsrclient = LoadLibraryA("srclient.dll");
2117 GET_PROC(hsrclient, SRRemoveRestorePoint);
2118 GET_PROC(hsrclient, SRSetRestorePointA);
2120 #undef GET_PROC
2123 static BOOL is_process_limited(void)
2125 HANDLE token;
2127 if (!pOpenProcessToken) return FALSE;
2129 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2131 BOOL ret;
2132 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2133 DWORD size;
2135 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2136 CloseHandle(token);
2137 return (ret && type == TokenElevationTypeLimited);
2139 return FALSE;
2142 static char *get_user_sid(void)
2144 HANDLE token;
2145 DWORD size = 0;
2146 TOKEN_USER *user;
2147 char *usersid = NULL;
2149 if (!pConvertSidToStringSidA)
2151 win_skip("ConvertSidToStringSidA is not available\n");
2152 return NULL;
2154 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
2155 GetTokenInformation(token, TokenUser, NULL, size, &size);
2157 user = HeapAlloc(GetProcessHeap(), 0, size);
2158 GetTokenInformation(token, TokenUser, user, size, &size);
2159 pConvertSidToStringSidA(user->User.Sid, &usersid);
2160 HeapFree(GetProcessHeap(), 0, user);
2162 CloseHandle(token);
2163 return usersid;
2166 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2168 LPSTR tempname;
2170 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2171 GetTempFileNameA(".", "xx", 0, tempname);
2173 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2175 lstrcpyA(pszTempName, tempname);
2176 HeapFree(GetProcessHeap(), 0, tempname);
2177 return TRUE;
2180 HeapFree(GetProcessHeap(), 0, tempname);
2182 return FALSE;
2185 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2186 USHORT *pattribs, int *err, void *pv)
2188 BY_HANDLE_FILE_INFORMATION finfo;
2189 FILETIME filetime;
2190 HANDLE handle;
2191 DWORD attrs;
2192 BOOL res;
2194 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2195 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2197 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2199 res = GetFileInformationByHandle(handle, &finfo);
2200 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2202 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2203 FileTimeToDosDateTime(&filetime, pdate, ptime);
2205 attrs = GetFileAttributesA(pszName);
2206 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2208 return (INT_PTR)handle;
2211 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2213 char path[MAX_PATH];
2214 char filename[MAX_PATH];
2216 lstrcpyA(path, CURR_DIR);
2217 lstrcatA(path, "\\");
2218 lstrcatA(path, file);
2220 lstrcpyA(filename, file);
2222 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2223 progress, get_open_info, compress);
2226 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2228 ZeroMemory(pCabParams, sizeof(CCAB));
2230 pCabParams->cb = max_size;
2231 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2232 pCabParams->setID = 0xbeef;
2233 pCabParams->iCab = 1;
2234 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2235 lstrcatA(pCabParams->szCabPath, "\\");
2236 lstrcpyA(pCabParams->szCab, name);
2239 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2241 CCAB cabParams;
2242 LPCSTR ptr;
2243 HFCI hfci;
2244 ERF erf;
2245 BOOL res;
2247 set_cab_parameters(&cabParams, name, max_size);
2249 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2250 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2251 get_temp_file, &cabParams, NULL);
2253 ok(hfci != NULL, "Failed to create an FCI context\n");
2255 ptr = files;
2256 while (*ptr)
2258 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2259 ok(res, "Failed to add file: %s\n", ptr);
2260 ptr += lstrlenA(ptr) + 1;
2263 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2264 ok(res, "Failed to flush the cabinet\n");
2266 res = FCIDestroy(hfci);
2267 ok(res, "Failed to destroy the cabinet\n");
2270 static BOOL get_user_dirs(void)
2272 HKEY hkey;
2273 DWORD type, size;
2275 if (RegOpenKeyA(HKEY_CURRENT_USER,
2276 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2277 return FALSE;
2279 size = MAX_PATH;
2280 if (RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size))
2282 RegCloseKey(hkey);
2283 return FALSE;
2286 RegCloseKey(hkey);
2287 return TRUE;
2290 static BOOL get_system_dirs(void)
2292 HKEY hkey;
2293 DWORD type, size;
2295 if (RegOpenKeyA(HKEY_LOCAL_MACHINE,
2296 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2297 return FALSE;
2299 size = MAX_PATH;
2300 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2301 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size))
2303 RegCloseKey(hkey);
2304 return FALSE;
2307 size = MAX_PATH;
2308 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2309 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size))
2311 RegCloseKey(hkey);
2312 return FALSE;
2315 RegCloseKey(hkey);
2317 if (!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2318 return FALSE;
2320 return TRUE;
2323 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2325 HANDLE file;
2326 DWORD written;
2328 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2329 if (file == INVALID_HANDLE_VALUE)
2330 return;
2332 WriteFile(file, data, strlen(data), &written, NULL);
2334 if (size)
2336 SetFilePointer(file, size, NULL, FILE_BEGIN);
2337 SetEndOfFile(file);
2340 CloseHandle(file);
2343 #define create_file(name, size) create_file_data(name, name, size)
2345 static void create_test_files(void)
2347 CreateDirectoryA("msitest", NULL);
2348 create_file("msitest\\one.txt", 100);
2349 CreateDirectoryA("msitest\\first", NULL);
2350 create_file("msitest\\first\\two.txt", 100);
2351 CreateDirectoryA("msitest\\second", NULL);
2352 create_file("msitest\\second\\three.txt", 100);
2354 create_file("four.txt", 100);
2355 create_file("five.txt", 100);
2356 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2358 create_file("msitest\\filename", 100);
2359 create_file("msitest\\service.exe", 100);
2360 create_file("msitest\\service2.exe", 100);
2362 DeleteFileA("four.txt");
2363 DeleteFileA("five.txt");
2366 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2368 CHAR path[MAX_PATH];
2370 lstrcpyA(path, PROG_FILES_DIR);
2371 lstrcatA(path, "\\");
2372 lstrcatA(path, rel_path);
2374 if (is_file)
2375 return DeleteFileA(path);
2376 else
2377 return RemoveDirectoryA(path);
2380 static void delete_test_files(void)
2382 DeleteFileA("msitest.msi");
2383 DeleteFileA("msitest.cab");
2384 DeleteFileA("msitest\\second\\three.txt");
2385 DeleteFileA("msitest\\first\\two.txt");
2386 DeleteFileA("msitest\\one.txt");
2387 DeleteFileA("msitest\\service.exe");
2388 DeleteFileA("msitest\\service2.exe");
2389 DeleteFileA("msitest\\filename");
2390 RemoveDirectoryA("msitest\\second");
2391 RemoveDirectoryA("msitest\\first");
2392 RemoveDirectoryA("msitest");
2395 static void write_file(const CHAR *filename, const char *data, int data_size)
2397 DWORD size;
2398 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2399 WriteFile(hf, data, data_size, &size, NULL);
2400 CloseHandle(hf);
2403 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template)
2405 MSIHANDLE summary;
2406 UINT r;
2408 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2409 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2411 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2412 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2414 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2415 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2416 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2418 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2419 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2421 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2424 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2425 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2427 /* write the summary changes back to the stream */
2428 r = MsiSummaryInfoPersist(summary);
2429 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2431 MsiCloseHandle(summary);
2434 #define create_database(name, tables, num_tables) \
2435 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
2437 #define create_database_template(name, tables, num_tables, version, template) \
2438 create_database_wordcount(name, tables, num_tables, version, 0, template);
2440 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2441 int num_tables, INT version, INT wordcount,
2442 const char *template)
2444 MSIHANDLE db;
2445 UINT r;
2446 int j;
2448 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
2449 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2451 /* import the tables into the database */
2452 for (j = 0; j < num_tables; j++)
2454 const msi_table *table = &tables[j];
2456 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2458 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2459 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2461 DeleteFileA(table->filename);
2464 write_msi_summary_info(db, version, wordcount, template);
2466 r = MsiDatabaseCommit(db);
2467 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2469 MsiCloseHandle(db);
2472 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2474 RESTOREPOINTINFOA spec;
2476 spec.dwEventType = event_type;
2477 spec.dwRestorePtType = APPLICATION_INSTALL;
2478 spec.llSequenceNumber = status->llSequenceNumber;
2479 lstrcpyA(spec.szDescription, "msitest restore point");
2481 return pSRSetRestorePointA(&spec, status);
2484 static void remove_restore_point(DWORD seq_number)
2486 DWORD res;
2488 res = pSRRemoveRestorePoint(seq_number);
2489 if (res != ERROR_SUCCESS)
2490 trace("Failed to remove the restore point : %08x\n", res);
2493 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2495 if (pRegDeleteKeyExA)
2496 return pRegDeleteKeyExA( key, subkey, access, 0 );
2497 return RegDeleteKeyA( key, subkey );
2500 static BOOL file_exists(LPCSTR file)
2502 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
2505 static BOOL pf_exists(LPCSTR file)
2507 CHAR path[MAX_PATH];
2509 lstrcpyA(path, PROG_FILES_DIR);
2510 lstrcatA(path, "\\");
2511 lstrcatA(path, file);
2513 return file_exists(path);
2516 static void delete_pfmsitest_files(void)
2518 SHFILEOPSTRUCTA shfl;
2519 CHAR path[MAX_PATH+11];
2521 lstrcpyA(path, PROG_FILES_DIR);
2522 lstrcatA(path, "\\msitest\\*");
2523 path[strlen(path) + 1] = '\0';
2525 shfl.hwnd = NULL;
2526 shfl.wFunc = FO_DELETE;
2527 shfl.pFrom = path;
2528 shfl.pTo = NULL;
2529 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
2531 SHFileOperationA(&shfl);
2533 lstrcpyA(path, PROG_FILES_DIR);
2534 lstrcatA(path, "\\msitest");
2535 RemoveDirectoryA(path);
2538 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2540 char val[MAX_PATH];
2541 DWORD size, type;
2542 LONG res;
2544 size = MAX_PATH;
2545 val[0] = '\0';
2546 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2548 if (res != ERROR_SUCCESS ||
2549 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2551 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2552 return;
2555 if (!expected)
2556 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
2557 else
2559 if (bcase)
2560 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2561 else
2562 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2566 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2568 DWORD val, size, type;
2569 LONG res;
2571 size = sizeof(DWORD);
2572 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2574 if (res != ERROR_SUCCESS || type != REG_DWORD)
2576 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2577 return;
2580 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2583 static void check_reg_dword4(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2584 DWORD expected4, DWORD line)
2586 DWORD val, size, type;
2587 LONG res;
2589 size = sizeof(DWORD);
2590 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2592 if (res != ERROR_SUCCESS || type != REG_DWORD)
2594 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2595 return;
2598 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4,
2599 "Expected %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, val);
2602 static void check_reg_dword5(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2603 DWORD expected4, DWORD expected5, DWORD line)
2605 DWORD val, size, type;
2606 LONG res;
2608 size = sizeof(DWORD);
2609 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2611 if (res != ERROR_SUCCESS || type != REG_DWORD)
2613 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2614 return;
2617 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4 ||
2618 val == expected5,
2619 "Expected %d, %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, expected5, val);
2622 #define CHECK_REG_STR(prodkey, name, expected) \
2623 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2625 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2626 do { \
2627 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2628 RegDeleteValueA(prodkey, name); \
2629 } while(0)
2631 #define CHECK_REG_ISTR(prodkey, name, expected) \
2632 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2634 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2635 do { \
2636 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2637 RegDeleteValueA(prodkey, name); \
2638 } while(0)
2640 #define CHECK_REG_DWORD(prodkey, name, expected) \
2641 check_reg_dword(prodkey, name, expected, __LINE__);
2643 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2644 do { \
2645 check_reg_dword(prodkey, name, expected, __LINE__); \
2646 RegDeleteValueA(prodkey, name); \
2647 } while(0)
2649 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
2650 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
2652 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
2653 do { \
2654 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
2655 RegDeleteValueA(prodkey, name); \
2656 } while(0)
2658 #define CHECK_REG_DWORD4(prodkey, name, expected1, expected2, expected3, expected4) \
2659 check_reg_dword4(prodkey, name, expected1, expected2, expected3, expected4, __LINE__);
2661 #define CHECK_DEL_REG_DWORD5(prodkey, name, expected1, expected2, expected3, expected4 ,expected5) \
2662 do { \
2663 check_reg_dword5(prodkey, name, expected1, expected2, expected3, expected4, expected5, __LINE__); \
2664 RegDeleteValueA(prodkey, name); \
2665 } while(0)
2667 static void get_date_str(LPSTR date)
2669 SYSTEMTIME systime;
2671 static const char date_fmt[] = "%d%02d%02d";
2672 GetLocalTime(&systime);
2673 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2676 static void test_register_product(void)
2678 UINT r;
2679 LONG res;
2680 HKEY hkey, props, usage;
2681 LPSTR usersid;
2682 char date[MAX_PATH], temp[MAX_PATH], keypath[MAX_PATH], path[MAX_PATH];
2683 DWORD size, type;
2684 REGSAM access = KEY_ALL_ACCESS;
2686 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2687 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2688 static const CHAR uninstall_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion"
2689 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2690 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2691 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2692 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2693 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2694 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2695 "\\51AAE0C44620A5E4788506E91F249BD2";
2697 if (is_process_limited())
2699 skip("process is limited\n");
2700 return;
2703 if (!(usersid = get_user_sid()))
2704 return;
2706 get_date_str(date);
2707 GetTempPathA(MAX_PATH, temp);
2709 CreateDirectoryA("msitest", NULL);
2710 create_file("msitest\\maximus", 500);
2712 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2714 if (is_wow64)
2715 access |= KEY_WOW64_64KEY;
2717 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2719 /* RegisterProduct */
2720 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2721 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2723 skip("Not enough rights to perform tests\n");
2724 goto error;
2726 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2727 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2728 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2730 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2731 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2733 if (is_64bit)
2735 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2736 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2738 else
2740 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2741 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2744 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2745 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2746 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2747 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2748 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2749 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2750 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2751 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2752 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2753 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2754 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2755 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2756 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2757 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2758 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2759 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2760 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2761 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2762 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2763 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2764 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2765 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2766 todo_wine
2768 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
2771 delete_key(hkey, "", access);
2772 RegCloseKey(hkey);
2774 sprintf(keypath, userdata, usersid);
2775 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2776 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2778 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2779 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2781 size = sizeof(path);
2782 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
2783 DeleteFileA(path);
2784 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2786 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2787 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2788 CHECK_DEL_REG_STR(props, "InstallDate", date);
2789 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2790 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2791 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2792 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2793 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2794 CHECK_DEL_REG_STR(props, "Comments", NULL);
2795 CHECK_DEL_REG_STR(props, "Contact", NULL);
2796 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2797 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2798 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2799 CHECK_DEL_REG_STR(props, "Readme", NULL);
2800 CHECK_DEL_REG_STR(props, "Size", NULL);
2801 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2802 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2803 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2804 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2805 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2806 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2807 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2808 todo_wine
2810 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
2813 delete_key(props, "", access);
2814 RegCloseKey(props);
2816 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2817 todo_wine
2819 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2822 delete_key(usage, "", access);
2823 RegCloseKey(usage);
2824 delete_key(hkey, "", access);
2825 RegCloseKey(hkey);
2827 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2828 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2830 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2832 delete_key(hkey, "", access);
2833 RegCloseKey(hkey);
2835 /* RegisterProduct, machine */
2836 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
2837 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2838 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2839 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2841 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, userugkey, 0, access, &hkey);
2842 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2844 if (is_64bit)
2846 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2847 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2849 else
2851 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2852 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2855 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2856 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2857 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2858 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2859 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2860 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2861 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2862 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2863 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2864 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2865 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2866 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2867 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2868 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2869 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2870 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2871 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2872 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2873 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2874 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2875 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2876 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2877 todo_wine
2879 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
2882 delete_key(hkey, "", access);
2883 RegCloseKey(hkey);
2885 sprintf(keypath, userdata, "S-1-5-18");
2886 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2887 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2889 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2890 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2892 size = sizeof(path);
2893 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
2894 DeleteFileA(path);
2895 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2897 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2898 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2899 CHECK_DEL_REG_STR(props, "InstallDate", date);
2900 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2901 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2902 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2903 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2904 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2905 CHECK_DEL_REG_STR(props, "Comments", NULL);
2906 CHECK_DEL_REG_STR(props, "Contact", NULL);
2907 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2908 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2909 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2910 CHECK_DEL_REG_STR(props, "Readme", NULL);
2911 CHECK_DEL_REG_STR(props, "Size", NULL);
2912 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2913 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2914 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2915 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2916 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2917 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2918 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2919 todo_wine
2921 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
2924 delete_key(props, "", access);
2925 RegCloseKey(props);
2927 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2928 todo_wine
2930 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2933 delete_key(usage, "", access);
2934 RegCloseKey(usage);
2935 delete_key(hkey, "", access);
2936 RegCloseKey(hkey);
2938 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2939 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2941 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2943 delete_key(hkey, "", access);
2944 RegCloseKey(hkey);
2946 error:
2947 DeleteFileA(msifile);
2948 DeleteFileA("msitest\\maximus");
2949 RemoveDirectoryA("msitest");
2950 HeapFree(GetProcessHeap(), 0, usersid);
2953 static void test_publish_product(void)
2955 static const char prodpath[] =
2956 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
2957 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2958 static const char cuprodpath[] =
2959 "Software\\Microsoft\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2960 static const char cuupgrades[] =
2961 "Software\\Microsoft\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2962 static const char badprod[] =
2963 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products"
2964 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2965 static const char machprod[] =
2966 "Software\\Classes\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2967 static const char machup[] =
2968 "Software\\Classes\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2969 UINT r;
2970 LONG res;
2971 LPSTR usersid;
2972 HKEY sourcelist, net, props;
2973 HKEY hkey, patches, media;
2974 CHAR keypath[MAX_PATH];
2975 CHAR temp[MAX_PATH];
2976 CHAR path[MAX_PATH];
2977 BOOL old_installer = FALSE;
2978 REGSAM access = KEY_ALL_ACCESS;
2980 if (is_process_limited())
2982 skip("process is limited\n");
2983 return;
2986 if (!(usersid = get_user_sid()))
2987 return;
2989 GetTempPathA(MAX_PATH, temp);
2991 CreateDirectoryA("msitest", NULL);
2992 create_file("msitest\\maximus", 500);
2994 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2996 if (is_wow64)
2997 access |= KEY_WOW64_64KEY;
2999 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3001 /* PublishProduct, current user */
3002 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3003 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3005 skip("Not enough rights to perform tests\n");
3006 goto error;
3008 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3009 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3010 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3012 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3013 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3015 sprintf(keypath, prodpath, usersid);
3016 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3017 if (res == ERROR_FILE_NOT_FOUND)
3019 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3020 if (res == ERROR_SUCCESS)
3022 win_skip("Windows Installer < 3.0 detected\n");
3023 RegCloseKey(hkey);
3024 old_installer = TRUE;
3025 goto currentuser;
3027 else
3029 win_skip("Install failed, no need to continue\n");
3030 return;
3033 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3035 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3036 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3038 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3039 todo_wine
3041 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3042 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3045 delete_key(patches, "", access);
3046 RegCloseKey(patches);
3047 delete_key(hkey, "", access);
3048 RegCloseKey(hkey);
3050 currentuser:
3051 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3052 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3054 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3055 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3056 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3057 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3058 if (!old_installer)
3059 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3060 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
3061 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3062 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3063 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3065 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
3066 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3068 lstrcpyA(path, "n;1;");
3069 lstrcatA(path, temp);
3070 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3071 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3073 res = RegOpenKeyA(sourcelist, "Net", &net);
3074 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3076 CHECK_DEL_REG_STR(net, "1", temp);
3078 RegDeleteKeyA(net, "");
3079 RegCloseKey(net);
3081 res = RegOpenKeyA(sourcelist, "Media", &media);
3082 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3084 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3086 RegDeleteKeyA(media, "");
3087 RegCloseKey(media);
3088 RegDeleteKeyA(sourcelist, "");
3089 RegCloseKey(sourcelist);
3090 RegDeleteKeyA(hkey, "");
3091 RegCloseKey(hkey);
3093 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
3094 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3096 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3098 RegDeleteKeyA(hkey, "");
3099 RegCloseKey(hkey);
3101 /* PublishProduct, machine */
3102 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
3103 if (old_installer)
3104 goto machprod;
3105 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3106 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3107 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3109 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3110 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3112 sprintf(keypath, prodpath, "S-1-5-18");
3113 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3114 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3116 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3117 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3119 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3120 todo_wine
3122 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3123 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3126 delete_key(patches, "", access);
3127 RegCloseKey(patches);
3128 delete_key(hkey, "", access);
3129 RegCloseKey(hkey);
3131 machprod:
3132 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machprod, 0, access, &hkey);
3133 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3135 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3136 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3137 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3138 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3139 if (!old_installer)
3140 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3141 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
3142 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3143 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3144 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3146 res = RegOpenKeyExA(hkey, "SourceList", 0, access, &sourcelist);
3147 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3149 lstrcpyA(path, "n;1;");
3150 lstrcatA(path, temp);
3151 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3152 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3154 res = RegOpenKeyExA(sourcelist, "Net", 0, access, &net);
3155 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3157 CHECK_DEL_REG_STR(net, "1", temp);
3159 res = delete_key(net, "", access);
3160 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3161 RegCloseKey(net);
3163 res = RegOpenKeyExA(sourcelist, "Media", 0, access, &media);
3164 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3166 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3168 res = delete_key(media, "", access);
3169 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3170 RegCloseKey(media);
3171 res = delete_key(sourcelist, "", access);
3172 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3173 RegCloseKey(sourcelist);
3174 res = delete_key(hkey, "", access);
3175 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3176 RegCloseKey(hkey);
3178 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machup, 0, access, &hkey);
3179 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3181 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3183 res = delete_key(hkey, "", access);
3184 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3185 RegCloseKey(hkey);
3187 error:
3188 DeleteFileA(msifile);
3189 DeleteFileA("msitest\\maximus");
3190 RemoveDirectoryA("msitest");
3191 HeapFree(GetProcessHeap(), 0, usersid);
3194 static void test_publish_features(void)
3196 static const char cupath[] =
3197 "Software\\Microsoft\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3198 static const char udfeatpath[] =
3199 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3200 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
3201 static const char udpridpath[] =
3202 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3203 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3204 static const char featkey[] =
3205 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Features";
3206 static const char classfeat[] =
3207 "Software\\Classes\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3208 UINT r;
3209 LONG res;
3210 HKEY hkey;
3211 LPSTR usersid;
3212 CHAR keypath[MAX_PATH];
3213 REGSAM access = KEY_ALL_ACCESS;
3215 if (is_process_limited())
3217 skip("process is limited\n");
3218 return;
3221 if (!(usersid = get_user_sid()))
3222 return;
3224 CreateDirectoryA("msitest", NULL);
3225 create_file("msitest\\maximus", 500);
3227 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3229 if (is_wow64)
3230 access |= KEY_WOW64_64KEY;
3232 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3234 /* PublishFeatures, current user */
3235 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3236 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3238 skip("Not enough rights to perform tests\n");
3239 goto error;
3241 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3242 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3243 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3245 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3246 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3248 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3249 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3251 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3252 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3254 CHECK_REG_STR(hkey, "feature", "");
3255 CHECK_REG_STR(hkey, "montecristo", "");
3257 RegDeleteValueA(hkey, "feature");
3258 RegDeleteValueA(hkey, "montecristo");
3259 delete_key(hkey, "", access);
3260 RegCloseKey(hkey);
3262 sprintf(keypath, udfeatpath, usersid);
3263 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3264 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3266 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3267 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3269 RegDeleteValueA(hkey, "feature");
3270 RegDeleteValueA(hkey, "montecristo");
3271 delete_key(hkey, "", access);
3272 RegCloseKey(hkey);
3273 sprintf(keypath, udpridpath, usersid);
3274 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3276 /* PublishFeatures, machine */
3277 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
3278 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3279 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3280 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3282 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3283 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3285 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3286 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3287 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3288 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3290 CHECK_REG_STR(hkey, "feature", "");
3291 CHECK_REG_STR(hkey, "montecristo", "");
3293 RegDeleteValueA(hkey, "feature");
3294 RegDeleteValueA(hkey, "montecristo");
3295 delete_key(hkey, "", access);
3296 RegCloseKey(hkey);
3298 sprintf(keypath, udfeatpath, "S-1-5-18");
3299 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3300 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3302 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3303 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3305 RegDeleteValueA(hkey, "feature");
3306 RegDeleteValueA(hkey, "montecristo");
3307 delete_key(hkey, "", access);
3308 RegCloseKey(hkey);
3309 sprintf(keypath, udpridpath, "S-1-5-18");
3310 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3312 error:
3313 DeleteFileA(msifile);
3314 DeleteFileA("msitest\\maximus");
3315 RemoveDirectoryA("msitest");
3316 HeapFree(GetProcessHeap(), 0, usersid);
3319 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
3321 DWORD len = 0;
3322 LPSTR val;
3323 LONG r;
3325 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
3326 if (r != ERROR_SUCCESS)
3327 return NULL;
3329 len += sizeof (WCHAR);
3330 val = HeapAlloc(GetProcessHeap(), 0, len);
3331 if (!val) return NULL;
3332 val[0] = 0;
3333 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
3334 return val;
3337 static void get_owner_company(LPSTR *owner, LPSTR *company)
3339 LONG res;
3340 HKEY hkey;
3341 REGSAM access = KEY_ALL_ACCESS;
3343 *owner = *company = NULL;
3345 if (is_wow64)
3346 access |= KEY_WOW64_64KEY;
3348 res = RegOpenKeyA(HKEY_CURRENT_USER,
3349 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
3350 if (res == ERROR_SUCCESS)
3352 *owner = reg_get_val_str(hkey, "DefName");
3353 *company = reg_get_val_str(hkey, "DefCompany");
3354 RegCloseKey(hkey);
3357 if (!*owner || !*company)
3359 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3360 "Software\\Microsoft\\Windows\\CurrentVersion", 0, access, &hkey);
3361 if (res == ERROR_SUCCESS)
3363 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3364 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3365 RegCloseKey(hkey);
3369 if (!*owner || !*company)
3371 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3372 "Software\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey);
3373 if (res == ERROR_SUCCESS)
3375 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3376 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3377 RegCloseKey(hkey);
3382 static void test_register_user(void)
3384 UINT r;
3385 LONG res;
3386 HKEY props;
3387 LPSTR usersid;
3388 LPSTR owner, company;
3389 CHAR keypath[MAX_PATH];
3390 REGSAM access = KEY_ALL_ACCESS;
3392 static const CHAR keypropsfmt[] =
3393 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3394 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
3395 static const CHAR keypridfmt[] =
3396 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3397 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3399 if (is_process_limited())
3401 skip("process is limited\n");
3402 return;
3405 if (!(usersid = get_user_sid()))
3406 return;
3408 get_owner_company(&owner, &company);
3410 CreateDirectoryA("msitest", NULL);
3411 create_file("msitest\\maximus", 500);
3413 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3415 if (is_wow64)
3416 access |= KEY_WOW64_64KEY;
3418 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3420 /* RegisterUser, per-user */
3421 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
3422 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3424 skip("Not enough rights to perform tests\n");
3425 goto error;
3427 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3428 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3429 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3431 sprintf(keypath, keypropsfmt, usersid);
3432 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3433 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3435 CHECK_REG_STR(props, "ProductID", "none");
3436 CHECK_REG_STR(props, "RegCompany", company);
3437 CHECK_REG_STR(props, "RegOwner", owner);
3439 RegDeleteValueA(props, "ProductID");
3440 RegDeleteValueA(props, "RegCompany");
3441 RegDeleteValueA(props, "RegOwner");
3442 delete_key(props, "", access);
3443 RegCloseKey(props);
3444 sprintf(keypath, keypridfmt, usersid);
3445 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3447 /* RegisterUser, machine */
3448 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3449 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3450 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3451 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3453 sprintf(keypath, keypropsfmt, "S-1-5-18");
3454 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3455 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3457 CHECK_REG_STR(props, "ProductID", "none");
3458 CHECK_REG_STR(props, "RegCompany", company);
3459 CHECK_REG_STR(props, "RegOwner", owner);
3461 RegDeleteValueA(props, "ProductID");
3462 RegDeleteValueA(props, "RegCompany");
3463 RegDeleteValueA(props, "RegOwner");
3464 delete_key(props, "", access);
3465 RegCloseKey(props);
3466 sprintf(keypath, keypridfmt, "S-1-5-18");
3467 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3469 error:
3470 HeapFree(GetProcessHeap(), 0, company);
3471 HeapFree(GetProcessHeap(), 0, owner);
3473 DeleteFileA(msifile);
3474 DeleteFileA("msitest\\maximus");
3475 RemoveDirectoryA("msitest");
3476 LocalFree(usersid);
3479 static void test_process_components(void)
3481 static const char keyfmt[] =
3482 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Components\\%s";
3483 static const char compkey[] =
3484 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3485 UINT r;
3486 LONG res;
3487 DWORD size;
3488 HKEY comp, hkey;
3489 LPSTR usersid;
3490 CHAR val[MAX_PATH];
3491 CHAR keypath[MAX_PATH];
3492 CHAR program_files_maximus[MAX_PATH];
3493 REGSAM access = KEY_ALL_ACCESS;
3495 if (is_process_limited())
3497 skip("process is limited\n");
3498 return;
3501 if (!(usersid = get_user_sid()))
3502 return;
3504 CreateDirectoryA("msitest", NULL);
3505 create_file("msitest\\maximus", 500);
3507 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3509 if (is_wow64)
3510 access |= KEY_WOW64_64KEY;
3512 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3514 /* ProcessComponents, per-user */
3515 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3516 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3518 skip("Not enough rights to perform tests\n");
3519 goto error;
3521 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3522 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3523 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3525 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3526 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3527 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3529 size = MAX_PATH;
3530 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3531 NULL, NULL, (LPBYTE)val, &size);
3532 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3534 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
3535 lstrcatA(program_files_maximus,"\\msitest\\maximus");
3537 ok(!lstrcmpiA(val, program_files_maximus),
3538 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3540 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3541 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3543 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3544 delete_key(comp, "", access);
3545 RegCloseKey(comp);
3547 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3548 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3549 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3551 size = MAX_PATH;
3552 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3553 NULL, NULL, (LPBYTE)val, &size);
3554 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3555 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3556 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3558 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3559 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3561 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3562 delete_key(comp, "", access);
3563 RegCloseKey(comp);
3565 /* ProcessComponents, machine */
3566 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3568 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3569 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3571 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3572 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3573 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3575 size = MAX_PATH;
3576 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3577 NULL, NULL, (LPBYTE)val, &size);
3578 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3579 ok(!lstrcmpiA(val, program_files_maximus),
3580 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3582 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3583 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3585 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3586 delete_key(comp, "", access);
3587 RegCloseKey(comp);
3589 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3590 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3591 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3593 size = MAX_PATH;
3594 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3595 NULL, NULL, (LPBYTE)val, &size);
3596 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3597 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3598 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3600 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3601 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3603 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3604 delete_key(comp, "", access);
3605 RegCloseKey(comp);
3607 error:
3608 DeleteFileA(msifile);
3609 DeleteFileA("msitest\\maximus");
3610 RemoveDirectoryA("msitest");
3611 LocalFree(usersid);
3614 static void test_publish(void)
3616 static const char subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3617 static const char subkey_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3618 UINT r;
3619 LONG res;
3620 HKEY uninstall, prodkey, uninstall_32node = NULL;
3621 INSTALLSTATE state;
3622 char date[MAX_PATH], temp[MAX_PATH], prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3623 REGSAM access = KEY_ALL_ACCESS;
3624 DWORD error;
3626 if (!pMsiQueryFeatureStateExA)
3628 win_skip("MsiQueryFeatureStateExA is not available\n");
3629 return;
3631 if (is_process_limited())
3633 skip("process is limited\n");
3634 return;
3637 get_date_str(date);
3638 GetTempPathA(MAX_PATH, temp);
3640 if (is_wow64)
3641 access |= KEY_WOW64_64KEY;
3643 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, KEY_ALL_ACCESS, &uninstall);
3644 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3646 if (is_64bit)
3648 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey_32node, 0, KEY_ALL_ACCESS, &uninstall_32node);
3649 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3652 CreateDirectoryA("msitest", NULL);
3653 create_file("msitest\\maximus", 500);
3655 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3657 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3659 state = MsiQueryProductStateA(prodcode);
3660 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3662 state = MsiQueryFeatureStateA(prodcode, "feature");
3663 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3665 state = 0xdead;
3666 SetLastError(0xdeadbeef);
3667 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3668 error = GetLastError();
3669 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3670 ok(state == 0xdead, "got %d\n", state);
3671 ok(error == 0xdeadbeef, "got %u\n", error);
3673 state = 0xdead;
3674 SetLastError(0xdeadbeef);
3675 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3676 error = GetLastError();
3677 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3678 ok(state == 0xdead, "got %d\n", state);
3679 ok(error == ERROR_SUCCESS, "got %u\n", error);
3681 state = 0xdead;
3682 SetLastError(0xdeadbeef);
3683 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3684 error = GetLastError();
3685 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3686 ok(state == 0xdead, "got %d\n", state);
3687 ok(error == ERROR_SUCCESS, "got %u\n", error);
3689 state = MsiQueryFeatureStateA(prodcode, "feature");
3690 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3692 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3693 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3695 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3696 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3697 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3698 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3700 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3701 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3703 /* nothing published */
3704 r = MsiInstallProductA(msifile, NULL);
3705 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3707 skip("Not enough rights to perform tests\n");
3708 goto error;
3710 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3711 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3712 ok(pf_exists("msitest"), "File not installed\n");
3714 state = MsiQueryProductStateA(prodcode);
3715 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3717 state = MsiQueryFeatureStateA(prodcode, "feature");
3718 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3720 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3721 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3723 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3724 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3725 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3726 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3728 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3729 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3731 /* PublishProduct and RegisterProduct */
3732 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3734 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3735 ok(pf_exists("msitest"), "File not installed\n");
3737 state = MsiQueryProductStateA(prodcode);
3738 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3740 state = MsiQueryFeatureStateA(prodcode, "feature");
3741 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3743 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3744 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3746 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3747 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3748 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3749 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3751 if (is_64bit)
3753 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3754 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3756 else
3758 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3759 if (is_wow64 && res == ERROR_FILE_NOT_FOUND) /* XP - Vista, Wow64 */
3760 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3761 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3764 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3765 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3766 CHECK_REG_STR(prodkey, "InstallDate", date);
3767 CHECK_REG_STR(prodkey, "InstallSource", temp);
3768 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3769 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3770 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3771 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3772 CHECK_REG_STR(prodkey, "Comments", NULL);
3773 CHECK_REG_STR(prodkey, "Contact", NULL);
3774 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3775 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3776 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3777 CHECK_REG_STR(prodkey, "Readme", NULL);
3778 CHECK_REG_STR(prodkey, "Size", NULL);
3779 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3780 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3781 CHECK_REG_DWORD(prodkey, "Language", 1033);
3782 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3783 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3784 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3785 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3786 todo_wine
3788 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3791 RegCloseKey(prodkey);
3793 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3794 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3795 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3796 ok(pf_exists("msitest"), "File deleted\n");
3798 state = MsiQueryProductStateA(prodcode);
3799 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3801 state = MsiQueryFeatureStateA(prodcode, "feature");
3802 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3804 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3805 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3807 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3808 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3809 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3810 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3812 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3813 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3815 /* complete install */
3816 r = MsiInstallProductA(msifile, "FULL=1");
3817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3818 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3819 ok(pf_exists("msitest"), "File not installed\n");
3821 state = MsiQueryProductStateA(prodcode);
3822 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3824 state = MsiQueryFeatureStateA(prodcode, "feature");
3825 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
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);
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);
3843 state = 0xdead;
3844 SetLastError(0xdeadbeef);
3845 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3846 error = GetLastError();
3847 ok(r == ERROR_SUCCESS, "got %u\n", r);
3848 ok(state == INSTALLSTATE_LOCAL, "got %d\n", state);
3849 ok(error == ERROR_SUCCESS, "got %u\n", error);
3851 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3852 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3854 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3855 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3857 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3859 if (is_64bit)
3861 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3862 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3864 else
3866 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3867 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3870 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3871 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3872 CHECK_REG_STR(prodkey, "InstallDate", date);
3873 CHECK_REG_STR(prodkey, "InstallSource", temp);
3874 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3875 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3876 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3877 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3878 CHECK_REG_STR(prodkey, "Comments", NULL);
3879 CHECK_REG_STR(prodkey, "Contact", NULL);
3880 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3881 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3882 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3883 CHECK_REG_STR(prodkey, "Readme", NULL);
3884 CHECK_REG_STR(prodkey, "Size", NULL);
3885 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3886 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3887 CHECK_REG_DWORD(prodkey, "Language", 1033);
3888 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3889 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3890 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3891 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3892 todo_wine
3894 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3897 RegCloseKey(prodkey);
3899 /* no UnpublishFeatures */
3900 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3901 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3902 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3903 ok(!pf_exists("msitest"), "Directory not deleted\n");
3905 state = MsiQueryProductStateA(prodcode);
3906 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3908 state = MsiQueryFeatureStateA(prodcode, "feature");
3909 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3911 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3912 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3914 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3915 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3916 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3917 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3919 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3920 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3922 /* complete install */
3923 r = MsiInstallProductA(msifile, "FULL=1");
3924 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3925 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3926 ok(pf_exists("msitest"), "File not installed\n");
3928 state = MsiQueryProductStateA(prodcode);
3929 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3931 state = MsiQueryFeatureStateA(prodcode, "feature");
3932 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3934 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3935 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3937 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3938 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3939 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3940 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3942 if (is_64bit)
3944 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3945 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3947 else
3949 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3950 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3953 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3954 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3955 CHECK_REG_STR(prodkey, "InstallDate", date);
3956 CHECK_REG_STR(prodkey, "InstallSource", temp);
3957 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3958 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3959 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3960 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3961 CHECK_REG_STR(prodkey, "Comments", NULL);
3962 CHECK_REG_STR(prodkey, "Contact", NULL);
3963 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3964 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3965 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3966 CHECK_REG_STR(prodkey, "Readme", NULL);
3967 CHECK_REG_STR(prodkey, "Size", NULL);
3968 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3969 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3970 CHECK_REG_DWORD(prodkey, "Language", 1033);
3971 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3972 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3973 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3974 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3975 todo_wine
3977 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3980 RegCloseKey(prodkey);
3982 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
3983 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
3984 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3985 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3986 ok(pf_exists("msitest"), "Directory deleted\n");
3988 state = MsiQueryProductStateA(prodcode);
3989 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3991 state = MsiQueryFeatureStateA(prodcode, "feature");
3992 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3994 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3995 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3997 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3998 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3999 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4000 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4002 if (is_64bit)
4004 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4005 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4007 else
4009 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4010 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4013 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4014 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4015 CHECK_REG_STR(prodkey, "InstallDate", date);
4016 CHECK_REG_STR(prodkey, "InstallSource", temp);
4017 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4018 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4019 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4020 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4021 CHECK_REG_STR(prodkey, "Comments", NULL);
4022 CHECK_REG_STR(prodkey, "Contact", NULL);
4023 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4024 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4025 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4026 CHECK_REG_STR(prodkey, "Readme", NULL);
4027 CHECK_REG_STR(prodkey, "Size", NULL);
4028 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4029 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4030 CHECK_REG_DWORD(prodkey, "Language", 1033);
4031 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4032 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4033 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4034 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4035 todo_wine
4037 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4040 RegCloseKey(prodkey);
4042 /* complete install */
4043 r = MsiInstallProductA(msifile, "FULL=1");
4044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4045 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4046 ok(pf_exists("msitest"), "File not installed\n");
4048 state = MsiQueryProductStateA(prodcode);
4049 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4051 state = MsiQueryFeatureStateA(prodcode, "feature");
4052 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4054 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4055 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4057 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4058 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4059 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4060 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4062 if (is_64bit)
4064 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4065 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4067 else
4069 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4070 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4073 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4074 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4075 CHECK_REG_STR(prodkey, "InstallDate", date);
4076 CHECK_REG_STR(prodkey, "InstallSource", temp);
4077 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4078 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4079 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4080 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4081 CHECK_REG_STR(prodkey, "Comments", NULL);
4082 CHECK_REG_STR(prodkey, "Contact", NULL);
4083 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4084 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4085 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4086 CHECK_REG_STR(prodkey, "Readme", NULL);
4087 CHECK_REG_STR(prodkey, "Size", NULL);
4088 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4089 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4090 CHECK_REG_DWORD(prodkey, "Language", 1033);
4091 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4092 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4093 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4094 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4095 todo_wine
4097 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -20, 10, 24);
4100 RegCloseKey(prodkey);
4102 /* UnpublishFeatures, both features removed */
4103 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
4104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4105 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4106 ok(!pf_exists("msitest"), "Directory not deleted\n");
4108 state = MsiQueryProductStateA(prodcode);
4109 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4111 state = MsiQueryFeatureStateA(prodcode, "feature");
4112 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4114 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4115 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4117 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4118 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4119 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4120 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4122 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4123 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4125 /* complete install */
4126 r = MsiInstallProductA(msifile, "FULL=1");
4127 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4128 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4129 ok(pf_exists("msitest"), "File not installed\n");
4131 state = MsiQueryProductStateA(prodcode);
4132 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4134 state = MsiQueryFeatureStateA(prodcode, "feature");
4135 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4137 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4138 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4140 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4141 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4142 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4143 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4145 if (is_64bit)
4147 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4148 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4150 else
4152 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4153 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4156 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4157 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4158 CHECK_REG_STR(prodkey, "InstallDate", date);
4159 CHECK_REG_STR(prodkey, "InstallSource", temp);
4160 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4161 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4162 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4163 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4164 CHECK_REG_STR(prodkey, "Comments", NULL);
4165 CHECK_REG_STR(prodkey, "Contact", NULL);
4166 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4167 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4168 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4169 CHECK_REG_STR(prodkey, "Readme", NULL);
4170 CHECK_REG_STR(prodkey, "Size", NULL);
4171 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4172 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4173 CHECK_REG_DWORD(prodkey, "Language", 1033);
4174 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4175 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4176 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4177 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4178 todo_wine
4180 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4183 RegCloseKey(prodkey);
4185 /* complete uninstall */
4186 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4188 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4189 ok(!pf_exists("msitest"), "Directory not deleted\n");
4191 state = MsiQueryProductStateA(prodcode);
4192 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4194 state = MsiQueryFeatureStateA(prodcode, "feature");
4195 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4197 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4198 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4200 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4201 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4202 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4203 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4205 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4206 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4208 /* make sure 'Program Files\msitest' is removed */
4209 delete_pfmsitest_files();
4211 error:
4212 RegCloseKey(uninstall);
4213 RegCloseKey(uninstall_32node);
4214 DeleteFileA(msifile);
4215 DeleteFileA("msitest\\maximus");
4216 RemoveDirectoryA("msitest");
4219 static void test_publish_sourcelist(void)
4221 UINT r;
4222 DWORD size;
4223 CHAR value[MAX_PATH];
4224 CHAR path[MAX_PATH];
4225 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4227 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
4229 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
4230 return;
4232 if (is_process_limited())
4234 skip("process is limited\n");
4235 return;
4238 CreateDirectoryA("msitest", NULL);
4239 create_file("msitest\\maximus", 500);
4241 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4243 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4245 r = MsiInstallProductA(msifile, NULL);
4246 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4248 skip("Not enough rights to perform tests\n");
4249 goto error;
4251 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4252 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4253 ok(pf_exists("msitest"), "File not installed\n");
4255 /* nothing published */
4256 size = MAX_PATH;
4257 lstrcpyA(value, "aaa");
4258 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4259 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4260 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4261 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4262 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4264 size = MAX_PATH;
4265 lstrcpyA(value, "aaa");
4266 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4267 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4268 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4269 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4270 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4272 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
4273 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4274 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4275 ok(pf_exists("msitest"), "File not installed\n");
4277 /* after RegisterProduct */
4278 size = MAX_PATH;
4279 lstrcpyA(value, "aaa");
4280 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4281 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4282 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4283 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4284 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4286 size = MAX_PATH;
4287 lstrcpyA(value, "aaa");
4288 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4289 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4290 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4291 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4292 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4294 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4295 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4296 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4297 ok(pf_exists("msitest"), "File not installed\n");
4299 /* after ProcessComponents */
4300 size = MAX_PATH;
4301 lstrcpyA(value, "aaa");
4302 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4303 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4304 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4305 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4306 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4308 size = MAX_PATH;
4309 lstrcpyA(value, "aaa");
4310 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4311 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4312 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4313 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4314 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4316 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4317 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4318 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4319 ok(pf_exists("msitest"), "File not installed\n");
4321 /* after PublishFeatures */
4322 size = MAX_PATH;
4323 lstrcpyA(value, "aaa");
4324 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4325 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4326 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4327 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4328 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4330 size = MAX_PATH;
4331 lstrcpyA(value, "aaa");
4332 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4333 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4334 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4335 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4336 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4338 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
4339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4340 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4341 ok(pf_exists("msitest"), "File not installed\n");
4343 /* after PublishProduct */
4344 size = MAX_PATH;
4345 lstrcpyA(value, "aaa");
4346 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4347 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4348 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4349 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
4350 ok(size == 11, "Expected 11, got %d\n", size);
4352 size = MAX_PATH;
4353 lstrcpyA(value, "aaa");
4354 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4355 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size);
4356 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4357 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4358 ok(size == 0, "Expected 0, got %d\n", size);
4360 size = MAX_PATH;
4361 lstrcpyA(value, "aaa");
4362 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4363 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size);
4364 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4365 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4366 ok(size == 0, "Expected 0, got %d\n", size);
4368 lstrcpyA(path, CURR_DIR);
4369 lstrcatA(path, "\\");
4371 size = MAX_PATH;
4372 lstrcpyA(value, "aaa");
4373 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4374 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size);
4375 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4376 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4377 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4379 size = MAX_PATH;
4380 lstrcpyA(value, "aaa");
4381 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4382 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size);
4383 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4384 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
4385 ok(size == 1, "Expected 1, got %d\n", size);
4387 size = MAX_PATH;
4388 lstrcpyA(value, "aaa");
4389 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4390 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4391 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4392 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4393 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4395 size = MAX_PATH;
4396 lstrcpyA(value, "aaa");
4397 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4398 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
4399 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4400 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4401 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4403 size = MAX_PATH;
4404 lstrcpyA(value, "aaa");
4405 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4406 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
4407 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4408 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4409 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4411 /* complete uninstall */
4412 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4413 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4414 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4415 ok(!pf_exists("msitest"), "Directory not deleted\n");
4417 /* make sure 'Program Files\msitest' is removed */
4418 delete_pfmsitest_files();
4420 error:
4421 DeleteFileA(msifile);
4422 DeleteFileA("msitest\\maximus");
4423 RemoveDirectoryA("msitest");
4426 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4428 CHAR path[MAX_PATH];
4430 lstrcpyA(path, PROG_FILES_DIR);
4431 lstrcatA(path, "\\");
4432 lstrcatA(path, file);
4434 if (is_file)
4435 create_file_data(path, data, 500);
4436 else
4437 CreateDirectoryA(path, NULL);
4440 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4442 static void test_remove_files(void)
4444 UINT r;
4446 if (is_process_limited())
4448 skip("process is limited\n");
4449 return;
4452 CreateDirectoryA("msitest", NULL);
4453 create_file("msitest\\hydrogen", 500);
4454 create_file("msitest\\helium", 500);
4455 create_file("msitest\\lithium", 500);
4457 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4459 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4461 r = MsiInstallProductA(msifile, NULL);
4462 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4464 skip("Not enough rights to perform tests\n");
4465 goto error;
4467 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4468 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4469 ok(!pf_exists("msitest\\helium"), "File installed\n");
4470 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4471 ok(pf_exists("msitest"), "File not installed\n");
4473 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4474 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4475 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4476 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4477 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4478 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4480 create_pf("msitest", FALSE);
4481 create_pf("msitest\\hydrogen", TRUE);
4482 create_pf("msitest\\helium", TRUE);
4483 create_pf("msitest\\lithium", TRUE);
4485 r = MsiInstallProductA(msifile, NULL);
4486 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4487 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4488 ok(pf_exists("msitest\\helium"), "File not installed\n");
4489 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4490 ok(pf_exists("msitest"), "File not installed\n");
4492 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4494 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4495 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4496 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4497 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4499 create_pf("msitest", FALSE);
4500 create_pf("msitest\\furlong", TRUE);
4501 create_pf("msitest\\firkin", TRUE);
4502 create_pf("msitest\\fortnight", TRUE);
4503 create_pf("msitest\\becquerel", TRUE);
4504 create_pf("msitest\\dioptre", TRUE);
4505 create_pf("msitest\\attoparsec", TRUE);
4506 create_pf("msitest\\storeys", TRUE);
4507 create_pf("msitest\\block", TRUE);
4508 create_pf("msitest\\siriometer", TRUE);
4509 create_pf("msitest\\cabout", FALSE);
4510 create_pf("msitest\\cabout\\blocker", TRUE);
4512 r = MsiInstallProductA(msifile, NULL);
4513 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4514 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4515 ok(!pf_exists("msitest\\helium"), "File installed\n");
4516 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4517 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4518 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4519 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4520 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4521 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4522 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4523 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4524 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4525 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4526 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
4527 ok(pf_exists("msitest"), "File not installed\n");
4529 create_pf("msitest\\furlong", TRUE);
4530 create_pf("msitest\\firkin", TRUE);
4531 create_pf("msitest\\fortnight", TRUE);
4532 create_pf("msitest\\storeys", TRUE);
4533 create_pf("msitest\\block", TRUE);
4534 create_pf("msitest\\siriometer", TRUE);
4536 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4537 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4538 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4539 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4540 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4541 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4542 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4543 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4544 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4545 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4546 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4547 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4548 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4549 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4550 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4551 ok(pf_exists("msitest"), "Directory deleted\n");
4553 r = MsiInstallProductA(msifile, NULL);
4554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4555 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
4556 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
4557 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
4558 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4559 ok(pf_exists("msitest"), "Directory deleted\n");
4561 delete_pf("msitest\\cabout\\blocker", TRUE);
4563 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4565 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
4566 delete_pf("msitest", FALSE);
4568 error:
4569 DeleteFileA(msifile);
4570 DeleteFileA("msitest\\hydrogen");
4571 DeleteFileA("msitest\\helium");
4572 DeleteFileA("msitest\\lithium");
4573 RemoveDirectoryA("msitest");
4576 static void test_move_files(void)
4578 UINT r;
4579 char props[MAX_PATH];
4581 if (is_process_limited())
4583 skip("process is limited\n");
4584 return;
4587 CreateDirectoryA("msitest", NULL);
4588 create_file("msitest\\augustus", 100);
4589 create_file("cameroon", 100);
4590 create_file("djibouti", 100);
4591 create_file("egypt", 100);
4592 create_file("finland", 100);
4593 create_file("gambai", 100);
4594 create_file("honduras", 100);
4595 create_file("msitest\\india", 100);
4596 create_file("japan", 100);
4597 create_file("kenya", 100);
4598 CreateDirectoryA("latvia", NULL);
4599 create_file("nauru", 100);
4600 create_file("peru", 100);
4601 create_file("apple", 100);
4602 create_file("application", 100);
4603 create_file("ape", 100);
4604 create_file("foo", 100);
4605 create_file("fao", 100);
4606 create_file("fbod", 100);
4607 create_file("budding", 100);
4608 create_file("buddy", 100);
4609 create_file("bud", 100);
4610 create_file("bar", 100);
4611 create_file("bur", 100);
4612 create_file("bird", 100);
4614 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4616 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4618 /* if the source or dest property is not a full path,
4619 * windows tries to access it as a network resource
4622 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4623 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4624 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4626 r = MsiInstallProductA(msifile, props);
4627 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4629 skip("Not enough rights to perform tests\n");
4630 goto error;
4632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4633 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4634 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4635 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4636 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4637 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4638 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4639 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4640 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4641 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4642 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4643 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4644 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4645 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4646 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
4647 /* either apple or application will be moved depending on directory order */
4648 if (!delete_pf("msitest\\apple", TRUE))
4649 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4650 else
4651 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4652 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4653 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4654 /* either fao or foo will be moved depending on directory order */
4655 if (delete_pf("msitest\\foo", TRUE))
4656 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4657 else
4658 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4659 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4660 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4661 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4662 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4663 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4664 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4665 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4666 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4667 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4668 ok(DeleteFileA("cameroon"), "File moved\n");
4669 ok(!DeleteFileA("djibouti"), "File not moved\n");
4670 ok(DeleteFileA("egypt"), "File moved\n");
4671 ok(DeleteFileA("finland"), "File moved\n");
4672 ok(DeleteFileA("gambai"), "File moved\n");
4673 ok(!DeleteFileA("honduras"), "File not moved\n");
4674 ok(DeleteFileA("msitest\\india"), "File moved\n");
4675 ok(DeleteFileA("japan"), "File moved\n");
4676 ok(!DeleteFileA("kenya"), "File not moved\n");
4677 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4678 ok(!DeleteFileA("nauru"), "File not moved\n");
4679 ok(!DeleteFileA("peru"), "File not moved\n");
4680 ok(!DeleteFileA("apple"), "File not moved\n");
4681 ok(!DeleteFileA("application"), "File not moved\n");
4682 ok(DeleteFileA("ape"), "File moved\n");
4683 ok(!DeleteFileA("foo"), "File not moved\n");
4684 ok(!DeleteFileA("fao"), "File not moved\n");
4685 ok(DeleteFileA("fbod"), "File moved\n");
4686 ok(!DeleteFileA("budding"), "File not moved\n");
4687 ok(!DeleteFileA("buddy"), "File not moved\n");
4688 ok(DeleteFileA("bud"), "File moved\n");
4689 ok(!DeleteFileA("bar"), "File not moved\n");
4690 ok(!DeleteFileA("bur"), "File not moved\n");
4691 ok(DeleteFileA("bird"), "File moved\n");
4693 error:
4694 DeleteFileA("cameroon");
4695 DeleteFileA("djibouti");
4696 DeleteFileA("egypt");
4697 DeleteFileA("finland");
4698 DeleteFileA("gambai");
4699 DeleteFileA("honduras");
4700 DeleteFileA("japan");
4701 DeleteFileA("kenya");
4702 DeleteFileA("nauru");
4703 DeleteFileA("peru");
4704 DeleteFileA("apple");
4705 DeleteFileA("application");
4706 DeleteFileA("ape");
4707 DeleteFileA("foo");
4708 DeleteFileA("fao");
4709 DeleteFileA("fbod");
4710 DeleteFileA("budding");
4711 DeleteFileA("buddy");
4712 DeleteFileA("bud");
4713 DeleteFileA("bar");
4714 DeleteFileA("bur");
4715 DeleteFileA("bird");
4716 DeleteFileA("msitest\\india");
4717 DeleteFileA("msitest\\augustus");
4718 RemoveDirectoryA("latvia");
4719 RemoveDirectoryA("msitest");
4720 DeleteFileA(msifile);
4723 static void test_duplicate_files(void)
4725 UINT r;
4727 if (is_process_limited())
4729 skip("process is limited\n");
4730 return;
4733 CreateDirectoryA("msitest", NULL);
4734 create_file("msitest\\maximus", 500);
4735 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4737 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4739 /* fails if the destination folder is not a valid property */
4741 r = MsiInstallProductA(msifile, NULL);
4742 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4744 skip("Not enough rights to perform tests\n");
4745 goto error;
4747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4748 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4749 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4750 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4751 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "Directory not created\n");
4752 ok(delete_pf("msitest\\this\\doesnot", FALSE), "Directory not created\n");
4753 ok(delete_pf("msitest\\this", FALSE), "Directory not created\n");
4754 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4756 error:
4757 DeleteFileA("msitest\\maximus");
4758 RemoveDirectoryA("msitest");
4759 DeleteFileA(msifile);
4762 static void test_write_registry_values(void)
4764 UINT r;
4765 LONG res;
4766 HKEY hkey;
4767 DWORD type, size;
4768 CHAR path[MAX_PATH];
4770 if (is_process_limited())
4772 skip("process is limited\n");
4773 return;
4776 CreateDirectoryA("msitest", NULL);
4777 create_file("msitest\\augustus", 500);
4779 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4781 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4783 if (is_64bit)
4784 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, NULL, 0,
4785 KEY_ALL_ACCESS, NULL, &hkey, NULL);
4786 else
4787 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, NULL, 0, KEY_ALL_ACCESS,
4788 NULL, &hkey, NULL);
4789 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4791 res = RegSetValueExA(hkey, "Value1", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4792 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4793 res = RegSetValueExA(hkey, "Value2", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4794 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4795 res = RegSetValueExA(hkey, "Value3", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4796 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4797 res = RegSetValueExA(hkey, "Value4", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4798 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4799 res = RegSetValueExA(hkey, "Value5", 0, REG_MULTI_SZ, (const BYTE *)"one\0two\0", 9);
4800 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4801 res = RegSetValueExA(hkey, "Value6", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4802 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4803 res = RegSetValueExA(hkey, "Value7", 0, REG_SZ, (const BYTE *)"one", 4);
4804 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4805 RegCloseKey(hkey);
4807 r = MsiInstallProductA(msifile, NULL);
4808 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4810 skip("Not enough rights to perform tests\n");
4811 goto error;
4813 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4814 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4815 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4817 if (is_64bit)
4818 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4819 else
4820 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4821 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4823 size = MAX_PATH;
4824 type = 0xdeadbeef;
4825 memset(path, 'a', MAX_PATH);
4826 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
4827 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4828 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
4829 ok(size == 15, "Expected 15, got %d\n", size);
4830 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4832 res = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL);
4833 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4835 res = action_RegDeleteTreeA(hkey, "VisualStudio", KEY_ALL_ACCESS);
4836 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4838 size = MAX_PATH;
4839 type = 0xdeadbeef;
4840 memset(path, 'a', MAX_PATH);
4841 res = RegQueryValueExA(hkey, "Value1", NULL, &type, (LPBYTE)path, &size);
4842 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4843 ok(!memcmp(path, "one\0", size), "Wrong multi-sz data\n");
4844 ok(size == 5, "Expected 5, got %d\n", size);
4845 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4847 size = MAX_PATH;
4848 type = 0xdeadbeef;
4849 memset(path, 'a', MAX_PATH);
4850 res = RegQueryValueExA(hkey, "Value2", NULL, &type, (LPBYTE)path, &size);
4851 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4852 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
4853 ok(size == 9, "Expected 9, got %d\n", size);
4854 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4856 size = MAX_PATH;
4857 type = 0xdeadbeef;
4858 memset(path, 'a', MAX_PATH);
4859 res = RegQueryValueExA(hkey, "Value3", NULL, &type, (LPBYTE)path, &size);
4860 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4861 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
4862 ok(size == 9, "Expected 9, got %d\n", size);
4863 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4865 size = MAX_PATH;
4866 type = 0xdeadbeef;
4867 memset(path, 'a', MAX_PATH);
4868 res = RegQueryValueExA(hkey, "Value4", NULL, &type, (LPBYTE)path, &size);
4869 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4870 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
4871 ok(size == 9, "Expected 9, got %d\n", size);
4872 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4874 size = MAX_PATH;
4875 type = 0xdeadbeef;
4876 memset(path, 'a', MAX_PATH);
4877 res = RegQueryValueExA(hkey, "Value5", NULL, &type, (LPBYTE)path, &size);
4878 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4879 ok(!memcmp(path, "one\0two\0three\0", size), "Wrong multi-sz data\n");
4880 ok(size == 15, "Expected 15, got %d\n", size);
4881 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4883 size = MAX_PATH;
4884 type = 0xdeadbeef;
4885 memset(path, 'a', MAX_PATH);
4886 res = RegQueryValueExA(hkey, "Value6", NULL, &type, (LPBYTE)path, &size);
4887 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4888 ok(!memcmp(path, "", size), "Wrong multi-sz data\n");
4889 ok(size == 1, "Expected 1, got %d\n", size);
4890 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4892 size = MAX_PATH;
4893 type = 0xdeadbeef;
4894 memset(path, 'a', MAX_PATH);
4895 res = RegQueryValueExA(hkey, "Value7", NULL, &type, (LPBYTE)path, &size);
4896 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4897 ok(!memcmp(path, "two\0", size), "Wrong multi-sz data\n");
4898 ok(size == 5, "Expected 5, got %d\n", size);
4899 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4901 RegDeleteValueA(hkey, "Value");
4902 RegDeleteValueA(hkey, "Value1");
4903 RegDeleteValueA(hkey, "Value2");
4904 RegDeleteValueA(hkey, "Value3");
4905 RegDeleteValueA(hkey, "Value4");
4906 RegDeleteValueA(hkey, "Value5");
4907 RegDeleteValueA(hkey, "Value6");
4908 RegDeleteValueA(hkey, "Value7");
4909 RegCloseKey(hkey);
4910 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
4912 error:
4913 DeleteFileA(msifile);
4914 DeleteFileA("msitest\\augustus");
4915 RemoveDirectoryA("msitest");
4918 static void test_envvar(void)
4920 static const char *results[] =
4922 "1;2", /* MSITESTVAR11 */
4923 "1", /* MSITESTVAR12 */
4924 "1;2", /* MSITESTVAR13 */
4925 ";1;", /* MSITESTVAR14 */
4926 ";;1;;", /* MSITESTVAR15 */
4927 " 1 ", /* MSITESTVAR16 */
4928 ";;2;;1", /* MSITESTVAR17 */
4929 "1;;2;;", /* MSITESTVAR18 */
4930 "1", /* MSITESTVAR19 */
4931 "1", /* MSITESTVAR20 */
4932 NULL
4934 UINT r;
4935 HKEY env;
4936 LONG res;
4937 DWORD type, size;
4938 char buffer[16];
4939 UINT i;
4941 if (is_process_limited())
4943 skip("process is limited\n");
4944 return;
4947 create_test_files();
4948 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
4950 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
4951 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4953 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
4954 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4956 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
4957 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4959 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4961 r = MsiInstallProductA(msifile, NULL);
4962 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4964 skip("Not enough rights to perform tests\n");
4965 goto error;
4967 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4969 type = REG_NONE;
4970 size = sizeof(buffer);
4971 buffer[0] = 0;
4972 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
4973 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4974 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
4975 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
4977 res = RegDeleteValueA(env, "MSITESTVAR1");
4978 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4980 type = REG_NONE;
4981 size = sizeof(buffer);
4982 buffer[0] = 0;
4983 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
4984 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4985 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
4986 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
4988 res = RegDeleteValueA(env, "MSITESTVAR2");
4989 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4991 res = RegDeleteValueA(env, "MSITESTVAR3");
4992 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4994 res = RegDeleteValueA(env, "MSITESTVAR4");
4995 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4997 res = RegDeleteValueA(env, "MSITESTVAR5");
4998 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5000 res = RegDeleteValueA(env, "MSITESTVAR6");
5001 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5003 res = RegDeleteValueA(env, "MSITESTVAR7");
5004 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5006 res = RegDeleteValueA(env, "MSITESTVAR8");
5007 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5009 res = RegDeleteValueA(env, "MSITESTVAR9");
5010 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5012 res = RegDeleteValueA(env, "MSITESTVAR10");
5013 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5015 i = 11;
5016 while (results[i - 11])
5018 char name[20];
5019 sprintf(name, "MSITESTVAR%d", i);
5021 type = REG_NONE;
5022 size = sizeof(buffer);
5023 buffer[0] = 0;
5024 res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size);
5025 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5026 ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
5027 ok(!lstrcmpA(buffer, results[i - 11]), "%d: Expected %s, got %s\n", i, results[i - 11], buffer);
5029 res = RegDeleteValueA(env, name);
5030 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5031 i++;
5034 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
5035 delete_pf("msitest\\cabout\\new", FALSE);
5036 delete_pf("msitest\\cabout\\four.txt", TRUE);
5037 delete_pf("msitest\\cabout", FALSE);
5038 delete_pf("msitest\\changed\\three.txt", TRUE);
5039 delete_pf("msitest\\changed", FALSE);
5040 delete_pf("msitest\\first\\two.txt", TRUE);
5041 delete_pf("msitest\\first", FALSE);
5042 delete_pf("msitest\\filename", TRUE);
5043 delete_pf("msitest\\one.txt", TRUE);
5044 delete_pf("msitest\\service.exe", TRUE);
5045 delete_pf("msitest\\service2.exe", TRUE);
5046 delete_pf("msitest", FALSE);
5048 error:
5049 RegDeleteValueA(env, "MSITESTVAR1");
5050 RegDeleteValueA(env, "MSITESTVAR2");
5051 RegCloseKey(env);
5053 delete_test_files();
5054 DeleteFileA(msifile);
5057 static void test_create_remove_folder(void)
5059 UINT r;
5061 if (is_process_limited())
5063 skip("process is limited\n");
5064 return;
5067 CreateDirectoryA("msitest", NULL);
5068 CreateDirectoryA("msitest\\first", NULL);
5069 CreateDirectoryA("msitest\\second", NULL);
5070 create_file("msitest\\first\\one.txt", 1000);
5071 create_file("msitest\\second\\two.txt", 1000);
5072 create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
5074 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5076 r = MsiInstallProductA(msifile, NULL);
5077 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5079 skip("Not enough rights to perform tests\n");
5080 goto error;
5082 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5084 ok(pf_exists("msitest\\first\\one.txt"), "file not installed\n");
5085 ok(pf_exists("msitest\\first"), "directory not created\n");
5086 ok(pf_exists("msitest\\second\\two.txt"), "file not installed\n");
5087 ok(pf_exists("msitest\\second"), "directory not created\n");
5088 ok(pf_exists("msitest\\third"), "directory not created\n");
5089 ok(pf_exists("msitest"), "directory not created\n");
5091 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5092 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5094 ok(!pf_exists("msitest\\first\\one.txt"), "file not removed\n");
5095 ok(!pf_exists("msitest\\first"), "directory not removed\n");
5096 ok(!pf_exists("msitest\\second\\two.txt"), "file not removed\n");
5097 ok(!pf_exists("msitest\\second"), "directory not removed\n");
5098 ok(!pf_exists("msitest\\third"), "directory not removed\n");
5099 todo_wine ok(!pf_exists("msitest"), "directory not removed\n");
5101 error:
5102 DeleteFileA("msitest\\first\\one.txt");
5103 DeleteFileA("msitest\\second\\two.txt");
5104 RemoveDirectoryA("msitest\\first");
5105 RemoveDirectoryA("msitest\\second");
5106 RemoveDirectoryA("msitest");
5107 DeleteFileA(msifile);
5110 static void test_start_services(void)
5112 UINT r;
5113 SC_HANDLE scm, service;
5114 BOOL ret;
5115 DWORD error = ERROR_SUCCESS;
5117 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5118 if (!scm && GetLastError() == ERROR_ACCESS_DENIED)
5120 skip("Not enough rights to perform tests\n");
5121 return;
5123 ok(scm != NULL, "Failed to open the SC Manager\n");
5124 if (!scm) return;
5126 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5127 if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
5129 win_skip("The 'Spooler' service does not exist\n");
5130 CloseServiceHandle(scm);
5131 return;
5133 ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
5134 if (!service) {
5135 CloseServiceHandle(scm);
5136 return;
5139 ret = StartServiceA(service, 0, NULL);
5140 if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
5142 skip("Spooler service not available, skipping test\n");
5143 CloseServiceHandle(service);
5144 CloseServiceHandle(scm);
5145 return;
5148 CloseServiceHandle(service);
5149 CloseServiceHandle(scm);
5151 create_test_files();
5152 create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
5154 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5156 r = MsiInstallProductA(msifile, NULL);
5157 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5159 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5160 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5161 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5162 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5163 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5164 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5165 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5166 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5167 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5168 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5169 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5170 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5171 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5173 delete_test_files();
5174 DeleteFileA(msifile);
5176 if (error == ERROR_SUCCESS)
5178 SERVICE_STATUS status;
5180 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5181 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5183 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
5184 ok(ret, "ControlService failed %u\n", GetLastError());
5186 CloseServiceHandle(service);
5187 CloseServiceHandle(scm);
5191 static void test_delete_services(void)
5193 UINT r;
5194 SC_HANDLE manager, service;
5195 DWORD error;
5197 if (is_process_limited())
5199 skip("process is limited\n");
5200 return;
5203 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5204 ok(manager != NULL, "can't open service manager %u\n", GetLastError());
5205 if (!manager) return;
5207 service = CreateServiceA(manager, "TestService3", "TestService3",
5208 SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START,
5209 SERVICE_ERROR_NORMAL, "C:\\doesnt_exist.exe", NULL, NULL, NULL, NULL, NULL);
5210 ok(service != NULL, "can't create service %u\n", GetLastError());
5211 CloseServiceHandle(service);
5212 CloseServiceHandle(manager);
5213 if (!service) goto error;
5215 create_test_files();
5216 create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
5218 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5220 r = MsiInstallProductA(msifile, NULL);
5221 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5223 skip("Not enough rights to perform tests\n");
5224 goto error;
5226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5228 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5229 ok(manager != NULL, "can't open service manager\n");
5230 if (!manager) goto error;
5232 service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
5233 error = GetLastError();
5234 ok(service == NULL, "TestService3 not deleted\n");
5235 ok(error == ERROR_SERVICE_DOES_NOT_EXIST, "wrong error %u\n", error);
5236 CloseServiceHandle(manager);
5238 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5241 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5242 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5243 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5244 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5245 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5246 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5247 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5248 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5249 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5250 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5251 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5252 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5253 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5255 error:
5256 delete_test_files();
5257 DeleteFileA(msifile);
5260 static void test_self_registration(void)
5262 UINT r;
5264 if (is_process_limited())
5266 skip("process is limited\n");
5267 return;
5270 create_test_files();
5271 create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
5273 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5275 r = MsiInstallProductA(msifile, NULL);
5276 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5278 skip("Not enough rights to perform tests\n");
5279 goto error;
5281 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5283 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5284 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5285 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5286 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5287 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5288 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5289 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5290 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5291 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5292 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5293 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5294 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5295 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5297 error:
5298 delete_test_files();
5299 DeleteFileA(msifile);
5302 static void test_register_font(void)
5304 static const char regfont1[] = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
5305 static const char regfont2[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Fonts";
5306 LONG ret;
5307 HKEY key;
5308 UINT r;
5309 REGSAM access = KEY_ALL_ACCESS;
5311 if (is_process_limited())
5313 skip("process is limited\n");
5314 return;
5317 create_test_files();
5318 create_file("msitest\\font.ttf", 1000);
5319 create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table));
5321 if (is_wow64)
5322 access |= KEY_WOW64_64KEY;
5324 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5326 r = MsiInstallProductA(msifile, NULL);
5327 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5329 skip("Not enough rights to perform tests\n");
5330 goto error;
5332 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5334 ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont1, 0, access, &key);
5335 if (ret)
5336 RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont2, 0, access, &key);
5338 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5339 ok(ret != ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5341 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5342 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5344 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5346 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5347 ok(ret == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5349 RegDeleteValueA(key, "msi test font");
5350 RegCloseKey(key);
5352 error:
5353 DeleteFileA("msitest\\font.ttf");
5354 delete_test_files();
5355 DeleteFileA(msifile);
5358 static void test_validate_product_id(void)
5360 UINT r;
5362 if (is_process_limited())
5364 skip("process is limited\n");
5365 return;
5368 create_test_files();
5369 create_database(msifile, vp_tables, sizeof(vp_tables) / sizeof(msi_table));
5371 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5373 r = MsiInstallProductA(msifile, NULL);
5374 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5376 skip("Not enough rights to perform tests\n");
5377 goto error;
5379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5381 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=1");
5382 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5384 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=2");
5385 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5387 r = MsiInstallProductA(msifile, "PIDKEY=123-1234567");
5388 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5390 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5391 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5392 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5393 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5394 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5395 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5396 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5397 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5398 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5399 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5400 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5401 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5402 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5404 error:
5405 delete_test_files();
5406 DeleteFileA(msifile);
5409 static void test_install_remove_odbc(void)
5411 UINT r;
5413 if (is_process_limited())
5415 skip("process is limited\n");
5416 return;
5419 create_test_files();
5420 create_file("msitest\\ODBCdriver.dll", 1000);
5421 create_file("msitest\\ODBCdriver2.dll", 1000);
5422 create_file("msitest\\ODBCtranslator.dll", 1000);
5423 create_file("msitest\\ODBCtranslator2.dll", 1000);
5424 create_file("msitest\\ODBCsetup.dll", 1000);
5425 create_database(msifile, odbc_tables, sizeof(odbc_tables) / sizeof(msi_table));
5427 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5429 r = MsiInstallProductA(msifile, NULL);
5430 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5432 skip("Not enough rights to perform tests\n");
5433 goto error;
5435 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5437 ok(pf_exists("msitest\\ODBCdriver.dll"), "file not created\n");
5438 ok(pf_exists("msitest\\ODBCdriver2.dll"), "file not created\n");
5439 ok(pf_exists("msitest\\ODBCtranslator.dll"), "file not created\n");
5440 ok(pf_exists("msitest\\ODBCtranslator2.dll"), "file not created\n");
5441 ok(pf_exists("msitest\\ODBCsetup.dll"), "file not created\n");
5443 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5444 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5446 ok(!delete_pf("msitest\\ODBCdriver.dll", TRUE), "file not removed\n");
5447 ok(!delete_pf("msitest\\ODBCdriver2.dll", TRUE), "file not removed\n");
5448 ok(!delete_pf("msitest\\ODBCtranslator.dll", TRUE), "file not removed\n");
5449 ok(!delete_pf("msitest\\ODBCtranslator2.dll", TRUE), "file not removed\n");
5450 ok(!delete_pf("msitest\\ODBCsetup.dll", TRUE), "file not removed\n");
5451 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5453 error:
5454 DeleteFileA("msitest\\ODBCdriver.dll");
5455 DeleteFileA("msitest\\ODBCdriver2.dll");
5456 DeleteFileA("msitest\\ODBCtranslator.dll");
5457 DeleteFileA("msitest\\ODBCtranslator2.dll");
5458 DeleteFileA("msitest\\ODBCsetup.dll");
5459 delete_test_files();
5460 DeleteFileA(msifile);
5463 static void test_register_typelib(void)
5465 UINT r;
5467 if (is_process_limited())
5469 skip("process is limited\n");
5470 return;
5473 create_test_files();
5474 create_file("msitest\\typelib.dll", 1000);
5475 create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
5477 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5479 r = MsiInstallProductA(msifile, "REGISTER_TYPELIB=1");
5480 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5482 skip("Not enough rights to perform tests\n");
5483 goto error;
5485 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5487 r = MsiInstallProductA(msifile, NULL);
5488 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5490 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5491 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5493 ok(!delete_pf("msitest\\typelib.dll", TRUE), "file not removed\n");
5494 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5496 error:
5497 DeleteFileA("msitest\\typelib.dll");
5498 delete_test_files();
5499 DeleteFileA(msifile);
5502 static void test_create_remove_shortcut(void)
5504 UINT r;
5506 if (is_process_limited())
5508 skip("process is limited\n");
5509 return;
5512 create_test_files();
5513 create_file("msitest\\target.txt", 1000);
5514 create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
5516 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5518 r = MsiInstallProductA(msifile, NULL);
5519 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5521 skip("Not enough rights to perform tests\n");
5522 goto error;
5524 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5526 ok(pf_exists("msitest\\target.txt"), "file not created\n");
5527 ok(pf_exists("msitest\\shortcut.lnk"), "file not created\n");
5529 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5532 ok(!delete_pf("msitest\\shortcut.lnk", TRUE), "file not removed\n");
5533 ok(!delete_pf("msitest\\target.txt", TRUE), "file not removed\n");
5534 todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5536 error:
5537 DeleteFileA("msitest\\target.txt");
5538 delete_test_files();
5539 DeleteFileA(msifile);
5542 static void test_publish_components(void)
5544 static char keypath[] =
5545 "Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
5547 UINT r;
5548 LONG res;
5549 HKEY key;
5551 if (is_process_limited())
5553 skip("process is limited\n");
5554 return;
5557 create_test_files();
5558 create_file("msitest\\english.txt", 1000);
5559 create_database(msifile, pub_tables, sizeof(pub_tables) / sizeof(msi_table));
5561 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5563 r = MsiInstallProductA(msifile, NULL);
5564 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5566 skip("Not enough rights to perform tests\n");
5567 goto error;
5569 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5571 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5572 ok(res == ERROR_SUCCESS, "components key not created %d\n", res);
5574 res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, NULL);
5575 ok(res == ERROR_SUCCESS, "value not found %d\n", res);
5576 RegCloseKey(key);
5578 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5579 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5581 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5582 ok(res == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", res);
5584 ok(!delete_pf("msitest\\english.txt", TRUE), "file not removed\n");
5585 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5587 error:
5588 DeleteFileA("msitest\\english.txt");
5589 delete_test_files();
5590 DeleteFileA(msifile);
5593 static void test_remove_duplicate_files(void)
5595 UINT r;
5597 if (is_process_limited())
5599 skip("process is limited\n");
5600 return;
5603 create_test_files();
5604 create_file("msitest\\original.txt", 1000);
5605 create_file("msitest\\original2.txt", 1000);
5606 create_file("msitest\\original3.txt", 1000);
5607 create_database(msifile, rd_tables, sizeof(rd_tables) / sizeof(msi_table));
5609 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5611 r = MsiInstallProductA(msifile, NULL);
5612 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5614 skip("Not enough rights to perform tests\n");
5615 goto error;
5617 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5619 ok(pf_exists("msitest\\original.txt"), "file not created\n");
5620 ok(pf_exists("msitest\\original2.txt"), "file not created\n");
5621 ok(!pf_exists("msitest\\original3.txt"), "file created\n");
5622 ok(pf_exists("msitest\\duplicate.txt"), "file not created\n");
5623 ok(!pf_exists("msitest\\duplicate2.txt"), "file created\n");
5625 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5626 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5628 ok(delete_pf("msitest\\original.txt", TRUE), "file removed\n");
5629 ok(!delete_pf("msitest\\original2.txt", TRUE), "file not removed\n");
5630 ok(!delete_pf("msitest\\original3.txt", TRUE), "file not removed\n");
5631 ok(!delete_pf("msitest\\duplicate.txt", TRUE), "file not removed\n");
5632 ok(!delete_pf("msitest\\duplicate2.txt", TRUE), "file not removed\n");
5633 ok(delete_pf("msitest", FALSE), "directory removed\n");
5635 error:
5636 DeleteFileA("msitest\\original.txt");
5637 DeleteFileA("msitest\\original2.txt");
5638 DeleteFileA("msitest\\original3.txt");
5639 delete_test_files();
5640 DeleteFileA(msifile);
5643 static void test_remove_registry_values(void)
5645 UINT r;
5646 LONG res;
5647 HKEY key;
5648 REGSAM access = KEY_ALL_ACCESS;
5650 if (is_process_limited())
5652 skip("process is limited\n");
5653 return;
5656 create_test_files();
5657 create_file("msitest\\registry.txt", 1000);
5658 create_database(msifile, rrv_tables, sizeof(rrv_tables) / sizeof(msi_table));
5660 if (is_wow64)
5661 access |= KEY_WOW64_64KEY;
5663 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5665 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, NULL, 0, access, NULL, &key, NULL);
5666 RegSetValueExA(key, "value1", 0, REG_SZ, (const BYTE *)"1", 2);
5667 RegCloseKey(key);
5669 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5670 RegSetValueExA(key, "value2", 0, REG_SZ, (const BYTE *)"2", 2);
5671 RegCloseKey(key);
5673 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, NULL, 0, access, NULL, &key, NULL);
5674 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5675 RegSetValueExA(key, "valueA", 0, REG_SZ, (const BYTE *)"A", 2);
5676 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5677 RegCloseKey(key);
5679 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, NULL, 0, access, NULL, &key, NULL);
5680 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5681 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5682 RegCloseKey(key);
5684 r = MsiInstallProductA(msifile, NULL);
5685 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5687 skip("Not enough rights to perform tests\n");
5688 goto error;
5690 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5692 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, access, &key);
5693 ok(res == ERROR_SUCCESS, "key removed\n");
5694 RegCloseKey(key);
5696 if (is_64bit)
5698 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5699 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5701 else
5703 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5704 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5707 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5708 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5709 RegCloseKey(key);
5711 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5714 if (is_64bit)
5716 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5717 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5719 else
5721 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5722 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5725 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, access, &key);
5726 ok(res == ERROR_SUCCESS, "key removed\n");
5727 RegCloseKey(key);
5729 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, access, &key);
5730 ok(res == ERROR_SUCCESS, "key removed\n");
5731 RegCloseKey(key);
5733 if (is_64bit)
5735 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5736 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5738 else
5740 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5741 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5744 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5745 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5746 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine", access);
5748 ok(!delete_pf("msitest\\registry.txt", TRUE), "file not removed\n");
5749 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5751 error:
5752 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", access);
5753 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5754 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5755 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", access);
5757 DeleteFileA("msitest\\registry.txt");
5758 delete_test_files();
5759 DeleteFileA(msifile);
5762 static void test_find_related_products(void)
5764 UINT r;
5766 if (is_process_limited())
5768 skip("process is limited\n");
5769 return;
5772 create_test_files();
5773 create_file("msitest\\product.txt", 1000);
5774 create_database(msifile, frp_tables, sizeof(frp_tables) / sizeof(msi_table));
5776 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5778 r = MsiInstallProductA(msifile, NULL);
5779 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5781 skip("Not enough rights to perform tests\n");
5782 goto error;
5784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5786 /* install again, so it finds the upgrade code */
5787 r = MsiInstallProductA(msifile, NULL);
5788 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5790 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5791 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5793 ok(!delete_pf("msitest\\product.txt", TRUE), "file not removed\n");
5794 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5796 error:
5797 DeleteFileA("msitest\\product.txt");
5798 delete_test_files();
5799 DeleteFileA(msifile);
5802 static void test_remove_ini_values(void)
5804 UINT r;
5805 DWORD len;
5806 char inifile[MAX_PATH], buf[0x10];
5807 HANDLE file;
5808 BOOL ret;
5810 if (is_process_limited())
5812 skip("process is limited\n");
5813 return;
5816 create_test_files();
5817 create_file("msitest\\inifile.txt", 1000);
5818 create_database(msifile, riv_tables, sizeof(riv_tables) / sizeof(msi_table));
5820 lstrcpyA(inifile, PROG_FILES_DIR);
5821 lstrcatA(inifile, "\\msitest");
5822 ret = CreateDirectoryA(inifile, NULL);
5823 if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
5825 skip("Not enough rights to perform tests\n");
5826 goto error;
5828 lstrcatA(inifile, "\\test.ini");
5829 file = CreateFileA(inifile, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, NULL);
5830 CloseHandle(file);
5832 ret = WritePrivateProfileStringA("section1", "key1", "value1", inifile);
5833 ok(ret, "failed to write profile string %u\n", GetLastError());
5835 ret = WritePrivateProfileStringA("sectionA", "keyA", "valueA", inifile);
5836 ok(ret, "failed to write profile string %u\n", GetLastError());
5838 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5840 r = MsiInstallProductA(msifile, NULL);
5841 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5843 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
5844 ok(len == 6, "got %u expected 6\n", len);
5846 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
5847 ok(!len, "got %u expected 0\n", len);
5849 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5850 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5852 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
5853 ok(!len, "got %u expected 0\n", len);
5855 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
5856 ok(!len, "got %u expected 0\n", len);
5858 todo_wine ok(!delete_pf("msitest\\test.ini", TRUE), "file removed\n");
5859 ok(!delete_pf("msitest\\inifile.txt", TRUE), "file not removed\n");
5860 ok(delete_pf("msitest", FALSE), "directory removed\n");
5862 error:
5863 DeleteFileA("msitest\\inifile.txt");
5864 delete_test_files();
5865 DeleteFileA(msifile);
5868 static void test_remove_env_strings(void)
5870 UINT r;
5871 LONG res;
5872 HKEY key;
5873 DWORD type, size;
5874 char buffer[0x10];
5876 if (is_process_limited())
5878 skip("process is limited\n");
5879 return;
5882 create_test_files();
5883 create_file("msitest\\envvar.txt", 1000);
5884 create_database(msifile, res_tables, sizeof(res_tables) / sizeof(msi_table));
5886 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5888 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
5889 ok(!res, "failed to open environment key %d\n", res);
5891 RegSetValueExA(key, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"1", 2);
5892 RegSetValueExA(key, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"1", 2);
5893 RegSetValueExA(key, "MSITESTVAR3", 0, REG_SZ, (const BYTE *)"1", 2);
5894 RegSetValueExA(key, "MSITESTVAR4", 0, REG_SZ, (const BYTE *)"1", 2);
5895 RegSetValueExA(key, "MSITESTVAR5", 0, REG_SZ, (const BYTE *)"1", 2);
5897 RegCloseKey(key);
5899 r = MsiInstallProductA(msifile, NULL);
5900 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5902 skip("Not enough rights to perform tests\n");
5903 goto error;
5905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5907 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
5908 ok(!res, "failed to open environment key %d\n", res);
5910 type = REG_NONE;
5911 buffer[0] = 0;
5912 size = sizeof(buffer);
5913 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
5914 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5915 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5916 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5918 type = REG_NONE;
5919 buffer[0] = 0;
5920 size = sizeof(buffer);
5921 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
5922 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5923 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5924 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5926 type = REG_NONE;
5927 buffer[0] = 0;
5928 size = sizeof(buffer);
5929 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
5930 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5931 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5932 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5934 type = REG_NONE;
5935 buffer[0] = 0;
5936 size = sizeof(buffer);
5937 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, &type, (LPBYTE)buffer, &size);
5938 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5939 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5940 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5942 type = REG_NONE;
5943 buffer[0] = 0;
5944 size = sizeof(buffer);
5945 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
5946 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5947 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5948 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5950 RegCloseKey(key);
5952 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5955 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
5956 ok(!res, "failed to open environment key %d\n", res);
5958 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, NULL, NULL, NULL);
5959 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5961 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, NULL, NULL, NULL);
5962 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5964 type = REG_NONE;
5965 buffer[0] = 0;
5966 size = sizeof(buffer);
5967 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
5968 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5969 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5970 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5971 RegDeleteValueA(key, "MSITESTVAR3");
5973 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, NULL, NULL, NULL);
5974 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5976 type = REG_NONE;
5977 buffer[0] = 0;
5978 size = sizeof(buffer);
5979 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
5980 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5981 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5982 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5983 RegDeleteValueA(key, "MSITESTVAR5");
5985 ok(!delete_pf("msitest\\envvar.txt", TRUE), "file not removed\n");
5986 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5988 error:
5989 RegDeleteValueA(key, "MSITESTVAR1");
5990 RegDeleteValueA(key, "MSITESTVAR2");
5991 RegDeleteValueA(key, "MSITESTVAR3");
5992 RegDeleteValueA(key, "MSITESTVAR4");
5993 RegDeleteValueA(key, "MSITESTVAR5");
5994 RegCloseKey(key);
5996 DeleteFileA("msitest\\envvar.txt");
5997 delete_test_files();
5998 DeleteFileA(msifile);
6001 static void test_register_class_info(void)
6003 UINT r;
6004 LONG res;
6005 HKEY hkey;
6007 if (is_process_limited())
6009 skip("process is limited\n");
6010 return;
6013 create_test_files();
6014 create_file("msitest\\class.txt", 1000);
6015 create_database(msifile, rci_tables, sizeof(rci_tables) / sizeof(msi_table));
6017 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6019 r = MsiInstallProductA(msifile, NULL);
6020 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6022 skip("Not enough rights to perform tests\n");
6023 goto error;
6025 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6027 if (is_64bit)
6028 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6029 else
6030 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6031 ok(res == ERROR_SUCCESS, "key not created\n");
6032 RegCloseKey(hkey);
6034 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6035 ok(res == ERROR_SUCCESS, "key not created\n");
6036 RegCloseKey(hkey);
6038 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6039 ok(res == ERROR_SUCCESS, "key not created\n");
6040 RegCloseKey(hkey);
6042 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6043 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6045 if (is_64bit)
6046 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6047 else
6048 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6049 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6051 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6052 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6054 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6055 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6057 ok(!delete_pf("msitest\\class.txt", TRUE), "file not removed\n");
6058 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6060 error:
6061 DeleteFileA("msitest\\class.txt");
6062 delete_test_files();
6063 DeleteFileA(msifile);
6066 static void test_register_extension_info(void)
6068 UINT r;
6069 LONG res;
6070 HKEY hkey;
6072 if (is_process_limited())
6074 skip("process is limited\n");
6075 return;
6078 create_test_files();
6079 create_file("msitest\\extension.txt", 1000);
6080 create_database(msifile, rei_tables, sizeof(rei_tables) / sizeof(msi_table));
6082 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6084 r = MsiInstallProductA(msifile, NULL);
6085 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6087 skip("Not enough rights to perform tests\n");
6088 goto error;
6090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6092 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6093 ok(res == ERROR_SUCCESS, "key not created\n");
6094 RegCloseKey(hkey);
6096 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &hkey);
6097 ok(res == ERROR_SUCCESS, "key not created\n");
6098 RegCloseKey(hkey);
6100 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6101 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6103 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6104 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6106 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1", &hkey);
6107 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6109 ok(!delete_pf("msitest\\extension.txt", TRUE), "file not removed\n");
6110 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6112 error:
6113 DeleteFileA("msitest\\extension.txt");
6114 delete_test_files();
6115 DeleteFileA(msifile);
6118 static void test_register_mime_info(void)
6120 UINT r;
6121 LONG res;
6122 HKEY hkey;
6124 if (is_process_limited())
6126 skip("process is limited\n");
6127 return;
6130 create_test_files();
6131 create_file("msitest\\mime.txt", 1000);
6132 create_database(msifile, rmi_tables, sizeof(rmi_tables) / sizeof(msi_table));
6134 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6136 r = MsiInstallProductA(msifile, NULL);
6137 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6139 skip("Not enough rights to perform tests\n");
6140 goto error;
6142 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6144 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6145 ok(res == ERROR_SUCCESS, "key not created\n");
6146 RegCloseKey(hkey);
6148 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6149 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6151 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6152 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6154 ok(!delete_pf("msitest\\mime.txt", TRUE), "file not removed\n");
6155 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6157 error:
6158 DeleteFileA("msitest\\mime.txt");
6159 delete_test_files();
6160 DeleteFileA(msifile);
6163 static void test_publish_assemblies(void)
6165 static const char manifest[] =
6166 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Assembly\" "
6167 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6168 "processorArchitecture=\"x86\"/>";
6169 static const char manifest_local[] =
6170 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Local.Assembly\" "
6171 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6172 "processorArchitecture=\"x86\"/>";
6173 static const char classes_path_dotnet[] =
6174 "Installer\\Assemblies\\Global";
6175 static const char classes_path_dotnet_local[] =
6176 "Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6177 static const char classes_path_dotnet_local_wow64[] =
6178 "Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6179 static const char classes_path_win32[] =
6180 "Installer\\Win32Assemblies\\Global";
6181 static const char classes_path_win32_local[] =
6182 "Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6183 static const char classes_path_win32_local_wow64[] =
6184 "Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6185 static const char path_dotnet[] =
6186 "Software\\Microsoft\\Installer\\Assemblies\\Global";
6187 static const char path_dotnet_local[] =
6188 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6189 static const char path_dotnet_local_wow64[] =
6190 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6191 static const char path_win32[] =
6192 "Software\\Microsoft\\Installer\\Win32Assemblies\\Global";
6193 static const char path_win32_local[] =
6194 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6195 static const char path_win32_local_wow64[] =
6196 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6197 static const char name_dotnet[] =
6198 "Wine.Dotnet.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6199 "version=\"1.0.0.0\",culture=\"neutral\"";
6200 static const char name_dotnet_local[] =
6201 "Wine.Dotnet.Local.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6202 "version=\"1.0.0.0\",culture=\"neutral\"";
6203 static const char name_win32[] =
6204 "Wine.Win32.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6205 "type=\"win32\",version=\"1.0.0.0\"";
6206 static const char name_win32_local[] =
6207 "Wine.Win32.Local.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6208 "type=\"win32\",version=\"1.0.0.0\"";
6209 UINT r;
6210 LONG res;
6211 HKEY hkey;
6212 const char *path;
6213 int access;
6215 if (is_process_limited())
6217 skip("process is limited\n");
6218 return;
6221 create_test_files();
6222 create_file("msitest\\win32.txt", 1000);
6223 create_file("msitest\\win32_local.txt", 1000);
6224 create_file("msitest\\dotnet.txt", 1000);
6225 create_file("msitest\\dotnet_local.txt", 1000);
6226 create_file_data("msitest\\manifest.txt", manifest, 0);
6227 create_file_data("msitest\\manifest_local.txt", manifest_local, 0);
6228 create_file("msitest\\application_win32.txt", 1000);
6229 create_file("msitest\\application_dotnet.txt", 1000);
6230 create_database(msifile, pa_tables, sizeof(pa_tables) / sizeof(msi_table));
6232 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6234 r = MsiInstallProductA(msifile, NULL);
6235 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6237 skip("Not enough rights to perform tests\n");
6238 goto done;
6240 if (r == ERROR_INSTALL_FAILURE)
6242 skip("No support for installing side-by-side assemblies\n");
6243 goto done;
6245 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6247 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6248 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6249 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6250 RegCloseKey(hkey);
6252 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6253 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6254 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6255 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6256 RegCloseKey(hkey);
6258 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6259 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6260 "Expected ERROR_SUCCESS, got %d\n", res);
6261 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6262 RegCloseKey(hkey);
6264 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6265 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6266 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6267 "Expected ERROR_SUCCESS, got %d\n", res);
6268 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6269 RegCloseKey(hkey);
6271 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6274 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6275 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6276 if (res == ERROR_SUCCESS)
6278 res = RegDeleteValueA(hkey, name_dotnet);
6279 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6280 RegCloseKey(hkey);
6283 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6284 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6285 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6287 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6288 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6289 if (res == ERROR_SUCCESS)
6291 res = RegDeleteValueA(hkey, name_win32);
6292 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6293 RegCloseKey(hkey);
6296 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6297 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6298 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6300 r = MsiInstallProductA(msifile, "ALLUSERS=1");
6301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6303 access = KEY_QUERY_VALUE;
6304 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6305 if (res == ERROR_FILE_NOT_FOUND && is_wow64) /* Vista WOW64 */
6307 trace("Using 64-bit registry view for HKCR\\Installer\n");
6308 access = KEY_QUERY_VALUE | KEY_WOW64_64KEY;
6309 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6311 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6312 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6313 RegCloseKey(hkey);
6315 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6316 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6317 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6318 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6319 RegCloseKey(hkey);
6321 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_win32, 0, access, &hkey);
6322 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6323 "Expected ERROR_SUCCESS, got %d\n", res);
6324 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6325 RegCloseKey(hkey);
6327 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6328 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6329 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6330 "Expected ERROR_SUCCESS, got %d\n", res);
6331 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6332 RegCloseKey(hkey);
6334 r = MsiInstallProductA(msifile, "REMOVE=ALL ALLUSERS=1");
6335 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6337 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_dotnet, &hkey);
6338 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6339 if (res == ERROR_SUCCESS)
6341 res = RegDeleteValueA(hkey, name_dotnet);
6342 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6343 RegCloseKey(hkey);
6346 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6347 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6348 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6350 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_win32, &hkey);
6351 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6352 if (res == ERROR_SUCCESS)
6354 res = RegDeleteValueA(hkey, name_win32);
6355 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6356 RegCloseKey(hkey);
6359 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6360 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6361 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6363 done:
6364 DeleteFileA("msitest\\win32.txt");
6365 DeleteFileA("msitest\\win32_local.txt");
6366 DeleteFileA("msitest\\dotnet.txt");
6367 DeleteFileA("msitest\\dotnet_local.txt");
6368 DeleteFileA("msitest\\manifest.txt");
6369 DeleteFileA("msitest\\manifest_local.txt");
6370 DeleteFileA("msitest\\application_win32.txt");
6371 DeleteFileA("msitest\\application_dotnet.txt");
6372 delete_test_files();
6373 DeleteFileA(msifile);
6376 static void test_remove_existing_products(void)
6378 UINT r;
6380 if (is_process_limited())
6382 skip("process is limited\n");
6383 return;
6386 create_test_files();
6387 create_file("msitest\\rep.txt", 1000);
6388 create_database(msifile, rep_tables, sizeof(rep_tables) / sizeof(msi_table));
6390 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6392 r = MsiInstallProductA(msifile, NULL);
6393 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6395 skip("Not enough rights to perform tests\n");
6396 goto error;
6398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6400 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6401 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6403 ok(!delete_pf("msitest\\rep.txt", TRUE), "file not removed\n");
6404 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6406 error:
6407 DeleteFileA("msitest\\rep.txt");
6408 delete_test_files();
6409 DeleteFileA(msifile);
6412 START_TEST(action)
6414 DWORD len;
6415 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6416 STATEMGRSTATUS status;
6417 BOOL ret = FALSE;
6419 init_functionpointers();
6421 if (pIsWow64Process)
6422 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6424 GetCurrentDirectoryA(MAX_PATH, prev_path);
6425 GetTempPathA(MAX_PATH, temp_path);
6426 SetCurrentDirectoryA(temp_path);
6428 lstrcpyA(CURR_DIR, temp_path);
6429 len = lstrlenA(CURR_DIR);
6431 if(len && (CURR_DIR[len - 1] == '\\'))
6432 CURR_DIR[len - 1] = 0;
6434 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6435 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6437 /* Create a restore point ourselves so we circumvent the multitude of restore points
6438 * that would have been created by all the installation and removal tests.
6440 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6441 * creation of restore points.
6443 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6445 memset(&status, 0, sizeof(status));
6446 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6449 /* Create only one log file and don't append. We have to pass something
6450 * for the log mode for this to work. The logfile needs to have an absolute
6451 * path otherwise we still end up with some extra logfiles as some tests
6452 * change the current directory.
6454 lstrcpyA(log_file, temp_path);
6455 lstrcatA(log_file, "\\msitest.log");
6456 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6458 test_register_product();
6459 test_publish_product();
6460 test_publish_features();
6461 test_register_user();
6462 test_process_components();
6463 test_publish();
6464 test_publish_sourcelist();
6465 test_remove_files();
6466 test_move_files();
6467 test_duplicate_files();
6468 test_write_registry_values();
6469 test_envvar();
6470 test_create_remove_folder();
6471 test_start_services();
6472 test_delete_services();
6473 test_self_registration();
6474 test_register_font();
6475 test_validate_product_id();
6476 test_install_remove_odbc();
6477 test_register_typelib();
6478 test_create_remove_shortcut();
6479 test_publish_components();
6480 test_remove_duplicate_files();
6481 test_remove_registry_values();
6482 test_find_related_products();
6483 test_remove_ini_values();
6484 test_remove_env_strings();
6485 test_register_class_info();
6486 test_register_extension_info();
6487 test_register_mime_info();
6488 test_publish_assemblies();
6489 test_remove_existing_products();
6491 DeleteFileA(log_file);
6493 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6495 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6496 if (ret)
6497 remove_restore_point(status.llSequenceNumber);
6499 FreeLibrary(hsrclient);
6501 SetCurrentDirectoryA(prev_path);