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