ReactOS  0.4.11-dev-201-g2a6aa77
suminfo.c File Reference
#include <stdarg.h>
#include "stdio.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winnls.h"
#include "shlwapi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "msi.h"
#include "msiquery.h"
#include "msidefs.h"
#include "msipriv.h"
#include "objidl.h"
#include "propvarutil.h"
#include "msiserver.h"
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for suminfo.c:

Go to the source code of this file.

Classes

struct  PROPERTYSETHEADER
 
struct  FORMATIDOFFSET
 
struct  PROPERTYSECTIONHEADER
 
struct  PROPERTYIDOFFSET
 
struct  PROPERTY_DATA
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define SECT_HDR_SIZE   (sizeof(PROPERTYSECTIONHEADER))
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msi)
 
static HRESULT (WINAPI *pPropVariantChangeType)(PROPVARIANT *ppropvarDest
 
static void free_prop (PROPVARIANT *prop)
 
static void MSI_CloseSummaryInfo (MSIOBJECTHDR *arg)
 
static UINT get_type (UINT uiProperty)
 
static UINT get_property_count (const PROPVARIANT *property)
 
static UINT propvar_changetype (PROPVARIANT *changed, PROPVARIANT *property, VARTYPE vt)
 
static void read_properties_from_data (PROPVARIANT *prop, LPBYTE data, DWORD sz)
 
static UINT load_summary_info (MSISUMMARYINFO *si, IStream *stm)
 
static DWORD write_dword (LPBYTE data, DWORD ofs, DWORD val)
 
static DWORD write_filetime (LPBYTE data, DWORD ofs, const FILETIME *ft)
 
static DWORD write_string (LPBYTE data, DWORD ofs, LPCSTR str)
 
static UINT write_property_to_data (const PROPVARIANT *prop, LPBYTE data)
 
static UINT save_summary_info (const MSISUMMARYINFO *si, IStream *stm)
 
static MSISUMMARYINFOcreate_suminfo (IStorage *stg, UINT update_count)
 
UINT msi_get_suminfo (IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **ret)
 
UINT msi_get_db_suminfo (MSIDATABASE *db, UINT uiUpdateCount, MSISUMMARYINFO **ret)
 
UINT WINAPI MsiGetSummaryInformationW (MSIHANDLE hDatabase, LPCWSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
 
UINT WINAPI MsiGetSummaryInformationA (MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
 
UINT WINAPI MsiSummaryInfoGetPropertyCount (MSIHANDLE hSummaryInfo, PUINT pCount)
 
static UINT get_prop (MSISUMMARYINFO *si, UINT uiProperty, UINT *puiDataType, INT *piValue, FILETIME *pftValue, awstring *str, DWORD *pcchValueBuf)
 
LPWSTR msi_suminfo_dup_string (MSISUMMARYINFO *si, UINT uiProperty)
 
INT msi_suminfo_get_int32 (MSISUMMARYINFO *si, UINT uiProperty)
 
LPWSTR msi_get_suminfo_product (IStorage *stg)
 
UINT WINAPI MsiSummaryInfoGetPropertyA (MSIHANDLE handle, UINT uiProperty, PUINT puiDataType, LPINT piValue, FILETIME *pftValue, LPSTR szValueBuf, LPDWORD pcchValueBuf)
 
UINT WINAPI MsiSummaryInfoGetPropertyW (MSIHANDLE handle, UINT uiProperty, PUINT puiDataType, LPINT piValue, FILETIME *pftValue, LPWSTR szValueBuf, LPDWORD pcchValueBuf)
 
static UINT set_prop (MSISUMMARYINFO *si, UINT uiProperty, UINT type, INT iValue, FILETIME *pftValue, awcstring *str)
 
UINT WINAPI MsiSummaryInfoSetPropertyW (MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCWSTR szValue)
 
UINT WINAPI MsiSummaryInfoSetPropertyA (MSIHANDLE handle, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, LPCSTR szValue)
 
static UINT suminfo_persist (MSISUMMARYINFO *si)
 
static void parse_filetime (LPCWSTR str, FILETIME *ft)
 
static UINT parse_prop (LPCWSTR prop, LPCWSTR value, UINT *pid, INT *int_value, FILETIME *ft_value, awcstring *str_value)
 
UINT msi_add_suminfo (MSIDATABASE *db, LPWSTR **records, int num_records, int num_columns)
 
static UINT save_prop (MSISUMMARYINFO *si, HANDLE handle, UINT row)
 
UINT msi_export_suminfo (MSIDATABASE *db, HANDLE handle)
 
UINT WINAPI MsiSummaryInfoPersist (MSIHANDLE handle)
 
UINT WINAPI MsiCreateTransformSummaryInfoA (MSIHANDLE db, MSIHANDLE db_ref, LPCSTR transform, int error, int validation)
 
UINT WINAPI MsiCreateTransformSummaryInfoW (MSIHANDLE db, MSIHANDLE db_ref, LPCWSTR transform, int error, int validation)
 
UINT msi_load_suminfo_properties (MSIPACKAGE *package)
 

Variables

static REFPROPVARIANT propvarSrc
 
static REFPROPVARIANT
PROPVAR_CHANGE_FLAGS 
flags
 
static REFPROPVARIANT
PROPVAR_CHANGE_FLAGS VARTYPE 
vt
 

Macro Definition Documentation

#define COBJMACROS

Definition at line 23 of file suminfo.c.

#define NONAMELESSUNION

Definition at line 24 of file suminfo.c.

#define SECT_HDR_SIZE   (sizeof(PROPERTYSECTIONHEADER))

Definition at line 88 of file suminfo.c.

Referenced by load_summary_info(), and read_properties_from_data().

Function Documentation

static MSISUMMARYINFO* create_suminfo ( IStorage stg,
UINT  update_count 
)
static

Definition at line 443 of file suminfo.c.

Referenced by msi_add_suminfo(), msi_get_db_suminfo(), msi_get_suminfo(), and MsiGetSummaryInformationW().

444 {
445  MSISUMMARYINFO *si;
446 
448  return NULL;
449 
450  si->update_count = update_count;
451  IStorage_AddRef( stg );
452  si->storage = stg;
453 
454  return si;
455 }
IStorage * storage
Definition: msipriv.h:464
#define MSIHANDLETYPE_SUMMARYINFO
Definition: msipriv.h:700
void * alloc_msiobject(UINT type, UINT size, msihandledestructor destroy)
Definition: handle.c:202
smooth NULL
Definition: ftsmooth.c:416
static void MSI_CloseSummaryInfo(MSIOBJECTHDR *arg)
Definition: suminfo.c:97
DWORD update_count
Definition: msipriv.h:465
static void free_prop ( PROPVARIANT *  prop)
static

Definition at line 90 of file suminfo.c.

Referenced by MSI_CloseSummaryInfo(), and set_prop().

91 {
92  if (prop->vt == VT_LPSTR )
93  msi_free( prop->u.pszVal );
94  prop->vt = VT_EMPTY;
95 }
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static UINT get_prop ( MSISUMMARYINFO si,
UINT  uiProperty,
UINT puiDataType,
INT piValue,
FILETIME pftValue,
awstring str,
DWORD pcchValueBuf 
)
static

Definition at line 626 of file suminfo.c.

Referenced by msi_load_suminfo_properties(), MsiSummaryInfoGetPropertyA(), MsiSummaryInfoGetPropertyW(), and save_prop().

628 {
629  PROPVARIANT *prop;
631 
632  prop = &si->property[uiProperty];
633 
634  if( puiDataType )
635  *puiDataType = prop->vt;
636 
637  switch( prop->vt )
638  {
639  case VT_I2:
640  if( piValue )
641  *piValue = prop->u.iVal;
642  break;
643  case VT_I4:
644  if( piValue )
645  *piValue = prop->u.lVal;
646  break;
647  case VT_LPSTR:
648  if( pcchValueBuf )
649  {
650  DWORD len = 0;
651 
652  if( str->unicode )
653  {
654  len = MultiByteToWideChar( CP_ACP, 0, prop->u.pszVal, -1, NULL, 0 ) - 1;
655  MultiByteToWideChar( CP_ACP, 0, prop->u.pszVal, -1, str->str.w, *pcchValueBuf );
656  }
657  else
658  {
659  len = lstrlenA( prop->u.pszVal );
660  if( str->str.a )
661  lstrcpynA(str->str.a, prop->u.pszVal, *pcchValueBuf );
662  }
663  if (len >= *pcchValueBuf)
664  ret = ERROR_MORE_DATA;
665  *pcchValueBuf = len;
666  }
667  break;
668  case VT_FILETIME:
669  if( pftValue )
670  *pftValue = prop->u.filetime;
671  break;
672  case VT_EMPTY:
673  break;
674  default:
675  FIXME("Unknown property variant type\n");
676  break;
677  }
678  return ret;
679 }
Definition: compat.h:1932
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CP_ACP
Definition: compat.h:99
LPWSTR w
Definition: msipriv.h:720
DWORD DWORD
Definition: winlogon.h:84
#define FIXME(fmt,...)
Definition: debug.h:110
union awstring::@483 str
smooth NULL
Definition: ftsmooth.c:416
LPSTR a
Definition: msipriv.h:719
int int * piValue
Definition: wglext.h:523
int ret
GLenum GLsizei len
Definition: glext.h:6722
PROPVARIANT property[MSI_MAX_PROPS]
Definition: msipriv.h:466
#define ERROR_MORE_DATA
Definition: dderror.h:13
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
BOOL unicode
Definition: msipriv.h:717
unsigned int UINT
Definition: ndis.h:50
#define lstrcpynA
Definition: compat.h:408
#define MultiByteToWideChar
Definition: compat.h:100
Definition: compat.h:1931
static UINT get_property_count ( const PROPVARIANT *  property)
static

Definition at line 153 of file suminfo.c.

Referenced by msi_export_suminfo(), MsiSummaryInfoGetPropertyCount(), and save_summary_info().

154 {
155  UINT i, n = 0;
156 
157  if( !property )
158  return n;
159  for( i = 0; i < MSI_MAX_PROPS; i++ )
160  if( property[i].vt != VT_EMPTY )
161  n++;
162  return n;
163 }
GLuint n
Definition: s_context.h:57
GLenum GLclampf GLint i
Definition: glfuncs.h:14
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
unsigned int UINT
Definition: ndis.h:50
#define MSI_MAX_PROPS
Definition: msipriv.h:459
static UINT get_type ( UINT  uiProperty)
static

Definition at line 113 of file suminfo.c.

Referenced by msi_add_suminfo(), MsiSummaryInfoSetPropertyA(), MsiSummaryInfoSetPropertyW(), and read_properties_from_data().

114 {
115  switch( uiProperty )
116  {
117 #ifdef __REACTOS__
118  case PID_CODEPAGE_MSI:
119 #else
120  case PID_CODEPAGE:
121 #endif
122  return VT_I2;
123 
124  case PID_SUBJECT:
125  case PID_AUTHOR:
126  case PID_KEYWORDS:
127  case PID_COMMENTS:
128  case PID_TEMPLATE:
129  case PID_LASTAUTHOR:
130  case PID_REVNUMBER:
131  case PID_APPNAME:
132  case PID_TITLE:
133  return VT_LPSTR;
134 
135  case PID_LASTPRINTED:
136  case PID_CREATE_DTM:
137  case PID_LASTSAVE_DTM:
138  return VT_FILETIME;
139 
140  case PID_WORDCOUNT:
141  case PID_CHARCOUNT:
142 #ifdef __REACTOS__
143  case PID_SECURITY_MSI:
144 #else
145  case PID_SECURITY:
146 #endif
147  case PID_PAGECOUNT:
148  return VT_I4;
149  }
150  return VT_EMPTY;
151 }
#define PID_TEMPLATE
Definition: suminfo.c:49
Definition: compat.h:1932
#define PID_CHARCOUNT
Definition: suminfo.c:58
#define PID_COMMENTS
Definition: suminfo.c:48
#define PID_REVNUMBER
Definition: suminfo.c:51
#define PID_CODEPAGE
Definition: suminfo.c:43
#define PID_LASTPRINTED
Definition: suminfo.c:53
#define PID_LASTAUTHOR
Definition: suminfo.c:50
#define PID_LASTSAVE_DTM
Definition: suminfo.c:55
#define PID_AUTHOR
Definition: suminfo.c:46
#define PID_PAGECOUNT
Definition: suminfo.c:56
#define PID_APPNAME
Definition: suminfo.c:60
#define PID_TITLE
Definition: suminfo.c:44
#define PID_SUBJECT
Definition: suminfo.c:45
#define PID_KEYWORDS
Definition: suminfo.c:47
#define PID_CREATE_DTM
Definition: suminfo.c:54
#define PID_SECURITY
Definition: suminfo.c:61
#define PID_WORDCOUNT
Definition: suminfo.c:57
Definition: compat.h:1931
static HRESULT ( WINAPI pPropVariantChangeType)
static
static UINT load_summary_info ( MSISUMMARYINFO si,
IStream stm 
)
static

Definition at line 251 of file suminfo.c.

Referenced by msi_get_db_suminfo(), and msi_get_suminfo().

252 {
253  PROPERTYSETHEADER set_hdr;
254  FORMATIDOFFSET format_hdr;
255  PROPERTYSECTIONHEADER section_hdr;
256  LPBYTE data = NULL;
257  LARGE_INTEGER ofs;
258  ULONG count, sz;
259  HRESULT r;
260 
261  TRACE("%p %p\n", si, stm);
262 
263  /* read the header */
264  sz = sizeof set_hdr;
265  r = IStream_Read( stm, &set_hdr, sz, &count );
266  if( FAILED(r) || count != sz )
267  return ERROR_FUNCTION_FAILED;
268 
269  if( set_hdr.wByteOrder != 0xfffe )
270  {
271  ERR("property set not big-endian %04X\n", set_hdr.wByteOrder);
272  return ERROR_FUNCTION_FAILED;
273  }
274 
275  sz = sizeof format_hdr;
276  r = IStream_Read( stm, &format_hdr, sz, &count );
277  if( FAILED(r) || count != sz )
278  return ERROR_FUNCTION_FAILED;
279 
280  /* check the format id is correct */
281  if( !IsEqualGUID( &FMTID_SummaryInformation, &format_hdr.fmtid ) )
282  return ERROR_FUNCTION_FAILED;
283 
284  /* seek to the location of the section */
285  ofs.QuadPart = format_hdr.dwOffset;
286  r = IStream_Seek( stm, ofs, STREAM_SEEK_SET, NULL );
287  if( FAILED(r) )
288  return ERROR_FUNCTION_FAILED;
289 
290  /* read the section itself */
291  sz = SECT_HDR_SIZE;
292  r = IStream_Read( stm, &section_hdr, sz, &count );
293  if( FAILED(r) || count != sz )
294  return ERROR_FUNCTION_FAILED;
295 
296  if( section_hdr.cProperties > MSI_MAX_PROPS )
297  {
298  ERR("too many properties %d\n", section_hdr.cProperties);
299  return ERROR_FUNCTION_FAILED;
300  }
301 
302  data = msi_alloc( section_hdr.cbSection);
303  if( !data )
304  return ERROR_FUNCTION_FAILED;
305 
306  memcpy( data, &section_hdr, SECT_HDR_SIZE );
307 
308  /* read all the data in one go */
309  sz = section_hdr.cbSection - SECT_HDR_SIZE;
310  r = IStream_Read( stm, &data[ SECT_HDR_SIZE ], sz, &count );
311  if( SUCCEEDED(r) && count == sz )
313  else
314  ERR("failed to read properties %d %d\n", count, sz);
315 
316  msi_free( data );
317  return ERROR_SUCCESS;
318 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned char * LPBYTE
Definition: typedefs.h:52
FMTID fmtid
Definition: suminfo.c:55
const FMTID FMTID_SummaryInformation
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
smooth NULL
Definition: ftsmooth.c:416
DWORD dwOffset
Definition: suminfo.c:56
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
PROPVARIANT property[MSI_MAX_PROPS]
Definition: msipriv.h:466
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
unsigned int ULONG
Definition: retypes.h:1
#define MSI_MAX_PROPS
Definition: msipriv.h:459
static void read_properties_from_data(PROPVARIANT *prop, LPBYTE data, DWORD sz)
Definition: suminfo.c:182
#define SECT_HDR_SIZE
Definition: suminfo.c:88
#define SUCCEEDED(hr)
Definition: intsafe.h:57
LONGLONG QuadPart
Definition: typedefs.h:112
UINT msi_add_suminfo ( MSIDATABASE db,
LPWSTR **  records,
int  num_records,
int  num_columns 
)

Definition at line 1000 of file suminfo.c.

Referenced by MSI_DatabaseImport().

1001 {
1002  UINT r;
1003  int i, j;
1004  MSISUMMARYINFO *si;
1005 
1006  r = msi_get_suminfo( db->storage, num_records * (num_columns / 2), &si );
1007  if (r != ERROR_SUCCESS)
1008  {
1009  if (!(si = create_suminfo( db->storage, num_records * (num_columns / 2) )))
1010  return ERROR_OUTOFMEMORY;
1011  r = ERROR_SUCCESS;
1012  }
1013 
1014  for (i = 0; i < num_records; i++)
1015  {
1016  for (j = 0; j < num_columns; j += 2)
1017  {
1018  UINT pid;
1019  INT int_value = 0;
1020  FILETIME ft_value;
1021  awcstring str_value;
1022 
1023  r = parse_prop( records[i][j], records[i][j + 1], &pid, &int_value, &ft_value, &str_value );
1024  if (r != ERROR_SUCCESS)
1025  goto end;
1026 
1027  r = set_prop( si, pid, get_type(pid), int_value, &ft_value, &str_value );
1028  if (r != ERROR_SUCCESS)
1029  goto end;
1030  }
1031  }
1032 
1033 end:
1034  if (r == ERROR_SUCCESS)
1035  r = suminfo_persist( si );
1036 
1037  msiobj_release( &si->hdr );
1038  return r;
1039 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint end
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
GLenum GLclampf GLint i
Definition: glfuncs.h:14
static UINT get_type(UINT uiProperty)
Definition: suminfo.c:113
static UINT suminfo_persist(MSISUMMARYINFO *si)
Definition: suminfo.c:894
static MSISUMMARYINFO * create_suminfo(IStorage *stg, UINT update_count)
Definition: suminfo.c:443
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
static UINT set_prop(MSISUMMARYINFO *si, UINT uiProperty, UINT type, INT iValue, FILETIME *pftValue, awcstring *str)
Definition: suminfo.c:778
unsigned int UINT
Definition: ndis.h:50
UINT msi_get_suminfo(IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **ret)
Definition: suminfo.c:457
static UINT parse_prop(LPCWSTR prop, LPCWSTR value, UINT *pid, INT *int_value, FILETIME *ft_value, awcstring *str_value)
Definition: suminfo.c:951
IStorage * storage
Definition: msipriv.h:98
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
static void MSI_CloseSummaryInfo ( MSIOBJECTHDR arg)
static

Definition at line 97 of file suminfo.c.

Referenced by create_suminfo().

98 {
99  MSISUMMARYINFO *si = (MSISUMMARYINFO *) arg;
100  DWORD i;
101 
102  for( i = 0; i < MSI_MAX_PROPS; i++ )
103  free_prop( &si->property[i] );
104  IStorage_Release( si->storage );
105 }
IStorage * storage
Definition: msipriv.h:464
static void free_prop(PROPVARIANT *prop)
Definition: suminfo.c:90
DWORD DWORD
Definition: winlogon.h:84
GLenum GLclampf GLint i
Definition: glfuncs.h:14
PROPVARIANT property[MSI_MAX_PROPS]
Definition: msipriv.h:466
#define MSI_MAX_PROPS
Definition: msipriv.h:459
UINT msi_export_suminfo ( MSIDATABASE db,
HANDLE  handle 
)

Definition at line 1120 of file suminfo.c.

Referenced by msi_export_summaryinformation().

1121 {
1122  UINT i, r, num_rows;
1123  MSISUMMARYINFO *si;
1124 
1125  r = msi_get_suminfo( db->storage, 0, &si );
1126  if (r != ERROR_SUCCESS)
1127  r = msi_get_db_suminfo( db, 0, &si );
1128  if (r != ERROR_SUCCESS)
1129  return r;
1130 
1131  num_rows = get_property_count( si->property );
1132  if (!num_rows)
1133  {
1134  msiobj_release( &si->hdr );
1135  return ERROR_FUNCTION_FAILED;
1136  }
1137 
1138  for (i = 0; i < num_rows; i++)
1139  {
1140  r = save_prop( si, handle, i );
1141  if (r != ERROR_SUCCESS)
1142  {
1143  msiobj_release( &si->hdr );
1144  return r;
1145  }
1146  }
1147 
1148  msiobj_release( &si->hdr );
1149  return ERROR_SUCCESS;
1150 }
static UINT save_prop(MSISUMMARYINFO *si, HANDLE handle, UINT row)
Definition: suminfo.c:1041
#define ERROR_SUCCESS
Definition: deptool.c:10
static UINT get_property_count(const PROPVARIANT *property)
Definition: suminfo.c:153
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT msi_get_db_suminfo(MSIDATABASE *db, UINT uiUpdateCount, MSISUMMARYINFO **ret)
Definition: suminfo.c:487
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
int JSAMPARRAY int int num_rows
Definition: jpegint.h:412
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
PROPVARIANT property[MSI_MAX_PROPS]
Definition: msipriv.h:466
unsigned int UINT
Definition: ndis.h:50
UINT msi_get_suminfo(IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **ret)
Definition: suminfo.c:457
IStorage * storage
Definition: msipriv.h:98
UINT msi_get_db_suminfo ( MSIDATABASE db,
UINT  uiUpdateCount,
MSISUMMARYINFO **  ret 
)

Definition at line 487 of file suminfo.c.

Referenced by get_package_code(), msi_export_suminfo(), msi_load_suminfo_properties(), MSI_OpenPackageW(), and MsiGetSummaryInformationW().

488 {
489  IStream *stm;
490  MSISUMMARYINFO *si;
491  UINT r;
492 
493  if (!(si = create_suminfo( db->storage, uiUpdateCount ))) return ERROR_OUTOFMEMORY;
494 
495  r = msi_get_stream( db, szSumInfo, &stm );
496  if (r != ERROR_SUCCESS)
497  {
498  msiobj_release( &si->hdr );
499  return r;
500  }
501 
502  r = load_summary_info( si, stm );
503  IStream_Release( stm );
504  if (r != ERROR_SUCCESS)
505  {
506  msiobj_release( &si->hdr );
507  return r;
508  }
509 
510  *ret = si;
511  return ERROR_SUCCESS;
512 }
UINT msi_get_stream(MSIDATABASE *, const WCHAR *, IStream **) DECLSPEC_HIDDEN
Definition: streams.c:518
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR szSumInfo[]
Definition: msipriv.h:1145
static UINT load_summary_info(MSISUMMARYINFO *si, IStream *stm)
Definition: suminfo.c:251
static MSISUMMARYINFO * create_suminfo(IStorage *stg, UINT update_count)
Definition: suminfo.c:443
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
unsigned int UINT
Definition: ndis.h:50
IStorage * storage
Definition: msipriv.h:98
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
UINT msi_get_suminfo ( IStorage stg,
UINT  uiUpdateCount,
MSISUMMARYINFO **  ret 
)

Definition at line 457 of file suminfo.c.

Referenced by check_transform_applicable(), get_package_code(), msi_add_suminfo(), MSI_ApplicablePatchW(), msi_apply_patch_package(), msi_apply_registered_patch(), msi_export_suminfo(), msi_get_suminfo_product(), msi_load_suminfo_properties(), MSI_OpenPackageW(), and MsiGetSummaryInformationW().

458 {
459  IStream *stm;
460  MSISUMMARYINFO *si;
461  HRESULT hr;
462  UINT r;
463 
464  TRACE("%p, %u\n", stg, uiUpdateCount);
465 
466  if (!(si = create_suminfo( stg, uiUpdateCount ))) return ERROR_OUTOFMEMORY;
467 
468  hr = IStorage_OpenStream( si->storage, szSumInfo, 0, STGM_READ|STGM_SHARE_EXCLUSIVE, 0, &stm );
469  if (FAILED( hr ))
470  {
471  msiobj_release( &si->hdr );
472  return ERROR_FUNCTION_FAILED;
473  }
474 
475  r = load_summary_info( si, stm );
476  IStream_Release( stm );
477  if (r != ERROR_SUCCESS)
478  {
479  msiobj_release( &si->hdr );
480  return r;
481  }
482 
483  *ret = si;
484  return ERROR_SUCCESS;
485 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
IStorage * storage
Definition: msipriv.h:464
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR szSumInfo[]
Definition: msipriv.h:1145
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
static UINT load_summary_info(MSISUMMARYINFO *si, IStream *stm)
Definition: suminfo.c:251
#define STGM_READ
Definition: objbase.h:916
#define TRACE(s)
Definition: solgame.cpp:4
static MSISUMMARYINFO * create_suminfo(IStorage *stg, UINT update_count)
Definition: suminfo.c:443
LONG HRESULT
Definition: typedefs.h:77
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
unsigned int UINT
Definition: ndis.h:50
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
LPWSTR msi_get_suminfo_product ( IStorage stg)

Definition at line 705 of file suminfo.c.

Referenced by check_transform_applicable().

706 {
707  MSISUMMARYINFO *si;
708  LPWSTR prod;
709  UINT r;
710 
711  r = msi_get_suminfo( stg, 0, &si );
712  if (r != ERROR_SUCCESS)
713  {
714  ERR("no summary information!\n");
715  return NULL;
716  }
718  msiobj_release( &si->hdr );
719  return prod;
720 }
LPWSTR msi_suminfo_dup_string(MSISUMMARYINFO *si, UINT uiProperty)
Definition: suminfo.c:681
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define PID_REVNUMBER
Definition: suminfo.c:51
smooth NULL
Definition: ftsmooth.c:416
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int UINT
Definition: ndis.h:50
UINT msi_get_suminfo(IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **ret)
Definition: suminfo.c:457
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT msi_load_suminfo_properties ( MSIPACKAGE package)

Definition at line 1190 of file suminfo.c.

Referenced by MSI_CreatePackage().

1191 {
1192  static const WCHAR packagecodeW[] = {'P','a','c','k','a','g','e','C','o','d','e',0};
1193  MSISUMMARYINFO *si;
1194  WCHAR *package_code;
1195  UINT r, len;
1196  awstring str;
1197  INT count;
1198 
1199  r = msi_get_suminfo( package->db->storage, 0, &si );
1200  if (r != ERROR_SUCCESS)
1201  {
1202  r = msi_get_db_suminfo( package->db, 0, &si );
1203  if (r != ERROR_SUCCESS)
1204  {
1205  ERR("Unable to open summary information stream %u\n", r);
1206  return r;
1207  }
1208  }
1209 
1210  str.unicode = TRUE;
1211  str.str.w = NULL;
1212  len = 0;
1213  r = get_prop( si, PID_REVNUMBER, NULL, NULL, NULL, &str, &len );
1214  if (r != ERROR_MORE_DATA)
1215  {
1216  WARN("Unable to query revision number %u\n", r);
1217  msiobj_release( &si->hdr );
1218  return ERROR_FUNCTION_FAILED;
1219  }
1220 
1221  len++;
1222  if (!(package_code = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY;
1223  str.str.w = package_code;
1224 
1225  r = get_prop( si, PID_REVNUMBER, NULL, NULL, NULL, &str, &len );
1226  if (r != ERROR_SUCCESS)
1227  {
1228  msi_free( package_code );
1229  msiobj_release( &si->hdr );
1230  return r;
1231  }
1232 
1233  r = msi_set_property( package->db, packagecodeW, package_code, len );
1234  msi_free( package_code );
1235 
1236  count = 0;
1237  get_prop( si, PID_WORDCOUNT, NULL, &count, NULL, NULL, NULL );
1238  package->WordCount = count;
1239 
1240  msiobj_release( &si->hdr );
1241  return r;
1242 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WARN(fmt,...)
Definition: debug.h:111
LPWSTR w
Definition: msipriv.h:720
#define PID_REVNUMBER
Definition: suminfo.c:51
int32_t INT
Definition: typedefs.h:56
UINT msi_get_db_suminfo(MSIDATABASE *db, UINT uiUpdateCount, MSISUMMARYINFO **ret)
Definition: suminfo.c:487
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
const WCHAR * str
union awstring::@483 str
smooth NULL
Definition: ftsmooth.c:416
UINT WordCount
Definition: msipriv.h:436
MSIDATABASE * db
Definition: msipriv.h:386
GLuint GLuint GLsizei count
Definition: gl.h:1545
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERR(fmt,...)
Definition: debug.h:109
BOOL unicode
Definition: msipriv.h:717
static UINT get_prop(MSISUMMARYINFO *si, UINT uiProperty, UINT *puiDataType, INT *piValue, FILETIME *pftValue, awstring *str, DWORD *pcchValueBuf)
Definition: suminfo.c:626
unsigned int UINT
Definition: ndis.h:50
UINT msi_set_property(MSIDATABASE *, const WCHAR *, const WCHAR *, int) DECLSPEC_HIDDEN
Definition: package.c:2149
UINT msi_get_suminfo(IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **ret)
Definition: suminfo.c:457
#define PID_WORDCOUNT
Definition: suminfo.c:57
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
IStorage * storage
Definition: msipriv.h:98
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
LPWSTR msi_suminfo_dup_string ( MSISUMMARYINFO si,
UINT  uiProperty 
)

Definition at line 681 of file suminfo.c.

Referenced by check_transform_applicable(), get_package_code(), msi_check_patch_applicable(), msi_get_suminfo_product(), msi_parse_patch_summary(), and parse_suminfo().

682 {
683  PROPVARIANT *prop;
684 
685  if ( uiProperty >= MSI_MAX_PROPS )
686  return NULL;
687  prop = &si->property[uiProperty];
688  if( prop->vt != VT_LPSTR )
689  return NULL;
690  return strdupAtoW( prop->u.pszVal );
691 }
static LPWSTR strdupAtoW(LPCSTR str)
Definition: hhctrl.h:291
smooth NULL
Definition: ftsmooth.c:416
PROPVARIANT property[MSI_MAX_PROPS]
Definition: msipriv.h:466
#define MSI_MAX_PROPS
Definition: msipriv.h:459
INT msi_suminfo_get_int32 ( MSISUMMARYINFO si,
UINT  uiProperty 
)

Definition at line 693 of file suminfo.c.

Referenced by check_transform_applicable(), and parse_suminfo().

694 {
695  PROPVARIANT *prop;
696 
697  if ( uiProperty >= MSI_MAX_PROPS )
698  return -1;
699  prop = &si->property[uiProperty];
700  if( prop->vt != VT_I4 )
701  return -1;
702  return prop->u.lVal;
703 }
Definition: compat.h:1932
PROPVARIANT property[MSI_MAX_PROPS]
Definition: msipriv.h:466
#define MSI_MAX_PROPS
Definition: msipriv.h:459
UINT WINAPI MsiCreateTransformSummaryInfoA ( MSIHANDLE  db,
MSIHANDLE  db_ref,
LPCSTR  transform,
int  error,
int  validation 
)

Definition at line 1169 of file suminfo.c.

Referenced by generate_transform().

1170 {
1171  UINT r;
1172  WCHAR *transformW = NULL;
1173 
1174  TRACE("%u, %u, %s, %d, %d\n", db, db_ref, debugstr_a(transform), error, validation);
1175 
1176  if (transform && !(transformW = strdupAtoW( transform )))
1177  return ERROR_OUTOFMEMORY;
1178 
1179  r = MsiCreateTransformSummaryInfoW( db, db_ref, transformW, error, validation );
1180  msi_free( transformW );
1181  return r;
1182 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static LPWSTR strdupAtoW(LPCSTR str)
Definition: hhctrl.h:291
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
UINT WINAPI MsiCreateTransformSummaryInfoW(MSIHANDLE db, MSIHANDLE db_ref, LPCWSTR transform, int error, int validation)
Definition: suminfo.c:1184
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
GLuint GLenum GLenum transform
Definition: glext.h:9407
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
UINT WINAPI MsiCreateTransformSummaryInfoW ( MSIHANDLE  db,
MSIHANDLE  db_ref,
LPCWSTR  transform,
int  error,
int  validation 
)

Definition at line 1184 of file suminfo.c.

Referenced by MsiCreateTransformSummaryInfoA().

1185 {
1186  FIXME("%u, %u, %s, %d, %d\n", db, db_ref, debugstr_w(transform), error, validation);
1187  return ERROR_FUNCTION_FAILED;
1188 }
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
GLuint GLenum GLenum transform
Definition: glext.h:9407
UINT WINAPI MsiGetSummaryInformationA ( MSIHANDLE  hDatabase,
LPCSTR  szDatabase,
UINT  uiUpdateCount,
MSIHANDLE pHandle 
)

Definition at line 586 of file suminfo.c.

Referenced by helper_createpackage(), set_admin_summary_info(), set_suminfo(), set_suminfo_prop(), set_summary_dword(), set_summary_info(), set_summary_str(), set_transform_summary_info(), test_emptypackage(), test_streamtable(), test_suminfo(), test_suminfo_import(), test_summary_binary(), and write_msi_summary_info().

588 {
589  LPWSTR szwDatabase = NULL;
590  UINT ret;
591 
592  TRACE("%d %s %d %p\n", hDatabase, debugstr_a(szDatabase),
593  uiUpdateCount, pHandle);
594 
595  if( szDatabase )
596  {
597  szwDatabase = strdupAtoW( szDatabase );
598  if( !szwDatabase )
599  return ERROR_FUNCTION_FAILED;
600  }
601 
602  ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, pHandle);
603 
604  msi_free( szwDatabase );
605 
606  return ret;
607 }
static LPWSTR strdupAtoW(LPCSTR str)
Definition: hhctrl.h:291
UINT WINAPI MsiGetSummaryInformationW(MSIHANDLE hDatabase, LPCWSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:514
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
int ret
static const WCHAR szDatabase[]
Definition: msipriv.h:1183
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT WINAPI MsiGetSummaryInformationW ( MSIHANDLE  hDatabase,
LPCWSTR  szDatabase,
UINT  uiUpdateCount,
MSIHANDLE pHandle 
)

Definition at line 514 of file suminfo.c.

Referenced by database_invoke(), get_patch_product_codes(), InstallerImpl_SummaryInformation(), mrd_GetSummaryInformation(), msi_publish_product_properties(), and MsiGetSummaryInformationA().

516 {
517  MSISUMMARYINFO *si;
518  MSIDATABASE *db;
519  UINT ret;
520 
521  TRACE("%d %s %d %p\n", hDatabase, debugstr_w(szDatabase),
522  uiUpdateCount, pHandle);
523 
524  if( !pHandle )
526 
527  if( szDatabase && szDatabase[0] )
528  {
529  LPCWSTR persist = uiUpdateCount ? MSIDBOPEN_TRANSACT : MSIDBOPEN_READONLY;
530 
531  ret = MSI_OpenDatabaseW( szDatabase, persist, &db );
532  if( ret != ERROR_SUCCESS )
533  return ret;
534  }
535  else
536  {
537  db = msihandle2msiinfo( hDatabase, MSIHANDLETYPE_DATABASE );
538  if( !db )
539  {
540  HRESULT hr;
541  IWineMsiRemoteDatabase *remote_database;
542 
543  remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hDatabase );
544  if ( !remote_database )
545  return ERROR_INVALID_HANDLE;
546 
547  hr = IWineMsiRemoteDatabase_GetSummaryInformation( remote_database,
548  uiUpdateCount, pHandle );
549  IWineMsiRemoteDatabase_Release( remote_database );
550 
551  if (FAILED(hr))
552  {
553  if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
554  return HRESULT_CODE(hr);
555 
556  return ERROR_FUNCTION_FAILED;
557  }
558 
559  return ERROR_SUCCESS;
560  }
561  }
562 
563  ret = msi_get_suminfo( db->storage, uiUpdateCount, &si );
564  if (ret != ERROR_SUCCESS)
565  ret = msi_get_db_suminfo( db, uiUpdateCount, &si );
566  if (ret != ERROR_SUCCESS)
567  {
568  if ((si = create_suminfo( db->storage, uiUpdateCount )))
569  ret = ERROR_SUCCESS;
570  }
571 
572  if (ret == ERROR_SUCCESS)
573  {
574  *pHandle = alloc_msihandle( &si->hdr );
575  if( *pHandle )
576  ret = ERROR_SUCCESS;
577  else
579  msiobj_release( &si->hdr );
580  }
581 
582  msiobj_release( &db->hdr );
583  return ret;
584 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define MSIDBOPEN_READONLY
Definition: msiquery.h:66
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
Definition: database.c:149
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define MSIHANDLETYPE_DATABASE
Definition: msipriv.h:699
UINT msi_get_db_suminfo(MSIDATABASE *db, UINT uiUpdateCount, MSISUMMARYINFO **ret)
Definition: suminfo.c:487
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static MSISUMMARYINFO * create_suminfo(IStorage *stg, UINT update_count)
Definition: suminfo.c:443
LONG HRESULT
Definition: typedefs.h:77
#define MSIDBOPEN_TRANSACT
Definition: msiquery.h:67
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
int ret
static const WCHAR szDatabase[]
Definition: msipriv.h:1183
#define FACILITY_WIN32
Definition: winerror.h:27
MSIHANDLE alloc_msihandle(MSIOBJECTHDR *obj)
Definition: handle.c:109
unsigned int UINT
Definition: ndis.h:50
UINT msi_get_suminfo(IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **ret)
Definition: suminfo.c:457
#define HRESULT_CODE(hr)
Definition: winerror.h:76
IUnknown * msi_get_remote(MSIHANDLE handle)
Definition: handle.c:182
IStorage * storage
Definition: msipriv.h:98
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:157
MSIOBJECTHDR hdr
Definition: msipriv.h:97
UINT WINAPI MsiSummaryInfoGetPropertyA ( MSIHANDLE  handle,
UINT  uiProperty,
PUINT  puiDataType,
LPINT  piValue,
FILETIME pftValue,
LPSTR  szValueBuf,
LPDWORD  pcchValueBuf 
)

Definition at line 722 of file suminfo.c.

Referenced by test_suminfo(), test_suminfo_import(), and test_summary_binary().

725 {
726  MSISUMMARYINFO *si;
727  awstring str;
728  UINT r;
729 
730  TRACE("%u, %u, %p, %p, %p, %p, %p\n", handle, uiProperty, puiDataType,
731  piValue, pftValue, szValueBuf, pcchValueBuf );
732 
733  if (uiProperty >= MSI_MAX_PROPS)
734  {
735  if (puiDataType) *puiDataType = VT_EMPTY;
736  return ERROR_UNKNOWN_PROPERTY;
737  }
738 
740  return ERROR_INVALID_HANDLE;
741 
742  str.unicode = FALSE;
743  str.str.a = szValueBuf;
744 
745  r = get_prop( si, uiProperty, puiDataType, piValue, pftValue, &str, pcchValueBuf );
746  msiobj_release( &si->hdr );
747  return r;
748 }
#define ERROR_UNKNOWN_PROPERTY
Definition: winerror.h:966
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define MSIHANDLETYPE_SUMMARYINFO
Definition: msipriv.h:700
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define FALSE
Definition: types.h:117
const WCHAR * str
union awstring::@483 str
LPSTR a
Definition: msipriv.h:719
#define TRACE(s)
Definition: solgame.cpp:4
int int * piValue
Definition: wglext.h:523
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
BOOL unicode
Definition: msipriv.h:717
static UINT get_prop(MSISUMMARYINFO *si, UINT uiProperty, UINT *puiDataType, INT *piValue, FILETIME *pftValue, awstring *str, DWORD *pcchValueBuf)
Definition: suminfo.c:626
unsigned int UINT
Definition: ndis.h:50
#define MSI_MAX_PROPS
Definition: msipriv.h:459
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:157
UINT WINAPI MsiSummaryInfoGetPropertyCount ( MSIHANDLE  hSummaryInfo,
PUINT  pCount 
)

Definition at line 609 of file suminfo.c.

Referenced by summaryinfo_invoke(), test_suminfo(), test_suminfo_import(), and test_summary_binary().

610 {
611  MSISUMMARYINFO *si;
612 
613  TRACE("%d %p\n", hSummaryInfo, pCount);
614 
615  si = msihandle2msiinfo( hSummaryInfo, MSIHANDLETYPE_SUMMARYINFO );
616  if( !si )
617  return ERROR_INVALID_HANDLE;
618 
619  if( pCount )
620  *pCount = get_property_count( si->property );
621  msiobj_release( &si->hdr );
622 
623  return ERROR_SUCCESS;
624 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static UINT get_property_count(const PROPVARIANT *property)
Definition: suminfo.c:153
#define MSIHANDLETYPE_SUMMARYINFO
Definition: msipriv.h:700
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define TRACE(s)
Definition: solgame.cpp:4
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
PROPVARIANT property[MSI_MAX_PROPS]
Definition: msipriv.h:466
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:157
UINT WINAPI MsiSummaryInfoGetPropertyW ( MSIHANDLE  handle,
UINT  uiProperty,
PUINT  puiDataType,
LPINT  piValue,
FILETIME pftValue,
LPWSTR  szValueBuf,
LPDWORD  pcchValueBuf 
)

Definition at line 750 of file suminfo.c.

Referenced by get_patch_product_codes(), msi_publish_product_properties(), and summaryinfo_invoke().

753 {
754  MSISUMMARYINFO *si;
755  awstring str;
756  UINT r;
757 
758  TRACE("%u, %u, %p, %p, %p, %p, %p\n", handle, uiProperty, puiDataType,
759  piValue, pftValue, szValueBuf, pcchValueBuf );
760 
761  if (uiProperty >= MSI_MAX_PROPS)
762  {
763  if (puiDataType) *puiDataType = VT_EMPTY;
764  return ERROR_UNKNOWN_PROPERTY;
765  }
766 
768  return ERROR_INVALID_HANDLE;
769 
770  str.unicode = TRUE;
771  str.str.w = szValueBuf;
772 
773  r = get_prop( si, uiProperty, puiDataType, piValue, pftValue, &str, pcchValueBuf );
774  msiobj_release( &si->hdr );
775  return r;
776 }
#define ERROR_UNKNOWN_PROPERTY
Definition: winerror.h:966
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define MSIHANDLETYPE_SUMMARYINFO
Definition: msipriv.h:700
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LPWSTR w
Definition: msipriv.h:720
const WCHAR * str
union awstring::@483 str
#define TRACE(s)
Definition: solgame.cpp:4
int int * piValue
Definition: wglext.h:523
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
BOOL unicode
Definition: msipriv.h:717
static UINT get_prop(MSISUMMARYINFO *si, UINT uiProperty, UINT *puiDataType, INT *piValue, FILETIME *pftValue, awstring *str, DWORD *pcchValueBuf)
Definition: suminfo.c:626
unsigned int UINT
Definition: ndis.h:50
#define MSI_MAX_PROPS
Definition: msipriv.h:459
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:157
UINT WINAPI MsiSummaryInfoPersist ( MSIHANDLE  handle)

Definition at line 1152 of file suminfo.c.

Referenced by helper_createpackage(), set_admin_summary_info(), set_suminfo(), set_suminfo_prop(), set_summary_dword(), set_summary_info(), set_summary_str(), set_transform_summary_info(), test_streamtable(), test_suminfo(), test_summary_binary(), and write_msi_summary_info().

1153 {
1154  MSISUMMARYINFO *si;
1155  UINT ret;
1156 
1157  TRACE("%d\n", handle );
1158 
1160  if( !si )
1161  return ERROR_INVALID_HANDLE;
1162 
1163  ret = suminfo_persist( si );
1164 
1165  msiobj_release( &si->hdr );
1166  return ret;
1167 }
#define MSIHANDLETYPE_SUMMARYINFO
Definition: msipriv.h:700
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
static UINT suminfo_persist(MSISUMMARYINFO *si)
Definition: suminfo.c:894
#define TRACE(s)
Definition: solgame.cpp:4
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
int ret
unsigned int UINT
Definition: ndis.h:50
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:157
UINT WINAPI MsiSummaryInfoSetPropertyA ( MSIHANDLE  handle,
UINT  uiProperty,
UINT  uiDataType,
INT  iValue,
FILETIME pftValue,
LPCSTR  szValue 
)

Definition at line 863 of file suminfo.c.

Referenced by helper_createpackage(), set_admin_summary_info(), set_suminfo(), set_suminfo_prop(), set_summary_dword(), set_summary_info(), set_summary_str(), set_transform_summary_info(), test_streamtable(), test_suminfo(), test_summary_binary(), and write_msi_summary_info().

865 {
866  awcstring str;
867  MSISUMMARYINFO *si;
868  UINT type, ret;
869 
870  TRACE("%u, %u, %u, %d, %p, %s\n", handle, uiProperty, uiDataType, iValue, pftValue,
871  debugstr_a(szValue) );
872 
873  type = get_type( uiProperty );
874  if( type == VT_EMPTY || type != uiDataType )
876 
877  if( uiDataType == VT_LPSTR && !szValue )
879 
880  if( uiDataType == VT_FILETIME && !pftValue )
882 
884  return ERROR_INVALID_HANDLE;
885 
886  str.unicode = FALSE;
887  str.str.a = szValue;
888 
889  ret = set_prop( si, uiProperty, uiDataType, iValue, pftValue, &str );
890  msiobj_release( &si->hdr );
891  return ret;
892 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
union awcstring::@484 str
#define MSIHANDLETYPE_SUMMARYINFO
Definition: msipriv.h:700
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define ERROR_DATATYPE_MISMATCH
Definition: winerror.h:987
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LPCSTR a
Definition: msipriv.h:727
#define FALSE
Definition: types.h:117
const WCHAR * str
static UINT get_type(UINT uiProperty)
Definition: suminfo.c:113
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
BOOL unicode
Definition: msipriv.h:725
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
int ret
static UINT set_prop(MSISUMMARYINFO *si, UINT uiProperty, UINT type, INT iValue, FILETIME *pftValue, awcstring *str)
Definition: suminfo.c:778
unsigned int UINT
Definition: ndis.h:50
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:157
UINT WINAPI MsiSummaryInfoSetPropertyW ( MSIHANDLE  handle,
UINT  uiProperty,
UINT  uiDataType,
INT  iValue,
FILETIME pftValue,
LPCWSTR  szValue 
)

Definition at line 832 of file suminfo.c.

Referenced by summaryinfo_invoke().

834 {
835  awcstring str;
836  MSISUMMARYINFO *si;
837  UINT type, ret;
838 
839  TRACE("%u, %u, %u, %d, %p, %s\n", handle, uiProperty, uiDataType, iValue, pftValue,
840  debugstr_w(szValue) );
841 
842  type = get_type( uiProperty );
843  if( type == VT_EMPTY || type != uiDataType )
845 
846  if( uiDataType == VT_LPSTR && !szValue )
848 
849  if( uiDataType == VT_FILETIME && !pftValue )
851 
853  return ERROR_INVALID_HANDLE;
854 
855  str.unicode = TRUE;
856  str.str.w = szValue;
857 
858  ret = set_prop( si, uiProperty, type, iValue, pftValue, &str );
859  msiobj_release( &si->hdr );
860  return ret;
861 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
LPCWSTR w
Definition: msipriv.h:728
union awcstring::@484 str
#define MSIHANDLETYPE_SUMMARYINFO
Definition: msipriv.h:700
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define ERROR_DATATYPE_MISMATCH
Definition: winerror.h:987
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define debugstr_w
Definition: kernel32.h:32
const WCHAR * str
static UINT get_type(UINT uiProperty)
Definition: suminfo.c:113
#define TRACE(s)
Definition: solgame.cpp:4
BOOL unicode
Definition: msipriv.h:725
MSIOBJECTHDR hdr
Definition: msipriv.h:463
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:242
int ret
static UINT set_prop(MSISUMMARYINFO *si, UINT uiProperty, UINT type, INT iValue, FILETIME *pftValue, awcstring *str)
Definition: suminfo.c:778
unsigned int UINT
Definition: ndis.h:50
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:157
static void parse_filetime ( LPCWSTR  str,
FILETIME ft 
)
static

Definition at line 911 of file suminfo.c.

Referenced by parse_prop().

912 {
913  SYSTEMTIME lt, utc;
914  const WCHAR *p = str;
915  WCHAR *end;
916 
917  memset( &lt, 0, sizeof(lt) );
918 
919  /* YYYY/MM/DD hh:mm:ss */
920 
921  while (isspaceW( *p )) p++;
922 
923  lt.wYear = strtolW( p, &end, 10 );
924  if (*end != '/') return;
925  p = end + 1;
926 
927  lt.wMonth = strtolW( p, &end, 10 );
928  if (*end != '/') return;
929  p = end + 1;
930 
931  lt.wDay = strtolW( p, &end, 10 );
932  if (*end != ' ') return;
933  p = end + 1;
934 
935  while (isspaceW( *p )) p++;
936 
937  lt.wHour = strtolW( p, &end, 10 );
938  if (*end != ':') return;
939  p = end + 1;
940 
941  lt.wMinute = strtolW( p, &end, 10 );
942  if (*end != ':') return;
943  p = end + 1;
944 
945  lt.wSecond = strtolW( p, &end, 10 );
946 
948  SystemTimeToFileTime( &utc, ft );
949 }
WORD wMonth
Definition: winbase.h:871
__wchar_t WCHAR
Definition: xmlstorage.h:180
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
#define strtolW(s, e, b)
Definition: unicode.h:33
GLuint GLuint end
Definition: gl.h:1545
WORD wYear
Definition: winbase.h:870
const WCHAR * str
WORD wMinute
Definition: winbase.h:875
smooth NULL
Definition: ftsmooth.c:416
WORD wSecond
Definition: winbase.h:876
WORD wDay
Definition: winbase.h:873
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:148
static DOUBLE utc(DOUBLE time, DateInstance *date)
Definition: date.c:355
WORD wHour
Definition: winbase.h:874
BOOL WINAPI TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime)
Definition: timezone.c:421
GLfloat GLfloat p
Definition: glext.h:8902
#define memset(x, y, z)
Definition: compat.h:39
static UINT parse_prop ( LPCWSTR  prop,
LPCWSTR  value,
UINT pid,
INT int_value,
FILETIME ft_value,
awcstring str_value 
)
static

Definition at line 951 of file suminfo.c.

Referenced by msi_add_suminfo().

953 {
954  *pid = atoiW( prop );
955  switch (*pid)
956  {
957 #ifdef __REACTOS__
958  case PID_CODEPAGE_MSI:
959 #else
960  case PID_CODEPAGE:
961 #endif
962  case PID_WORDCOUNT:
963  case PID_CHARCOUNT:
964 #ifdef __REACTOS__
965  case PID_SECURITY_MSI:
966 #else
967  case PID_SECURITY:
968 #endif
969  case PID_PAGECOUNT:
970  *int_value = atoiW( value );
971  break;
972 
973  case PID_LASTPRINTED:
974  case PID_CREATE_DTM:
975  case PID_LASTSAVE_DTM:
976  parse_filetime( value, ft_value );
977  break;
978 
979  case PID_SUBJECT:
980  case PID_AUTHOR:
981  case PID_KEYWORDS:
982  case PID_COMMENTS:
983  case PID_TEMPLATE:
984  case PID_LASTAUTHOR:
985  case PID_REVNUMBER:
986  case PID_APPNAME:
987  case PID_TITLE:
988  str_value->str.w = value;
989  str_value->unicode = TRUE;
990  break;
991 
992  default:
993  WARN("unhandled prop id %u\n", *pid);
994  return ERROR_FUNCTION_FAILED;
995  }
996 
997  return ERROR_SUCCESS;
998 }
#define PID_TEMPLATE
Definition: suminfo.c:49
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
Definition: get.c:139
#define TRUE
Definition: types.h:120
LPCWSTR w
Definition: msipriv.h:728
#define PID_CHARCOUNT
Definition: suminfo.c:58
#define ERROR_SUCCESS
Definition: deptool.c:10
union awcstring::@484 str
#define WARN(fmt,...)
Definition: debug.h:111
#define PID_COMMENTS
Definition: suminfo.c:48
#define PID_REVNUMBER
Definition: suminfo.c:51
#define PID_CODEPAGE
Definition: suminfo.c:43
#define PID_LASTPRINTED
Definition: suminfo.c:53
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define PID_LASTAUTHOR
Definition: suminfo.c:50
#define PID_LASTSAVE_DTM
Definition: suminfo.c:55
#define PID_AUTHOR
Definition: suminfo.c:46
#define PID_PAGECOUNT
Definition: suminfo.c:56
BOOL unicode
Definition: msipriv.h:725
#define PID_APPNAME
Definition: suminfo.c:60
#define PID_TITLE
Definition: suminfo.c:44
#define PID_SUBJECT
Definition: suminfo.c:45
GLsizei const GLfloat * value
Definition: glext.h:6069
#define PID_KEYWORDS
Definition: suminfo.c:47
#define PID_CREATE_DTM
Definition: suminfo.c:54
#define PID_SECURITY
Definition: suminfo.c:61
#define PID_WORDCOUNT
Definition: suminfo.c:57
static void parse_filetime(LPCWSTR str, FILETIME *ft)
Definition: suminfo.c:911
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315
static UINT propvar_changetype ( PROPVARIANT *  changed,
PROPVARIANT *  property,
VARTYPE  vt 
)
static

Definition at line 165 of file suminfo.c.

Referenced by read_properties_from_data().

166 {
167  HRESULT hr;
168  HMODULE propsys = LoadLibraryA("propsys.dll");
169  pPropVariantChangeType = (void *)GetProcAddress(propsys, "PropVariantChangeType");
170 
171  if (!pPropVariantChangeType)
172  {
173  ERR("PropVariantChangeType function missing!\n");
174  return ERROR_FUNCTION_FAILED;
175  }
176 
177  hr = pPropVariantChangeType(changed, property, 0, vt);
178  return (hr == S_OK) ? ERROR_SUCCESS : ERROR_FUNCTION_FAILED;
179 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
LONG HRESULT
Definition: typedefs.h:77
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static IPropertySystem propsys
Definition: propsys_main.c:238
HANDLE HMODULE
Definition: typedefs.h:75
#define GetProcAddress(x, y)
Definition: compat.h:410
static void read_properties_from_data ( PROPVARIANT *  prop,
LPBYTE  data,
DWORD  sz 
)
static

Definition at line 182 of file suminfo.c.

Referenced by load_summary_info().

183 {
184  UINT type;
185  DWORD i, size;
186  PROPERTY_DATA *propdata;
187  PROPVARIANT property, *ptr;
188  PROPVARIANT changed;
189  PROPERTYIDOFFSET *idofs;
190  PROPERTYSECTIONHEADER *section_hdr;
191 
192  section_hdr = (PROPERTYSECTIONHEADER*) &data[0];
193  idofs = (PROPERTYIDOFFSET*) &data[SECT_HDR_SIZE];
194 
195  /* now set all the properties */
196  for( i = 0; i < section_hdr->cProperties; i++ )
197  {
198  if( idofs[i].propid >= MSI_MAX_PROPS )
199  {
200  ERR("Unknown property ID %d\n", idofs[i].propid );
201  break;
202  }
203 
204  type = get_type( idofs[i].propid );
205  if( type == VT_EMPTY )
206  {
207  ERR("propid %d has unknown type\n", idofs[i].propid);
208  break;
209  }
210 
211  propdata = (PROPERTY_DATA*) &data[ idofs[i].dwOffset ];
212 
213  /* check we don't run off the end of the data */
214  size = sz - idofs[i].dwOffset - sizeof(DWORD);
215  if( sizeof(DWORD) > size ||
216  ( propdata->type == VT_FILETIME && sizeof(FILETIME) > size ) ||
217  ( propdata->type == VT_LPSTR && (propdata->u.str.len + sizeof(DWORD)) > size ) )
218  {
219  ERR("not enough data\n");
220  break;
221  }
222 
223  property.vt = propdata->type;
224  if( propdata->type == VT_LPSTR )
225  {
226  LPSTR str = msi_alloc( propdata->u.str.len );
227  memcpy( str, propdata->u.str.str, propdata->u.str.len );
228  str[ propdata->u.str.len - 1 ] = 0;
229  property.u.pszVal = str;
230  }
231  else if( propdata->type == VT_FILETIME )
232  property.u.filetime = propdata->u.ft;
233  else if( propdata->type == VT_I2 )
234  property.u.iVal = propdata->u.i2;
235  else if( propdata->type == VT_I4 )
236  property.u.lVal = propdata->u.i4;
237 
238  /* check the type is the same as we expect */
239  if( type != propdata->type )
240  {
241  propvar_changetype(&changed, &property, type);
242  ptr = &changed;
243  }
244  else
245  ptr = &property;
246 
247  prop[ idofs[i].propid ] = *ptr;
248  }
249 }
DWORD type
Definition: suminfo.c:70
Definition: compat.h:1932
SHORT i2
Definition: suminfo.c:73
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
char * LPSTR
Definition: xmlstorage.h:182
#define DWORD
Definition: msvc.h:34
DWORD DWORD
Definition: winlogon.h:84
BYTE str[1]
Definition: suminfo.c:77
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
GLenum GLclampf GLint i
Definition: glfuncs.h:14
static PVOID ptr
Definition: dispmode.c:27
const WCHAR * str
static UINT propvar_changetype(PROPVARIANT *changed, PROPVARIANT *property, VARTYPE vt)
Definition: suminfo.c:165
struct _FILETIME FILETIME
static UINT get_type(UINT uiProperty)
Definition: suminfo.c:113
GLsizeiptr size
Definition: glext.h:5919
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
union PROPERTY_DATA::@489 u
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
FILETIME ft
Definition: suminfo.c:74
unsigned int UINT
Definition: ndis.h:50
DWORD dwOffset
Definition: suminfo.c:66
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
int property
Definition: wglext.h:870
#define MSI_MAX_PROPS
Definition: msipriv.h:459
DWORD propid
Definition: suminfo.c:65
#define SECT_HDR_SIZE
Definition: suminfo.c:88
Definition: compat.h:1931
static UINT save_prop ( MSISUMMARYINFO si,
HANDLE  handle,
UINT  row 
)
static

Definition at line 1041 of file suminfo.c.

Referenced by msi_export_suminfo().

1042 {
1043  static const char fmt_systemtime[] = "%d/%02d/%02d %02d:%02d:%02d";
1044  char data[20]; /* largest string: YYYY/MM/DD hh:mm:ss */
1045  static const char fmt_begin[] = "%u\t";
1046  static const char data_end[] = "\r\n";
1047  static const char fmt_int[] = "%u";
1048  UINT r, data_type, len;
1049  SYSTEMTIME system_time;
1050  FILETIME file_time;
1051  INT int_value;
1052  awstring str;
1053  DWORD sz;
1054 
1055  str.unicode = FALSE;
1056  str.str.a = NULL;
1057  len = 0;
1058  r = get_prop( si, row, &data_type, &int_value, &file_time, &str, &len );
1059  if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA)
1060  return r;
1061  if (data_type == VT_EMPTY)
1062  return ERROR_SUCCESS; /* property not set */
1063  snprintf( data, sizeof(data), fmt_begin, row );
1064  sz = lstrlenA( data );
1065  if (!WriteFile( handle, data, sz, &sz, NULL ))
1066  return ERROR_WRITE_FAULT;
1067 
1068  switch (data_type)
1069  {
1070  case VT_I2:
1071  case VT_I4:
1072  snprintf( data, sizeof(data), fmt_int, int_value );
1073  sz = lstrlenA( data );
1074  if (!WriteFile( handle, data, sz, &sz, NULL ))
1075  return ERROR_WRITE_FAULT;
1076  break;
1077  case VT_LPSTR:
1078  len++;
1079  if (!(str.str.a = msi_alloc( len )))
1080  return ERROR_OUTOFMEMORY;
1081  r = get_prop( si, row, NULL, NULL, NULL, &str, &len );
1082  if (r != ERROR_SUCCESS)
1083  {
1084  msi_free( str.str.a );
1085  return r;
1086  }
1087  sz = lstrlenA( str.str.a );
1088  if (!WriteFile( handle, str.str.a, sz, &sz, NULL ))
1089  {
1090  msi_free( str.str.a );
1091  return ERROR_WRITE_FAULT;
1092  }
1093  msi_free( str.str.a );
1094  break;
1095  case VT_FILETIME:
1096  if (!FileTimeToSystemTime( &file_time, &system_time ))
1097  return ERROR_FUNCTION_FAILED;
1098  snprintf( data, sizeof(data), fmt_systemtime, system_time.wYear, system_time.wMonth,
1099  system_time.wDay, system_time.wHour, system_time.wMinute,
1100  system_time.wSecond );
1101  sz = lstrlenA( data );
1102  if (!WriteFile( handle, data, sz, &sz, NULL ))
1103  return ERROR_WRITE_FAULT;
1104  break;
1105  case VT_EMPTY:
1106  /* cannot reach here, property not set */
1107  break;
1108  default:
1109  FIXME( "Unknown property variant type\n" );
1110  return ERROR_FUNCTION_FAILED;
1111  }
1112 
1113  sz = lstrlenA( data_end );
1114  if (!WriteFile( handle, data_end, sz, &sz, NULL ))
1115  return ERROR_WRITE_FAULT;
1116 
1117  return ERROR_SUCCESS;
1118 }
Definition: compat.h:1932
#define ERROR_SUCCESS
Definition: deptool.c:10
WORD wMonth
Definition: winbase.h:871
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define snprintf
Definition: wintirpc.h:48
int32_t INT
Definition: typedefs.h:56
DWORD DWORD
Definition: winlogon.h:84
WORD wYear
Definition: winbase.h:870
#define ERROR_WRITE_FAULT
Definition: winerror.h:132
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
WORD wMinute
Definition: winbase.h:875
union awstring::@483 str
smooth NULL
Definition: ftsmooth.c:416
LPSTR a
Definition: msipriv.h:719
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
WORD wSecond
Definition: winbase.h:876
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_MORE_DATA
Definition: dderror.h:13
WORD wDay
Definition: winbase.h:873
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
WORD wHour
Definition: winbase.h:874
BOOL unicode
Definition: msipriv.h:717
static UINT get_prop(MSISUMMARYINFO *si, UINT uiProperty, UINT *puiDataType, INT *piValue, FILETIME *pftValue, awstring *str, DWORD *pcchValueBuf)
Definition: suminfo.c:626
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
Definition: compat.h:1931
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:76
static UINT save_summary_info ( const MSISUMMARYINFO si,
IStream stm 
)
static

Definition at line 375 of file suminfo.c.

Referenced by suminfo_persist().

376 {
378  PROPERTYSETHEADER set_hdr;
379  FORMATIDOFFSET format_hdr;
380  PROPERTYSECTIONHEADER section_hdr;
382  LPBYTE data = NULL;
383  ULONG count, sz;
384  HRESULT r;
385  int i;
386 
387  /* write the header */
388  sz = sizeof set_hdr;
389  memset( &set_hdr, 0, sz );
390  set_hdr.wByteOrder = 0xfffe;
391  set_hdr.wFormat = 0;
392  set_hdr.dwOSVer = 0x00020005; /* build 5, platform id 2 */
393  /* set_hdr.clsID is {00000000-0000-0000-0000-000000000000} */
394  set_hdr.reserved = 1;
395  r = IStream_Write( stm, &set_hdr, sz, &count );
396  if( FAILED(r) || count != sz )
397  return ret;
398 
399  /* write the format header */
400  sz = sizeof format_hdr;
401  format_hdr.fmtid = FMTID_SummaryInformation;
402  format_hdr.dwOffset = sizeof format_hdr + sizeof set_hdr;
403  r = IStream_Write( stm, &format_hdr, sz, &count );
404  if( FAILED(r) || count != sz )
405  return ret;
406 
407  /* add up how much space the data will take and calculate the offsets */
408  section_hdr.cbSection = sizeof section_hdr;
409  section_hdr.cbSection += (get_property_count( si->property ) * sizeof idofs[0]);
410  section_hdr.cProperties = 0;
411  for( i = 0; i < MSI_MAX_PROPS; i++ )
412  {
413  sz = write_property_to_data( &si->property[i], NULL );
414  if( !sz )
415  continue;
416  idofs[ section_hdr.cProperties ].propid = i;
417  idofs[ section_hdr.cProperties ].dwOffset = section_hdr.cbSection;
418  section_hdr.cProperties++;
419  section_hdr.cbSection += sz;
420  }
421 
422  data = msi_alloc_zero( section_hdr.cbSection );
423 
424  sz = 0;
425  memcpy( &data[sz], &section_hdr, sizeof section_hdr );
426  sz += sizeof section_hdr;
427 
428  memcpy( &data[sz], idofs, section_hdr.cProperties * sizeof idofs[0] );
429  sz += section_hdr.cProperties * sizeof idofs[0];
430 
431  /* write out the data */
432  for( i = 0; i < MSI_MAX_PROPS; i++ )
433  sz += write_property_to_data( &si->property[i], &data[sz] );
434 
435  r = IStream_Write( stm, data, sz, &count );
436  msi_free( data );
437  if( FAILED(r) || count != sz )
438  return ret;
439 
440  return ERROR_SUCCESS;
441 }
static UINT write_property_to_data(const PROPVARIANT *prop, LPBYTE data)
Definition: suminfo.c:348
#define ERROR_SUCCESS
Definition: deptool.c:10
static UINT get_property_count(const PROPVARIANT *property)
Definition: suminfo.c:153
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned char * LPBYTE
Definition: typedefs.h:52
FMTID fmtid
Definition: suminfo.c:55
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1210
const FMTID FMTID_SummaryInformation
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
smooth NULL
Definition: ftsmooth.c:416
DWORD dwOffset
Definition: suminfo.c:56
LONG HRESULT
Definition: typedefs.h:77
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
PROPVARIANT property[MSI_MAX_PROPS]
Definition: msipriv.h:466
unsigned int UINT
Definition: ndis.h:50
DWORD dwOffset
Definition: suminfo.c:66
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
unsigned int ULONG
Definition: retypes.h:1
#define MSI_MAX_PROPS
Definition: msipriv.h:459
DWORD propid
Definition: suminfo.c:65
#define memset(x, y, z)
Definition: compat.h:39
DWORD reserved
Definition: suminfo.c:51
static UINT set_prop ( MSISUMMARYINFO si,
UINT  uiProperty,
UINT  type,
INT  iValue,
FILETIME pftValue,
awcstring str 
)
static

Definition at line 778 of file suminfo.c.

Referenced by msi_add_suminfo(), MsiSummaryInfoSetPropertyA(), and MsiSummaryInfoSetPropertyW().

780 {
781  PROPVARIANT *prop;
782  UINT len;
783 
784  TRACE("%p, %u, %u, %d, %p, %p\n", si, uiProperty, type, iValue, pftValue, str );
785 
786  prop = &si->property[uiProperty];
787 
788  if( prop->vt == VT_EMPTY )
789  {
790  if( !si->update_count )
791  return ERROR_FUNCTION_FAILED;
792 
793  si->update_count--;
794  }
795  else if( prop->vt != type )
796  return ERROR_SUCCESS;
797 
798  free_prop( prop );
799  prop->vt = type;
800  switch( type )
801  {
802  case VT_I4:
803  prop->u.lVal = iValue;
804  break;
805  case VT_I2:
806  prop->u.iVal = iValue;
807  break;
808  case VT_FILETIME:
809  prop->u.filetime = *pftValue;
810  break;
811  case VT_LPSTR:
812  if( str->unicode )
813  {
814  len = WideCharToMultiByte( CP_ACP, 0, str->str.w, -1,
815  NULL, 0, NULL, NULL );
816  prop->u.pszVal = msi_alloc( len );
817  WideCharToMultiByte( CP_ACP, 0, str->str.w, -1,
818  prop->u.pszVal, len, NULL, NULL );
819  }
820  else
821  {
822  len = lstrlenA( str->str.a ) + 1;
823  prop->u.pszVal = msi_alloc( len );
824  lstrcpyA( prop->u.pszVal, str->str.a );
825  }
826  break;
827  }
828 
829  return ERROR_SUCCESS;
830 }
Definition: compat.h:1932
LPCWSTR w
Definition: msipriv.h:728
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:101
union awcstring::@484 str
static void free_prop(PROPVARIANT *prop)
Definition: suminfo.c:90
#define CP_ACP
Definition: compat.h:99
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LPCSTR a
Definition: msipriv.h:727
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
BOOL unicode
Definition: msipriv.h:725
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
GLenum GLsizei len
Definition: glext.h:6722
PROPVARIANT property[MSI_MAX_PROPS]
Definition: msipriv.h:466
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
unsigned int UINT
Definition: ndis.h:50
DWORD update_count
Definition: msipriv.h:465
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
Definition: compat.h:1931
static UINT suminfo_persist ( MSISUMMARYINFO si)
static

Definition at line 894 of file suminfo.c.

Referenced by msi_add_suminfo(), and MsiSummaryInfoPersist().

895 {
897  IStream *stm = NULL;
898  DWORD grfMode;
899  HRESULT r;
900 
902  r = IStorage_CreateStream( si->storage, szSumInfo, grfMode, 0, 0, &stm );
903  if( SUCCEEDED(r) )
904  {
905  ret = save_summary_info( si, stm );
906  IStream_Release( stm );
907  }
908  return ret;
909 }
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
IStorage * storage
Definition: msipriv.h:464
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define STGM_CREATE
Definition: objbase.h:925
DWORD DWORD
Definition: winlogon.h:84
static const WCHAR szSumInfo[]
Definition: msipriv.h:1145
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
int ret
#define STGM_READWRITE
Definition: objbase.h:918
unsigned int UINT
Definition: ndis.h:50
static UINT save_summary_info(const MSISUMMARYINFO *si, IStream *stm)
Definition: suminfo.c:375
#define SUCCEEDED(hr)
Definition: intsafe.h:57
WINE_DEFAULT_DEBUG_CHANNEL ( msi  )
static DWORD write_dword ( LPBYTE  data,
DWORD  ofs,
DWORD  val 
)
static

Definition at line 320 of file suminfo.c.

Referenced by write_filetime(), write_property_to_data(), and write_string().

321 {
322  if( data )
323  {
324  data[ofs++] = val&0xff;
325  data[ofs++] = (val>>8)&0xff;
326  data[ofs++] = (val>>16)&0xff;
327  data[ofs++] = (val>>24)&0xff;
328  }
329  return 4;
330 }
GLuint GLfloat * val
Definition: glext.h:7180
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static DWORD write_filetime ( LPBYTE  data,
DWORD  ofs,
const FILETIME ft 
)
static

Definition at line 332 of file suminfo.c.

Referenced by write_property_to_data().

333 {
334  write_dword( data, ofs, ft->dwLowDateTime );
335  write_dword( data, ofs + 4, ft->dwHighDateTime );
336  return 8;
337 }
DWORD dwHighDateTime
Definition: mapidefs.h:66
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static DWORD write_dword(LPBYTE data, DWORD ofs, DWORD val)
Definition: suminfo.c:320
DWORD dwLowDateTime
Definition: mapidefs.h:65
static UINT write_property_to_data ( const PROPVARIANT *  prop,
LPBYTE  data 
)
static

Definition at line 348 of file suminfo.c.

Referenced by save_summary_info().

349 {
350  DWORD sz = 0;
351 
352  if( prop->vt == VT_EMPTY )
353  return sz;
354 
355  /* add the type */
356  sz += write_dword( data, sz, prop->vt );
357  switch( prop->vt )
358  {
359  case VT_I2:
360  sz += write_dword( data, sz, prop->u.iVal );
361  break;
362  case VT_I4:
363  sz += write_dword( data, sz, prop->u.lVal );
364  break;
365  case VT_FILETIME:
366  sz += write_filetime( data, sz, &prop->u.filetime );
367  break;
368  case VT_LPSTR:
369  sz += write_string( data, sz, prop->u.pszVal );
370  break;
371  }
372  return sz;
373 }
Definition: compat.h:1932
static DWORD write_filetime(LPBYTE data, DWORD ofs, const FILETIME *ft)
Definition: suminfo.c:332
DWORD DWORD
Definition: winlogon.h:84
static DWORD write_string(LPBYTE data, DWORD ofs, LPCSTR str)
Definition: suminfo.c:339
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static DWORD write_dword(LPBYTE data, DWORD ofs, DWORD val)
Definition: suminfo.c:320
Definition: compat.h:1931
static DWORD write_string ( LPBYTE  data,
DWORD  ofs,
LPCSTR  str 
)
static

Definition at line 339 of file suminfo.c.

Referenced by write_property_to_data().

340 {
341  DWORD len = lstrlenA( str ) + 1;
342  write_dword( data, ofs, len );
343  if( data )
344  memcpy( &data[ofs + 4], str, len );
345  return (7 + len) & ~3;
346 }
DWORD DWORD
Definition: winlogon.h:84
const WCHAR * str
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static DWORD write_dword(LPBYTE data, DWORD ofs, DWORD val)
Definition: suminfo.c:320
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145

Variable Documentation

REFPROPVARIANT PROPVAR_CHANGE_FLAGS flags

Definition at line 85 of file suminfo.c.

REFPROPVARIANT propvarSrc

Definition at line 85 of file suminfo.c.

Referenced by test_copy().