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
30 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msi
);
38 static const WCHAR szSumInfo
[] = { 5 ,'S','u','m','m','a','r','y',
39 'I','n','f','o','r','m','a','t','i','o','n',0 };
41 static void MSI_CloseSummaryInfo( MSIOBJECTHDR
*arg
)
43 MSISUMMARYINFO
*suminfo
= (MSISUMMARYINFO
*) arg
;
44 IPropertyStorage_Release( suminfo
->propstg
);
47 UINT WINAPI
MsiGetSummaryInformationA(MSIHANDLE hDatabase
,
48 LPCSTR szDatabase
, UINT uiUpdateCount
, MSIHANDLE
*phSummaryInfo
)
50 LPWSTR szwDatabase
= NULL
;
53 TRACE("%ld %s %d %p\n", hDatabase
, debugstr_a(szDatabase
),
54 uiUpdateCount
, phSummaryInfo
);
58 UINT len
= MultiByteToWideChar( CP_ACP
, 0, szDatabase
, -1, NULL
, 0 );
59 szwDatabase
= HeapAlloc( GetProcessHeap(), 0, len
*sizeof(WCHAR
) );
61 return ERROR_FUNCTION_FAILED
;
62 MultiByteToWideChar( CP_ACP
, 0, szDatabase
, -1, szwDatabase
, len
);
65 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");
112 msiobj_release(&db
->hdr
);
113 return ERROR_FUNCTION_FAILED
;
115 ERR("storage = %p propertysetstorage = %p\n", db
->storage
, psstg
);
117 grfMode
= STGM_READ
| STGM_SHARE_EXCLUSIVE
;
118 r
= IPropertySetStorage_Open( psstg
, &FMTID_SummaryInformation
, grfMode
, &ps
);
121 ERR("failed to get IPropertyStorage r=%08lx\n",r
);
122 ret
= ERROR_FUNCTION_FAILED
;
126 suminfo
= alloc_msiobject( MSIHANDLETYPE_SUMMARYINFO
,
127 sizeof (MSISUMMARYINFO
), MSI_CloseSummaryInfo
);
130 ret
= ERROR_FUNCTION_FAILED
;
134 IPropertyStorage_AddRef(ps
);
135 suminfo
->propstg
= ps
;
136 handle
= alloc_msihandle( &suminfo
->hdr
);
138 *phSummaryInfo
= handle
;
140 ret
= ERROR_FUNCTION_FAILED
;
141 msiobj_release( &suminfo
->hdr
);
145 IPropertyStorage_Release(ps
);
147 IPropertySetStorage_Release(psstg
);
149 msiobj_release(&db
->hdr
);
154 UINT WINAPI
MsiSummaryInfoGetPropertyCount(MSIHANDLE hSummaryInfo
, UINT
*pCount
)
156 MSISUMMARYINFO
*suminfo
;
158 FIXME("%ld %p\n",hSummaryInfo
, pCount
);
160 suminfo
= msihandle2msiinfo( hSummaryInfo
, MSIHANDLETYPE_SUMMARYINFO
);
162 return ERROR_INVALID_HANDLE
;
164 return ERROR_CALL_NOT_IMPLEMENTED
;
167 UINT WINAPI
MsiSummaryInfoGetPropertyA(
168 MSIHANDLE hSummaryInfo
, UINT uiProperty
, UINT
*puiDataType
, INT
*piValue
,
169 FILETIME
*pftValue
, LPSTR szValueBuf
, DWORD
*pcchValueBuf
)
171 MSISUMMARYINFO
*suminfo
;
176 TRACE("%ld %d %p %p %p %p %p\n",
177 hSummaryInfo
, uiProperty
, puiDataType
, piValue
,
178 pftValue
, szValueBuf
, pcchValueBuf
);
180 suminfo
= msihandle2msiinfo( hSummaryInfo
, MSIHANDLETYPE_SUMMARYINFO
);
182 return ERROR_INVALID_HANDLE
;
184 spec
.ulKind
= PRSPEC_PROPID
;
185 spec
.u
.propid
= uiProperty
;
187 r
= IPropertyStorage_ReadMultiple( suminfo
->propstg
, 1, &spec
, &var
);
189 return ERROR_FUNCTION_FAILED
;
192 *puiDataType
= var
.vt
;
198 *piValue
= var
.u
.lVal
;
201 if( pcchValueBuf
&& szValueBuf
)
203 lstrcpynA(szValueBuf
, var
.u
.pszVal
, *pcchValueBuf
);
204 *pcchValueBuf
= lstrlenA( var
.u
.pszVal
);
209 memcpy(pftValue
, &var
.u
.filetime
, sizeof (FILETIME
) );
214 FIXME("Unknown property variant type\n");
218 return ERROR_SUCCESS
;
221 UINT WINAPI
MsiSummaryInfoGetPropertyW(
222 MSIHANDLE hSummaryInfo
, UINT uiProperty
, UINT
*puiDataType
, INT
*piValue
,
223 FILETIME
*pftValue
, LPWSTR szValueBuf
, DWORD
*pcchValueBuf
)
225 FIXME("%ld %d %p %p %p %p %p\n",
226 hSummaryInfo
, uiProperty
, puiDataType
, piValue
,
227 pftValue
, szValueBuf
, pcchValueBuf
);
229 return ERROR_CALL_NOT_IMPLEMENTED
;