2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 2002 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #define NONAMELESSUNION
31 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msi);
39 static const WCHAR szSumInfo[] = { 5 ,'S','u','m','m','a','r','y',
40 'I','n','f','o','r','m','a','t','i','o','n',0 };
42 static void MSI_CloseSummaryInfo( MSIOBJECTHDR *arg )
44 MSISUMMARYINFO *suminfo = (MSISUMMARYINFO *) arg;
45 IPropertyStorage_Release( suminfo->propstg );
48 UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase,
49 LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *phSummaryInfo)
51 LPWSTR szwDatabase = NULL;
54 TRACE("%ld %s %d %p\n", hDatabase, debugstr_a(szDatabase),
55 uiUpdateCount, phSummaryInfo);
59 UINT len = MultiByteToWideChar( CP_ACP, 0, szDatabase, -1, NULL, 0 );
60 szwDatabase = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
62 return ERROR_FUNCTION_FAILED;
63 MultiByteToWideChar( CP_ACP, 0, szDatabase, -1, szwDatabase, len );
66 ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, phSummaryInfo);
68 HeapFree( GetProcessHeap(), 0, szwDatabase );
73 UINT WINAPI MsiGetSummaryInformationW(MSIHANDLE hDatabase,
74 LPCWSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *phSummaryInfo)
78 MSISUMMARYINFO *suminfo;
80 UINT ret = ERROR_SUCCESS;
81 IPropertySetStorage *psstg = NULL;
82 IPropertyStorage *ps = NULL;
85 TRACE("%ld %s %d %p\n", hDatabase, debugstr_w(szDatabase),
86 uiUpdateCount, phSummaryInfo);
89 return ERROR_INVALID_PARAMETER;
95 res = MSI_OpenDatabaseW(szDatabase, NULL, &db);
96 if( res != ERROR_SUCCESS )
101 db = msihandle2msiinfo(hDatabase, MSIHANDLETYPE_DATABASE);
103 return ERROR_INVALID_PARAMETER;
106 r = IStorage_QueryInterface( db->storage,
107 &IID_IPropertySetStorage, (LPVOID)&psstg);
110 ERR("IStorage -> IPropertySetStorage failed\n");
111 ret = ERROR_FUNCTION_FAILED;
115 grfMode = STGM_READ | STGM_SHARE_EXCLUSIVE;
116 r = IPropertySetStorage_Open( psstg, &FMTID_SummaryInformation, grfMode, &ps );
119 ERR("failed to get IPropertyStorage r=%08lx\n",r);
120 ret = ERROR_FUNCTION_FAILED;
124 suminfo = alloc_msiobject( MSIHANDLETYPE_SUMMARYINFO,
125 sizeof (MSISUMMARYINFO), MSI_CloseSummaryInfo );
128 ret = ERROR_FUNCTION_FAILED;
132 IPropertyStorage_AddRef(ps);
133 suminfo->propstg = ps;
134 handle = alloc_msihandle( &suminfo->hdr );
136 *phSummaryInfo = handle;
138 ret = ERROR_FUNCTION_FAILED;
139 msiobj_release( &suminfo->hdr );
143 IPropertyStorage_Release(ps);
145 IPropertySetStorage_Release(psstg);
147 msiobj_release(&db->hdr);
152 UINT WINAPI MsiSummaryInfoGetPropertyCount(MSIHANDLE hSummaryInfo, UINT *pCount)
154 MSISUMMARYINFO *suminfo;
156 FIXME("%ld %p\n",hSummaryInfo, pCount);
158 suminfo = msihandle2msiinfo( hSummaryInfo, MSIHANDLETYPE_SUMMARYINFO );
160 return ERROR_INVALID_HANDLE;
162 return ERROR_CALL_NOT_IMPLEMENTED;
165 UINT WINAPI MsiSummaryInfoGetPropertyA(
166 MSIHANDLE hSummaryInfo, UINT uiProperty, UINT *puiDataType, INT *piValue,
167 FILETIME *pftValue, LPSTR szValueBuf, DWORD *pcchValueBuf)
169 MSISUMMARYINFO *suminfo;
174 TRACE("%ld %d %p %p %p %p %p\n",
175 hSummaryInfo, uiProperty, puiDataType, piValue,
176 pftValue, szValueBuf, pcchValueBuf);
178 suminfo = msihandle2msiinfo( hSummaryInfo, MSIHANDLETYPE_SUMMARYINFO );
180 return ERROR_INVALID_HANDLE;
182 spec.ulKind = PRSPEC_PROPID;
183 spec.u.propid = uiProperty;
185 r = IPropertyStorage_ReadMultiple( suminfo->propstg, 1, &spec, &var);
187 return ERROR_FUNCTION_FAILED;
190 *puiDataType = var.vt;
196 *piValue = var.u.lVal;
199 if( pcchValueBuf && szValueBuf )
201 lstrcpynA(szValueBuf, var.u.pszVal, *pcchValueBuf );
202 *pcchValueBuf = lstrlenA( var.u.pszVal );
207 memcpy(pftValue, &var.u.filetime, sizeof (FILETIME) );
212 FIXME("Unknown property variant type\n");
216 return ERROR_SUCCESS;
219 UINT WINAPI MsiSummaryInfoGetPropertyW(
220 MSIHANDLE hSummaryInfo, UINT uiProperty, UINT *puiDataType, INT *piValue,
221 FILETIME *pftValue, LPWSTR szValueBuf, DWORD *pcchValueBuf)
223 MSISUMMARYINFO *suminfo;
228 TRACE("%ld %d %p %p %p %p %p\n",
229 hSummaryInfo, uiProperty, puiDataType, piValue,
230 pftValue, szValueBuf, pcchValueBuf);
232 suminfo = msihandle2msiinfo( hSummaryInfo, MSIHANDLETYPE_SUMMARYINFO );
234 return ERROR_INVALID_HANDLE;
236 spec.ulKind = PRSPEC_PROPID;
237 spec.u.propid = uiProperty;
239 r = IPropertyStorage_ReadMultiple( suminfo->propstg, 1, &spec, &var);
241 return ERROR_FUNCTION_FAILED;
244 *puiDataType = var.vt;
250 *piValue = var.u.lVal;
253 if( pcchValueBuf && szValueBuf )
255 MultiByteToWideChar(CP_ACP, 0, var.u.pszVal, -1, szValueBuf,
257 *pcchValueBuf = lstrlenA( var.u.pszVal );
262 memcpy(pftValue, &var.u.filetime, sizeof (FILETIME) );
267 FIXME("Unknown property variant type\n");
271 return ERROR_SUCCESS;
274 UINT WINAPI MsiSummaryInfoSetPropertyA( MSIHANDLE hSummaryInfo, UINT uiProperty,
275 UINT uiDataType, INT iValue,
276 FILETIME* pftValue, LPSTR szValue )
278 FIXME("%ld %u %u %i %p %s\n", hSummaryInfo, uiProperty,
279 uiDataType, iValue, pftValue, debugstr_a(szValue) );
280 return ERROR_CALL_NOT_IMPLEMENTED;
283 UINT WINAPI MsiSummaryInfoSetPropertyW( MSIHANDLE hSummaryInfo, UINT uiProperty,
284 UINT uiDataType, INT iValue,
285 FILETIME* pftValue, LPWSTR szValue )
287 FIXME("%ld %u %u %i %p %s\n", hSummaryInfo, uiProperty,
288 uiDataType, iValue, pftValue, debugstr_w(szValue) );
289 return ERROR_CALL_NOT_IMPLEMENTED;
292 UINT WINAPI MsiSummaryInfoPersist( MSIHANDLE hSummaryInfo )
294 FIXME("%ld\n", hSummaryInfo );
295 return ERROR_CALL_NOT_IMPLEMENTED;