2 * tests for Microsoft Installer functionality
4 * Copyright 2007 Mike McCormack for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/test.h"
31 static GUID CLSID_IInstaller = { 0xc1090, 0, 0, {0xc0,0,0,0,0,0,0,0x46} };
32 static GUID IID_IMsiServer = { 0xc101c, 0, 0, {0xc0,0,0,0,0,0,0,0x46} };
34 static DISPID get_dispid( IDispatch *disp, const char *name )
41 len = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0 );
42 str = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR) );
43 len = MultiByteToWideChar(CP_ACP, 0, name, -1, str, len );
45 r = IDispatch_GetIDsOfNames( disp, &IID_IMsiServer, &str, 1, 0, &id );
52 static void test_msi_dispid(void)
55 IDispatch *disp = NULL;
57 r = CoCreateInstance( &CLSID_IInstaller, NULL, CLSCTX_INPROC_SERVER,
58 &IID_IDispatch, (LPVOID*) &disp );
59 todo_wine ok( r == S_OK, "failed to create an installer instance %08x\n", r);
62 skip( "IMsiServer interface not present\n");
67 ok( get_dispid( disp, "CreateRecord" ) == 1, "dispid wrong\n");
68 ok( get_dispid( disp, "OpenPackage" ) == 2, "dispid wrong\n");
69 ok( get_dispid( disp, "OpenProduct" ) == 3, "dispid wrong\n");
70 ok( get_dispid( disp, "OpenDatabase" ) == 4, "dispid wrong\n");
71 ok( get_dispid( disp, "SummaryInformation" ) == 5, "dispid wrong\n");
72 ok( get_dispid( disp, "UILevel" ) == 6, "dispid wrong\n");
73 ok( get_dispid( disp, "EnableLog" ) == 7, "dispid wrong\n");
74 ok( get_dispid( disp, "InstallProduct" ) == 8, "dispid wrong\n");
75 ok( get_dispid( disp, "Version" ) == 9, "dispid wrong\n");
76 ok( get_dispid( disp, "LastErrorRecord" ) == 10, "dispid wrong\n");
77 ok( get_dispid( disp, "RegistryValue" ) == 11, "dispid wrong\n");
78 ok( get_dispid( disp, "Environment" ) == 12, "dispid wrong\n");
79 ok( get_dispid( disp, "FileAttributes" ) == 13, "dispid wrong\n");
81 ok( get_dispid( disp, "FileSize" ) == 15, "dispid wrong\n");
82 ok( get_dispid( disp, "FileVersion" ) == 16, "dispid wrong\n");
83 ok( get_dispid( disp, "ProductState" ) == 17, "dispid wrong\n");
84 ok( get_dispid( disp, "ProductInfo" ) == 18, "dispid wrong\n");
85 ok( get_dispid( disp, "ConfigureProduct" ) == 19, "dispid wrong\n");
86 ok( get_dispid( disp, "ReinstallProduct" ) == 20 , "dispid wrong\n");
87 ok( get_dispid( disp, "CollectUserInfo" ) == 21, "dispid wrong\n");
88 ok( get_dispid( disp, "ApplyPatch" ) == 22, "dispid wrong\n");
89 ok( get_dispid( disp, "FeatureParent" ) == 23, "dispid wrong\n");
90 ok( get_dispid( disp, "FeatureState" ) == 24, "dispid wrong\n");
91 ok( get_dispid( disp, "UseFeature" ) == 25, "dispid wrong\n");
92 ok( get_dispid( disp, "FeatureUsageCount" ) == 26, "dispid wrong\n");
93 ok( get_dispid( disp, "FeatureUsageDate" ) == 27, "dispid wrong\n");
94 ok( get_dispid( disp, "ConfigureFeature" ) == 28, "dispid wrong\n");
95 ok( get_dispid( disp, "ReinstallFeature" ) == 29, "dispid wrong\n");
96 ok( get_dispid( disp, "ProvideComponent" ) == 30, "dispid wrong\n");
97 ok( get_dispid( disp, "ComponentPath" ) == 31, "dispid wrong\n");
98 ok( get_dispid( disp, "ProvideQualifiedComponent" ) == 32, "dispid wrong\n");
99 ok( get_dispid( disp, "QualifierDescription" ) == 33, "dispid wrong\n");
100 ok( get_dispid( disp, "ComponentQualifiers" ) == 34, "dispid wrong\n");
101 ok( get_dispid( disp, "Products" ) == 35, "dispid wrong\n");
102 ok( get_dispid( disp, "Features" ) == 36, "dispid wrong\n");
103 ok( get_dispid( disp, "Components" ) == 37, "dispid wrong\n");
104 ok( get_dispid( disp, "ComponentClients" ) == 38, "dispid wrong\n");
105 ok( get_dispid( disp, "Patches" ) == 39, "dispid wrong\n");
106 ok( get_dispid( disp, "RelatedProducts" ) == 40, "dispid wrong\n");
107 ok( get_dispid( disp, "PatchInfo" ) == 41, "dispid wrong\n");
108 ok( get_dispid( disp, "PatchTransforms" ) == 42, "dispid wrong\n");
109 ok( get_dispid( disp, "AddSource" ) == 43, "dispid wrong\n");
110 ok( get_dispid( disp, "ClearSourceList" ) == 44, "dispid wrong\n");
111 ok( get_dispid( disp, "ForceSourceListResolution" ) == 45, "dispid wrong\n");
112 ok( get_dispid( disp, "ShortcutTarget" ) == 46, "dispid wrong\n");
113 ok( get_dispid( disp, "FileHash" ) == 47, "dispid wrong\n");
114 ok( get_dispid( disp, "FileSignatureInfo" ) == 48, "dispid wrong\n");
115 ok( get_dispid( disp, "RemovePatches" ) == 49, "dispid wrong\n");
117 ok( get_dispid( disp, "ApplyMultiplePatches" ) == 51, "dispid wrong\n");
118 ok( get_dispid( disp, "ProductsEx" ) == 52, "dispid wrong\n");
120 ok( get_dispid( disp, "PatchesEx" ) == 55, "dispid wrong\n");
122 ok( get_dispid( disp, "ExtractPatchXMLData" ) == 57, "dispid wrong\n");
125 /* MSDN claims the following functions exist but IDispatch->GetIDsOfNames disagrees */
128 get_dispid( disp, "ProductElevated" );
129 get_dispid( disp, "ProductInfoFromScript" );
130 get_dispid( disp, "ProvideAssembly" );
131 get_dispid( disp, "CreateAdvertiseScript" );
132 get_dispid( disp, "AdvertiseProduct" );
133 get_dispid( disp, "PatchFiles" );
136 IDispatch_Release( disp );
139 static void test_msi_invoke(void)
141 IDispatch *installer = NULL, *record = NULL;
149 r = CoCreateInstance( &CLSID_IInstaller, NULL, CLSCTX_INPROC_SERVER,
150 &IID_IDispatch, (LPVOID*) &installer );
151 todo_wine ok( r == S_OK, "failed to create an installer instance %08x\n", r);
154 skip( "IMsiServer interface not present\n");
164 param.cNamedArgs = 0;
165 param.rgvarg = &varg;
166 param.rgdispidNamedArgs = &arg;
168 dispid = get_dispid( installer, "CreateRecord" );
170 r = IDispatch_Invoke( installer, dispid, &IID_NULL, 0,
171 DISPATCH_METHOD, ¶m, &result, NULL, NULL);
172 todo_wine ok( r == S_OK, "dispatch failed %08x\n", r);
175 ok( V_VT(&result) == VT_DISPATCH, "type wrong\n");
177 record = V_DISPATCH(&result);
179 memset( &result, 0, sizeof result );
180 dispid = get_dispid( record, "FieldCount" );
183 param.cNamedArgs = 0;
184 param.rgvarg = &varg;
185 param.rgdispidNamedArgs = &arg;
187 r = IDispatch_Invoke( record, dispid, &IID_NULL, 0,
188 DISPATCH_PROPERTYGET, ¶m, &result, NULL, NULL );
189 ok( r == S_OK, "dispatch failed %08x\n", r);
191 ok( V_VT(&result) == VT_I4, "type wrong\n");
192 ok( V_I4(&result) == 1, "field count wrong\n");
194 IDispatch_Release( record );
197 skip( "failed to create record\n");
199 memset( &result, 0, sizeof result );
200 dispid = get_dispid( installer, "Version" );
203 param.cNamedArgs = 0;
204 param.rgvarg = &varg;
205 param.rgdispidNamedArgs = &arg;
207 r = IDispatch_Invoke( installer, dispid, &IID_NULL, 0,
208 DISPATCH_PROPERTYGET, ¶m, &result, NULL, NULL );
210 ok( r == S_OK, "dispatch failed %08x\n", r);
211 ok( V_VT(&result) == VT_BSTR, "type wrong %d\n", V_VT(&result));
214 IDispatch_Release( installer );
219 CoInitialize( NULL );