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
27 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(msi
);
35 const WCHAR szSumInfo
[] = { 5 ,'S','u','m','m','a','r','y',
36 'I','n','f','o','r','m','a','t','i','o','n',0 };
38 static void MSI_CloseSummaryInfo( VOID
*arg
)
40 MSISUMMARYINFO
*suminfo
= (MSISUMMARYINFO
*) arg
;
41 IPropertyStorage_Release( suminfo
->propstg
);
44 UINT WINAPI
MsiGetSummaryInformationA(MSIHANDLE hDatabase
,
45 LPCSTR szDatabase
, UINT uiUpdateCount
, MSIHANDLE
*phSummaryInfo
)
47 LPWSTR szwDatabase
= NULL
;
50 TRACE("%ld %s %d %p\n", hDatabase
, debugstr_a(szDatabase
),
51 uiUpdateCount
, phSummaryInfo
);
55 szwDatabase
= HEAP_strdupAtoW( GetProcessHeap(), 0, szDatabase
);
57 return ERROR_FUNCTION_FAILED
;
60 ret
= MsiGetSummaryInformationW(hDatabase
, szwDatabase
, uiUpdateCount
, phSummaryInfo
);
63 HeapFree( GetProcessHeap(), 0, szwDatabase
);
68 UINT WINAPI
MsiGetSummaryInformationW(MSIHANDLE hDatabase
,
69 LPCWSTR szDatabase
, UINT uiUpdateCount
, MSIHANDLE
*phSummaryInfo
)
72 MSIHANDLE handle
, hdb
= hDatabase
;
73 MSISUMMARYINFO
*suminfo
;
75 UINT ret
= ERROR_SUCCESS
;
76 IPropertySetStorage
*psstg
= NULL
;
77 IPropertyStorage
*ps
= NULL
;
80 TRACE("%ld %s %d %p\n", hDatabase
, debugstr_w(szDatabase
),
81 uiUpdateCount
, phSummaryInfo
);
84 return ERROR_INVALID_PARAMETER
;
90 res
= MsiOpenDatabaseW(szDatabase
, NULL
, &hdb
);
91 if( res
!= ERROR_SUCCESS
)
95 db
= msihandle2msiinfo(hdb
, MSIHANDLETYPE_DATABASE
);
97 return ERROR_INVALID_PARAMETER
;
99 r
= IStorage_QueryInterface( db
->storage
,
100 &IID_IPropertySetStorage
, (LPVOID
)&psstg
);
103 ERR("IStorage -> IPropertySetStorage failed\n");
104 return ERROR_FUNCTION_FAILED
;
106 ERR("storage = %p propertysetstorage = %p\n", db
->storage
, psstg
);
108 grfMode
= STGM_READ
| STGM_SHARE_EXCLUSIVE
;
109 r
= IPropertySetStorage_Open( psstg
, &FMTID_SummaryInformation
, grfMode
, &ps
);
112 ERR("failed to get IPropertyStorage r=%08lx\n",r
);
113 ret
= ERROR_FUNCTION_FAILED
;
117 handle
= alloc_msihandle( MSIHANDLETYPE_SUMMARYINFO
,
118 sizeof (MSISUMMARYINFO
), MSI_CloseSummaryInfo
);
121 ret
= ERROR_FUNCTION_FAILED
;
125 suminfo
= msihandle2msiinfo( handle
, MSIHANDLETYPE_SUMMARYINFO
);
128 ret
= ERROR_FUNCTION_FAILED
;
132 IPropertyStorage_AddRef(ps
);
133 suminfo
->propstg
= ps
;
134 *phSummaryInfo
= handle
;
138 IPropertyStorage_Release(ps
);
140 IPropertySetStorage_Release(psstg
);
142 MsiCloseHandle( hdb
);
147 UINT WINAPI
MsiSummaryInfoGetPropertyCount(MSIHANDLE hSummaryInfo
, UINT
*pCount
)
149 MSISUMMARYINFO
*suminfo
;
151 FIXME("%ld %p\n",hSummaryInfo
, pCount
);
153 suminfo
= msihandle2msiinfo( hSummaryInfo
, MSIHANDLETYPE_SUMMARYINFO
);
155 return ERROR_INVALID_HANDLE
;
157 return ERROR_CALL_NOT_IMPLEMENTED
;
160 UINT WINAPI
MsiSummaryInfoGetPropertyA(
161 MSIHANDLE hSummaryInfo
, UINT uiProperty
, UINT
*puiDataType
, INT
*piValue
,
162 FILETIME
*pftValue
, LPSTR szValueBuf
, DWORD
*pcchValueBuf
)
164 MSISUMMARYINFO
*suminfo
;
169 TRACE("%ld %d %p %p %p %p %p\n",
170 hSummaryInfo
, uiProperty
, puiDataType
, piValue
,
171 pftValue
, szValueBuf
, pcchValueBuf
);
173 suminfo
= msihandle2msiinfo( hSummaryInfo
, MSIHANDLETYPE_SUMMARYINFO
);
175 return ERROR_INVALID_HANDLE
;
177 spec
.ulKind
= PRSPEC_PROPID
;
178 spec
.DUMMYUNIONNAME
.propid
= uiProperty
;
180 r
= IPropertyStorage_ReadMultiple( suminfo
->propstg
, 1, &spec
, &var
);
182 return ERROR_FUNCTION_FAILED
;
185 *puiDataType
= var
.vt
;
191 *piValue
= var
.DUMMYUNIONNAME
.lVal
;
194 if( pcchValueBuf
&& szValueBuf
)
196 lstrcpynA(szValueBuf
, var
.DUMMYUNIONNAME
.pszVal
, *pcchValueBuf
);
197 *pcchValueBuf
= lstrlenA( var
.DUMMYUNIONNAME
.pszVal
);
202 memcpy(pftValue
, &var
.DUMMYUNIONNAME
.filetime
, sizeof (FILETIME
) );
207 FIXME("Unknown property variant type\n");
211 return ERROR_SUCCESS
;
214 UINT WINAPI
MsiSummaryInfoGetPropertyW(
215 MSIHANDLE hSummaryInfo
, UINT uiProperty
, UINT
*puiDataType
, INT
*piValue
,
216 FILETIME
*pftValue
, LPWSTR szValueBuf
, DWORD
*pcchValueBuf
)
218 FIXME("%ld %d %p %p %p %p %p\n",
219 hSummaryInfo
, uiProperty
, puiDataType
, piValue
,
220 pftValue
, szValueBuf
, pcchValueBuf
);
222 return ERROR_CALL_NOT_IMPLEMENTED
;