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
21 #define NONAMELESSUNION
29 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(msi
);
37 const WCHAR szSumInfo
[] = { 5 ,'S','u','m','m','a','r','y',
38 'I','n','f','o','r','m','a','t','i','o','n',0 };
40 static void MSI_CloseSummaryInfo( VOID
*arg
)
42 MSISUMMARYINFO
*suminfo
= (MSISUMMARYINFO
*) arg
;
43 IPropertyStorage_Release( suminfo
->propstg
);
46 UINT WINAPI
MsiGetSummaryInformationA(MSIHANDLE hDatabase
,
47 LPCSTR szDatabase
, UINT uiUpdateCount
, MSIHANDLE
*phSummaryInfo
)
49 LPWSTR szwDatabase
= NULL
;
52 TRACE("%ld %s %d %p\n", hDatabase
, debugstr_a(szDatabase
),
53 uiUpdateCount
, phSummaryInfo
);
57 szwDatabase
= HEAP_strdupAtoW( GetProcessHeap(), 0, szDatabase
);
59 return ERROR_FUNCTION_FAILED
;
62 ret
= MsiGetSummaryInformationW(hDatabase
, szwDatabase
, uiUpdateCount
, phSummaryInfo
);
65 HeapFree( GetProcessHeap(), 0, szwDatabase
);
70 UINT WINAPI
MsiGetSummaryInformationW(MSIHANDLE hDatabase
,
71 LPCWSTR szDatabase
, UINT uiUpdateCount
, MSIHANDLE
*phSummaryInfo
)
74 MSIHANDLE handle
, hdb
= hDatabase
;
75 MSISUMMARYINFO
*suminfo
;
77 UINT ret
= ERROR_SUCCESS
;
78 IPropertySetStorage
*psstg
= NULL
;
79 IPropertyStorage
*ps
= NULL
;
82 TRACE("%ld %s %d %p\n", hDatabase
, debugstr_w(szDatabase
),
83 uiUpdateCount
, phSummaryInfo
);
86 return ERROR_INVALID_PARAMETER
;
92 res
= MsiOpenDatabaseW(szDatabase
, NULL
, &hdb
);
93 if( res
!= ERROR_SUCCESS
)
97 db
= msihandle2msiinfo(hdb
, MSIHANDLETYPE_DATABASE
);
99 return ERROR_INVALID_PARAMETER
;
101 r
= IStorage_QueryInterface( db
->storage
,
102 &IID_IPropertySetStorage
, (LPVOID
)&psstg
);
105 ERR("IStorage -> IPropertySetStorage failed\n");
106 return ERROR_FUNCTION_FAILED
;
108 ERR("storage = %p propertysetstorage = %p\n", db
->storage
, psstg
);
110 grfMode
= STGM_READ
| STGM_SHARE_EXCLUSIVE
;
111 r
= IPropertySetStorage_Open( psstg
, &FMTID_SummaryInformation
, grfMode
, &ps
);
114 ERR("failed to get IPropertyStorage r=%08lx\n",r
);
115 ret
= ERROR_FUNCTION_FAILED
;
119 handle
= alloc_msihandle( MSIHANDLETYPE_SUMMARYINFO
,
120 sizeof (MSISUMMARYINFO
), MSI_CloseSummaryInfo
);
123 ret
= ERROR_FUNCTION_FAILED
;
127 suminfo
= msihandle2msiinfo( handle
, MSIHANDLETYPE_SUMMARYINFO
);
130 ret
= ERROR_FUNCTION_FAILED
;
134 IPropertyStorage_AddRef(ps
);
135 suminfo
->propstg
= ps
;
136 *phSummaryInfo
= handle
;
140 IPropertyStorage_Release(ps
);
142 IPropertySetStorage_Release(psstg
);
144 MsiCloseHandle( hdb
);
149 UINT WINAPI
MsiSummaryInfoGetPropertyCount(MSIHANDLE hSummaryInfo
, UINT
*pCount
)
151 MSISUMMARYINFO
*suminfo
;
153 FIXME("%ld %p\n",hSummaryInfo
, pCount
);
155 suminfo
= msihandle2msiinfo( hSummaryInfo
, MSIHANDLETYPE_SUMMARYINFO
);
157 return ERROR_INVALID_HANDLE
;
159 return ERROR_CALL_NOT_IMPLEMENTED
;
162 UINT WINAPI
MsiSummaryInfoGetPropertyA(
163 MSIHANDLE hSummaryInfo
, UINT uiProperty
, UINT
*puiDataType
, INT
*piValue
,
164 FILETIME
*pftValue
, LPSTR szValueBuf
, DWORD
*pcchValueBuf
)
166 MSISUMMARYINFO
*suminfo
;
171 TRACE("%ld %d %p %p %p %p %p\n",
172 hSummaryInfo
, uiProperty
, puiDataType
, piValue
,
173 pftValue
, szValueBuf
, pcchValueBuf
);
175 suminfo
= msihandle2msiinfo( hSummaryInfo
, MSIHANDLETYPE_SUMMARYINFO
);
177 return ERROR_INVALID_HANDLE
;
179 spec
.ulKind
= PRSPEC_PROPID
;
180 spec
.DUMMYUNIONNAME
.propid
= uiProperty
;
182 r
= IPropertyStorage_ReadMultiple( suminfo
->propstg
, 1, &spec
, &var
);
184 return ERROR_FUNCTION_FAILED
;
187 *puiDataType
= var
.vt
;
193 *piValue
= var
.DUMMYUNIONNAME
.lVal
;
196 if( pcchValueBuf
&& szValueBuf
)
198 lstrcpynA(szValueBuf
, var
.DUMMYUNIONNAME
.pszVal
, *pcchValueBuf
);
199 *pcchValueBuf
= lstrlenA( var
.DUMMYUNIONNAME
.pszVal
);
204 memcpy(pftValue
, &var
.DUMMYUNIONNAME
.filetime
, sizeof (FILETIME
) );
209 FIXME("Unknown property variant type\n");
213 return ERROR_SUCCESS
;
216 UINT WINAPI
MsiSummaryInfoGetPropertyW(
217 MSIHANDLE hSummaryInfo
, UINT uiProperty
, UINT
*puiDataType
, INT
*piValue
,
218 FILETIME
*pftValue
, LPWSTR szValueBuf
, DWORD
*pcchValueBuf
)
220 FIXME("%ld %d %p %p %p %p %p\n",
221 hSummaryInfo
, uiProperty
, puiDataType
, piValue
,
222 pftValue
, szValueBuf
, pcchValueBuf
);
224 return ERROR_CALL_NOT_IMPLEMENTED
;