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