ReactOS 0.4.15-dev-7704-gc07eb9f
record.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winerror.h"
#include "wine/debug.h"
#include "msi.h"
#include "msiquery.h"
#include "msipriv.h"
#include "objidl.h"
#include "winnls.h"
#include "ole2.h"
#include "winreg.h"
#include "shlwapi.h"
#include "query.h"
Include dependency graph for record.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define MSIFIELD_NULL   0
 
#define MSIFIELD_INT   1
 
#define MSIFIELD_WSTR   3
 
#define MSIFIELD_STREAM   4
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msidb)
 
static void MSI_FreeField (MSIFIELD *field)
 
void MSI_CloseRecord (MSIOBJECTHDR *arg)
 
MSIRECORDMSI_CreateRecord (UINT cParams)
 
MSIHANDLE WINAPI MsiCreateRecord (UINT cParams)
 
UINT MSI_RecordGetFieldCount (const MSIRECORD *rec)
 
UINT WINAPI MsiRecordGetFieldCount (MSIHANDLE handle)
 
static BOOL string2intW (LPCWSTR str, int *out)
 
WCHARmsi_strdupW (const WCHAR *value, int len)
 
UINT MSI_RecordCopyField (MSIRECORD *in_rec, UINT in_n, MSIRECORD *out_rec, UINT out_n)
 
int MSI_RecordGetInteger (MSIRECORD *rec, UINT iField)
 
int WINAPI MsiRecordGetInteger (MSIHANDLE handle, UINT iField)
 
UINT WINAPI MsiRecordClearData (MSIHANDLE handle)
 
UINT MSI_RecordSetInteger (MSIRECORD *rec, UINT iField, int iVal)
 
UINT WINAPI MsiRecordSetInteger (MSIHANDLE handle, UINT iField, int iVal)
 
BOOL MSI_RecordIsNull (MSIRECORD *rec, UINT iField)
 
BOOL WINAPI MsiRecordIsNull (MSIHANDLE handle, UINT iField)
 
UINT MSI_RecordGetStringA (MSIRECORD *rec, UINT iField, LPSTR szValue, LPDWORD pcchValue)
 
UINT WINAPI MsiRecordGetStringA (MSIHANDLE handle, UINT iField, char *szValue, DWORD *pcchValue)
 
const WCHARmsi_record_get_string (const MSIRECORD *rec, UINT field, int *len)
 
const WCHARMSI_RecordGetString (const MSIRECORD *rec, UINT iField)
 
UINT MSI_RecordGetStringW (MSIRECORD *rec, UINT iField, WCHAR *szValue, DWORD *pcchValue)
 
UINT WINAPI MsiRecordGetStringW (MSIHANDLE handle, UINT iField, WCHAR *szValue, DWORD *pcchValue)
 
static UINT msi_get_stream_size (IStream *stm)
 
static UINT MSI_RecordDataSize (MSIRECORD *rec, UINT iField)
 
UINT WINAPI MsiRecordDataSize (MSIHANDLE handle, UINT iField)
 
UINT WINAPI MsiRecordSetStringA (MSIHANDLE handle, UINT iField, const char *szValue)
 
UINT msi_record_set_string (MSIRECORD *rec, UINT field, const WCHAR *value, int len)
 
UINT MSI_RecordSetStringW (MSIRECORD *rec, UINT iField, LPCWSTR szValue)
 
UINT WINAPI MsiRecordSetStringW (MSIHANDLE handle, UINT iField, const WCHAR *szValue)
 
static UINT RECORD_StreamFromFile (LPCWSTR szFile, IStream **pstm)
 
UINT MSI_RecordSetStream (MSIRECORD *rec, UINT iField, IStream *stream)
 
UINT MSI_RecordSetStreamFromFileW (MSIRECORD *rec, UINT iField, LPCWSTR szFilename)
 
UINT WINAPI MsiRecordSetStreamA (MSIHANDLE hRecord, UINT iField, const char *szFilename)
 
UINT WINAPI MsiRecordSetStreamW (MSIHANDLE handle, UINT iField, const WCHAR *szFilename)
 
UINT MSI_RecordReadStream (MSIRECORD *rec, UINT iField, char *buf, LPDWORD sz)
 
UINT WINAPI MsiRecordReadStream (MSIHANDLE handle, UINT iField, char *buf, DWORD *sz)
 
UINT MSI_RecordSetIStream (MSIRECORD *rec, UINT iField, IStream *stm)
 
UINT MSI_RecordGetIStream (MSIRECORD *rec, UINT iField, IStream **pstm)
 
static UINT msi_dump_stream_to_file (IStream *stm, LPCWSTR name)
 
UINT MSI_RecordStreamToFile (MSIRECORD *rec, UINT iField, LPCWSTR name)
 
MSIRECORDMSI_CloneRecord (MSIRECORD *rec)
 
BOOL MSI_RecordsAreFieldsEqual (MSIRECORD *a, MSIRECORD *b, UINT field)
 
BOOL MSI_RecordsAreEqual (MSIRECORD *a, MSIRECORD *b)
 
WCHARmsi_dup_record_field (MSIRECORD *rec, INT field)
 
void dump_record (MSIRECORD *rec)
 
UINT copy_remote_record (const struct wire_record *in, MSIHANDLE out)
 
UINT unmarshal_record (const struct wire_record *in, MSIHANDLE *out)
 
struct wire_recordmarshal_record (MSIHANDLE handle)
 
void free_remote_record (struct wire_record *rec)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file record.c.

◆ MSIFIELD_INT

#define MSIFIELD_INT   1

Definition at line 45 of file record.c.

◆ MSIFIELD_NULL

#define MSIFIELD_NULL   0

Definition at line 44 of file record.c.

◆ MSIFIELD_STREAM

#define MSIFIELD_STREAM   4

Definition at line 47 of file record.c.

◆ MSIFIELD_WSTR

#define MSIFIELD_WSTR   3

Definition at line 46 of file record.c.

Function Documentation

◆ copy_remote_record()

UINT copy_remote_record ( const struct wire_record in,
MSIHANDLE  out 
)

Definition at line 1052 of file record.c.

1053{
1054 MSIRECORD *rec;
1055 unsigned int i;
1057
1059 return ERROR_INVALID_HANDLE;
1060
1061 rec->cookie = in->cookie;
1062 for (i = 0; i <= in->count; i++)
1063 {
1064 switch (in->fields[i].type)
1065 {
1066 case MSIFIELD_NULL:
1067 MSI_FreeField(&rec->fields[i]);
1068 rec->fields[i].type = MSIFIELD_NULL;
1069 break;
1070 case MSIFIELD_INT:
1071 r = MSI_RecordSetInteger(rec, i, in->fields[i].u.iVal);
1072 break;
1073 case MSIFIELD_WSTR:
1074 r = MSI_RecordSetStringW(rec, i, in->fields[i].u.szwVal);
1075 break;
1076 case MSIFIELD_STREAM:
1077 r = MSI_RecordSetIStream(rec, i, in->fields[i].u.stream);
1078 break;
1079 default:
1080 ERR("invalid field type %d\n", in->fields[i].type);
1081 break;
1082 }
1083
1084 if (r)
1085 {
1086 msiobj_release(&rec->hdr);
1087 return r;
1088 }
1089 }
1090
1091 msiobj_release(&rec->hdr);
1092 return ERROR_SUCCESS;
1093}
#define ERR(fmt,...)
Definition: debug.h:110
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:158
UINT MSI_RecordSetStringW(MSIRECORD *rec, UINT iField, LPCWSTR szValue)
Definition: record.c:597
#define MSIFIELD_STREAM
Definition: record.c:47
UINT MSI_RecordSetInteger(MSIRECORD *rec, UINT iField, int iVal)
Definition: record.c:280
#define MSIFIELD_INT
Definition: record.c:45
#define MSIFIELD_WSTR
Definition: record.c:46
UINT MSI_RecordSetIStream(MSIRECORD *rec, UINT iField, IStream *stm)
Definition: record.c:836
#define MSIFIELD_NULL
Definition: record.c:44
static void MSI_FreeField(MSIFIELD *field)
Definition: record.c:49
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint in
Definition: glext.h:9616
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MSIHANDLETYPE_RECORD
Definition: msipriv.h:725
unsigned int UINT
Definition: ndis.h:50
static FILE * out
Definition: regtests2xml.c:44
UINT type
Definition: msipriv.h:139
MSIFIELD fields[1]
Definition: msipriv.h:154
MSIOBJECTHDR hdr
Definition: msipriv.h:151
UINT64 cookie
Definition: msipriv.h:153

Referenced by MsiViewModify(), and unmarshal_record().

◆ dump_record()

void dump_record ( MSIRECORD rec)

Definition at line 1028 of file record.c.

1029{
1030 int i;
1031 if (!rec)
1032 {
1033 TRACE("(null)\n");
1034 return;
1035 }
1036
1037 TRACE("[");
1038 for (i = 0; i <= rec->count; i++)
1039 {
1040 switch(rec->fields[i].type)
1041 {
1042 case MSIFIELD_NULL: TRACE("(null)"); break;
1043 case MSIFIELD_INT: TRACE("%d", rec->fields[i].u.iVal); break;
1044 case MSIFIELD_WSTR: TRACE("%s", debugstr_w(rec->fields[i].u.szwVal)); break;
1045 case MSIFIELD_STREAM: TRACE("%p", rec->fields[i].u.stream); break;
1046 }
1047 if (i < rec->count) TRACE(", ");
1048 }
1049 TRACE("]\n");
1050}
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
INT iVal
Definition: msipriv.h:142
IStream * stream
Definition: msipriv.h:144
LPWSTR szwVal
Definition: msipriv.h:143
union tagMSIFIELD::@502 u
UINT count
Definition: msipriv.h:152

Referenced by MSI_FormatRecordW(), MSI_ProcessMessageVerbatim(), and msi_table_load_transform().

◆ free_remote_record()

void free_remote_record ( struct wire_record rec)

Definition at line 1149 of file record.c.

1150{
1151 int i;
1152
1153 for (i = 0; i <= rec->count; i++)
1154 {
1155 if (rec->fields[i].type == MSIFIELD_WSTR)
1156 midl_user_free(rec->fields[i].u.szwVal);
1157 else if (rec->fields[i].type == MSIFIELD_STREAM)
1158 IStream_Release(rec->fields[i].u.stream);
1159 }
1160
1161 midl_user_free(rec);
1162}
#define midl_user_free
Definition: rpc.h:45
unsigned int count
Definition: winemsi.idl:57
struct wire_field fields[]
Definition: winemsi.idl:59

Referenced by MsiDatabaseGetPrimaryKeysW(), MsiViewFetch(), MsiViewGetColumnInfo(), and MsiViewModify().

◆ marshal_record()

struct wire_record * marshal_record ( MSIHANDLE  handle)

Definition at line 1109 of file record.c.

1110{
1111 struct wire_record *ret;
1112 unsigned int i;
1113 MSIRECORD *rec;
1114
1116 return NULL;
1117
1118 ret = midl_user_allocate(sizeof(*ret) + rec->count * sizeof(ret->fields[0]));
1119 ret->count = rec->count;
1120 ret->cookie = rec->cookie;
1121
1122 for (i = 0; i <= rec->count; i++)
1123 {
1124 switch (rec->fields[i].type)
1125 {
1126 case MSIFIELD_NULL:
1127 break;
1128 case MSIFIELD_INT:
1129 ret->fields[i].u.iVal = rec->fields[i].u.iVal;
1130 break;
1131 case MSIFIELD_WSTR:
1132 ret->fields[i].u.szwVal = strdupW(rec->fields[i].u.szwVal);
1133 break;
1134 case MSIFIELD_STREAM:
1135 IStream_AddRef(rec->fields[i].u.stream);
1136 ret->fields[i].u.stream = rec->fields[i].u.stream;
1137 break;
1138 default:
1139 ERR("invalid field type %d\n", rec->fields[i].type);
1140 break;
1141 }
1142 ret->fields[i].type = rec->fields[i].type;
1143 }
1144
1145 msiobj_release(&rec->hdr);
1146 return ret;
1147}
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
#define NULL
Definition: types.h:112
#define midl_user_allocate
Definition: rpc.h:44
int ret

Referenced by s_remote_DatabaseGetPrimaryKeys(), s_remote_ViewFetch(), s_remote_ViewGetColumnInfo(), and s_remote_ViewModify().

◆ MSI_CloneRecord()

MSIRECORD * MSI_CloneRecord ( MSIRECORD rec)

Definition at line 921 of file record.c.

922{
923 MSIRECORD *clone;
924 UINT r, i, count;
925
927 clone = MSI_CreateRecord(count);
928 if (!clone)
929 return NULL;
930
931 for (i = 0; i <= count; i++)
932 {
933 if (rec->fields[i].type == MSIFIELD_STREAM)
934 {
935 if (FAILED(IStream_Clone(rec->fields[i].u.stream,
936 &clone->fields[i].u.stream)))
937 {
938 msiobj_release(&clone->hdr);
939 return NULL;
940 }
941 clone->fields[i].type = MSIFIELD_STREAM;
942 }
943 else
944 {
945 r = MSI_RecordCopyField(rec, i, clone, i);
946 if (r != ERROR_SUCCESS)
947 {
948 msiobj_release(&clone->hdr);
949 return NULL;
950 }
951 }
952 }
953
954 return clone;
955}
UINT MSI_RecordCopyField(MSIRECORD *in_rec, UINT in_n, MSIRECORD *out_rec, UINT out_n)
Definition: record.c:166
MSIRECORD * MSI_CreateRecord(UINT cParams)
Definition: record.c:76
UINT MSI_RecordGetFieldCount(const MSIRECORD *rec)
Definition: record.c:108
#define FAILED(hr)
Definition: intsafe.h:51

Referenced by iterate_properties(), merge_diff_row(), and MSI_FormatRecordW().

◆ MSI_CloseRecord()

void MSI_CloseRecord ( MSIOBJECTHDR arg)

Definition at line 67 of file record.c.

68{
69 MSIRECORD *rec = (MSIRECORD *) arg;
70 UINT i;
71
72 for( i=0; i<=rec->count; i++ )
73 MSI_FreeField( &rec->fields[i] );
74}

Referenced by MSI_CreateRecord(), and msi_refresh_record().

◆ MSI_CreateRecord()

MSIRECORD * MSI_CreateRecord ( UINT  cParams)

Definition at line 76 of file record.c.

77{
78 MSIRECORD *rec;
79
80 TRACE("%d\n", cParams);
81
82 if( cParams>65535 )
83 return NULL;
84
87 if( rec )
88 rec->count = cParams;
89 return rec;
90}
void * alloc_msiobject(UINT type, UINT size, msihandledestructor destroy)
Definition: handle.c:201
void MSI_CloseRecord(MSIOBJECTHDR *arg)
Definition: record.c:67
const char * fields[10]
Definition: parser.c:313
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by ACTION_AllocateRegistrySpace(), ACTION_ExecuteAction(), ACTION_MsiPublishAssemblies(), ACTION_MsiUnpublishAssemblies(), ACTION_ProcessComponents(), ACTION_PublishFeatures(), ACTION_PublishProduct(), ACTION_RegisterClassInfo(), ACTION_RegisterExtensionInfo(), ACTION_RegisterMIMEInfo(), ACTION_RegisterProduct(), ACTION_RegisterProgIdInfo(), ACTION_RegisterUser(), ACTION_RemoveFiles(), ACTION_ResolveSource(), ACTION_ShowDialog(), ACTION_UnregisterClassInfo(), ACTION_UnregisterExtensionInfo(), ACTION_UnregisterMIMEInfo(), ACTION_UnregisterProgIdInfo(), add_stream(), construct_record(), deformat_string(), dialog_create(), event_set_target_path(), internal_ui_handler(), ITERATE_AppSearch(), ITERATE_CreateFolders(), ITERATE_DeleteService(), ITERATE_DuplicateFiles(), ITERATE_FindRelatedProducts(), ITERATE_InstallODBCDataSource(), ITERATE_InstallODBCDriver(), ITERATE_InstallODBCTranslator(), ITERATE_MoveFiles(), ITERATE_PublishComponent(), ITERATE_RegisterFonts(), ITERATE_RemoveDuplicateFiles(), ITERATE_RemoveEnvironmentString(), ITERATE_RemoveFiles(), ITERATE_RemoveFolders(), ITERATE_RemoveIniValuesOnInstall(), ITERATE_RemoveIniValuesOnUninstall(), ITERATE_RemoveODBCDataSource(), ITERATE_RemoveODBCDriver(), ITERATE_RemoveODBCTranslator(), ITERATE_RemoveRegistryValuesOnInstall(), ITERATE_RemoveRegistryValuesOnUninstall(), ITERATE_SelfRegModules(), ITERATE_SelfUnregModules(), ITERATE_StartService(), ITERATE_StopService(), ITERATE_UnpublishComponent(), ITERATE_UnregisterFonts(), ITERATE_WriteEnvironmentString(), ITERATE_WriteIniValues(), ITERATE_WriteRegistryValues(), msi_arrange_record(), msi_change_media(), msi_clone_properties(), MSI_CloneRecord(), msi_create_table(), MSI_DatabaseGetPrimaryKeys(), msi_dialog_seltree_handler(), msi_file_update_ui(), msi_get_property_row(), msi_get_transform_record(), MSI_OpenPackageW(), msi_query_merge_record(), msi_set_property(), msi_ui_progress(), msi_unpublish_feature(), msi_view_get_row(), MSI_ViewGetColumnInfo(), MsiCreateRecord(), patch_add_media(), patch_offset_get_filepatches(), patch_offset_get_files(), patch_offset_modify_db(), patch_update_filepatch_sequence(), SELECT_set_row(), TABLE_add_column(), TABLE_drop(), TABLE_remove_column(), translate_record(), ui_actioninfo(), ui_actionstart(), UPDATE_execute(), and WHERE_set_row().

◆ msi_dump_stream_to_file()

static UINT msi_dump_stream_to_file ( IStream stm,
LPCWSTR  name 
)
static

Definition at line 868 of file record.c.

869{
872 IStream *out;
873 DWORD stgm;
874 HRESULT r;
875
877 r = SHCreateStreamOnFileW( name, stgm, &out );
878 if( FAILED( r ) )
880
881 pos.QuadPart = 0;
882 r = IStream_Seek( stm, pos, STREAM_SEEK_END, &size );
883 if( FAILED( r ) )
884 goto end;
885
886 pos.QuadPart = 0;
887 r = IStream_Seek( stm, pos, STREAM_SEEK_SET, NULL );
888 if( FAILED( r ) )
889 goto end;
890
891 r = IStream_CopyTo( stm, out, size, NULL, NULL );
892
893end:
894 IStream_Release( out );
895 if( FAILED( r ) )
897 return ERROR_SUCCESS;
898}
HRESULT WINAPI SHCreateStreamOnFileW(LPCWSTR lpszPath, DWORD dwMode, IStream **lppStream)
Definition: istream.c:484
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
#define STGM_READWRITE
Definition: objbase.h:919
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:923
#define STGM_FAILIFTHERE
Definition: objbase.h:928
Definition: name.c:39
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985

Referenced by MSI_RecordStreamToFile().

◆ msi_dup_record_field()

WCHAR * msi_dup_record_field ( MSIRECORD rec,
INT  field 
)

Definition at line 1002 of file record.c.

1003{
1004 DWORD sz = 0;
1005 WCHAR *str;
1006 UINT r;
1007
1008 if (MSI_RecordIsNull( rec, field )) return NULL;
1009
1010 r = MSI_RecordGetStringW( rec, field, NULL, &sz );
1011 if (r != ERROR_SUCCESS)
1012 return NULL;
1013
1014 sz++;
1015 str = msi_alloc( sz * sizeof(WCHAR) );
1016 if (!str) return NULL;
1017 str[0] = 0;
1018 r = MSI_RecordGetStringW( rec, field, str, &sz );
1019 if (r != ERROR_SUCCESS)
1020 {
1021 ERR("failed to get string!\n");
1022 msi_free( str );
1023 return NULL;
1024 }
1025 return str;
1026}
UINT MSI_RecordGetStringW(MSIRECORD *rec, UINT iField, WCHAR *szValue, DWORD *pcchValue)
Definition: record.c:438
BOOL MSI_RecordIsNull(MSIRECORD *rec, UINT iField)
Definition: record.c:321
static void msi_free(void *mem)
Definition: msipriv.h:1159
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
const WCHAR * str
Definition: parser.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by get_ini_file_name(), get_key_value(), get_link_file(), get_signature(), internal_ui_handler(), iterate_load_verb(), ITERATE_RegisterFonts(), ITERATE_UnregisterFonts(), load_appid(), load_class(), load_component(), load_extension(), load_feature(), load_file(), load_folder(), load_mime(), load_progid(), MSI_FormatRecordW(), msi_get_error_message(), MSI_ProcessMessage(), patch_add_media(), patch_offset_get_filepatches(), patch_offset_get_files(), and search_ini().

◆ MSI_FreeField()

static void MSI_FreeField ( MSIFIELD field)
static

Definition at line 49 of file record.c.

50{
51 switch( field->type )
52 {
53 case MSIFIELD_NULL:
54 case MSIFIELD_INT:
55 break;
56 case MSIFIELD_WSTR:
57 msi_free( field->u.szwVal);
58 break;
59 case MSIFIELD_STREAM:
60 IStream_Release( field->u.stream );
61 break;
62 default:
63 ERR("Invalid field type %d\n", field->type);
64 }
65}
union field::@589 u

Referenced by copy_remote_record(), MSI_CloseRecord(), msi_record_set_string(), MSI_RecordSetInteger(), MSI_RecordSetIStream(), MSI_RecordSetStream(), and MsiRecordClearData().

◆ msi_get_stream_size()

static UINT msi_get_stream_size ( IStream stm)
static

Definition at line 500 of file record.c.

501{
502 STATSTG stat;
503 HRESULT r;
504
505 r = IStream_Stat( stm, &stat, STATFLAG_NONAME );
506 if( FAILED(r) )
507 return 0;
508 return stat.cbSize.QuadPart;
509}
#define stat
Definition: acwin.h:99
Definition: stat.h:55

Referenced by MSI_RecordDataSize().

◆ msi_record_get_string()

const WCHAR * msi_record_get_string ( const MSIRECORD rec,
UINT  field,
int len 
)

Definition at line 420 of file record.c.

421{
422 if (field > rec->count)
423 return NULL;
424
425 if (rec->fields[field].type != MSIFIELD_WSTR)
426 return NULL;
427
428 if (len) *len = rec->fields[field].len;
429
430 return rec->fields[field].u.szwVal;
431}
GLenum GLsizei len
Definition: glext.h:6722

Referenced by get_table_value_from_record(), ITERATE_WriteRegistryValues(), msi_record_to_row(), MSI_RecordGetString(), msi_select_update(), MsiGetPropertyA(), MsiGetPropertyW(), TABLE_set_row(), table_validate_new(), TransformView_Create(), and TransformView_create_table().

◆ msi_record_set_string()

UINT msi_record_set_string ( MSIRECORD rec,
UINT  field,
const WCHAR value,
int  len 
)

Definition at line 573 of file record.c.

574{
575 if (field > rec->count)
576 return ERROR_INVALID_FIELD;
577
578 MSI_FreeField( &rec->fields[field] );
579
580 if (value && len < 0) len = lstrlenW( value );
581
582 if (value && len)
583 {
586 rec->fields[field].len = len;
587 }
588 else
589 {
591 rec->fields[field].u.szwVal = NULL;
592 rec->fields[field].len = 0;
593 }
594 return 0;
595}
#define lstrlenW
Definition: compat.h:750
WCHAR * msi_strdupW(const WCHAR *value, int len)
Definition: record.c:155
Definition: pdh_main.c:94
#define ERROR_INVALID_FIELD
Definition: winerror.h:974

Referenced by msi_get_transform_record(), MSI_RecordSetStringW(), msi_set_property(), and msi_view_refresh_row().

◆ MSI_RecordCopyField()

UINT MSI_RecordCopyField ( MSIRECORD in_rec,
UINT  in_n,
MSIRECORD out_rec,
UINT  out_n 
)

Definition at line 166 of file record.c.

168{
170
171 msiobj_lock( &in_rec->hdr );
172
173 if ( in_n > in_rec->count || out_n > out_rec->count )
175 else if ( in_rec != out_rec || in_n != out_n )
176 {
177 LPWSTR str;
178 MSIFIELD *in, *out;
179
180 in = &in_rec->fields[in_n];
181 out = &out_rec->fields[out_n];
182
183 switch ( in->type )
184 {
185 case MSIFIELD_NULL:
186 break;
187 case MSIFIELD_INT:
188 out->u.iVal = in->u.iVal;
189 break;
190 case MSIFIELD_WSTR:
191 if ((str = msi_strdupW( in->u.szwVal, in->len )))
192 {
193 out->u.szwVal = str;
194 out->len = in->len;
195 }
196 else r = ERROR_OUTOFMEMORY;
197 break;
198 case MSIFIELD_STREAM:
199 IStream_AddRef( in->u.stream );
200 out->u.stream = in->u.stream;
201 break;
202 default:
203 ERR("invalid field type %d\n", in->type);
204 }
205 if (r == ERROR_SUCCESS)
206 out->type = in->type;
207 }
208
209 msiobj_unlock( &in_rec->hdr );
210 return r;
211}
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
void msiobj_lock(MSIOBJECTHDR *info)
Definition: handle.c:231
void msiobj_unlock(MSIOBJECTHDR *info)
Definition: handle.c:236
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by msi_arrange_record(), msi_clone_properties(), MSI_CloneRecord(), msi_query_merge_record(), msi_refresh_record(), SELECT_set_row(), translate_record(), UPDATE_execute(), and WHERE_set_row().

◆ MSI_RecordDataSize()

static UINT MSI_RecordDataSize ( MSIRECORD rec,
UINT  iField 
)
static

Definition at line 511 of file record.c.

512{
513 TRACE("%p %d\n", rec, iField);
514
515 if( iField > rec->count )
516 return 0;
517
518 switch( rec->fields[iField].type )
519 {
520 case MSIFIELD_INT:
521 return sizeof (INT);
522 case MSIFIELD_WSTR:
523 return rec->fields[iField].len;
524 case MSIFIELD_NULL:
525 break;
526 case MSIFIELD_STREAM:
527 return msi_get_stream_size( rec->fields[iField].u.stream );
528 }
529 return 0;
530}
static UINT msi_get_stream_size(IStream *stm)
Definition: record.c:500
#define INT
Definition: polytest.cpp:20

Referenced by MsiRecordDataSize().

◆ MSI_RecordGetFieldCount()

◆ MSI_RecordGetInteger()

int MSI_RecordGetInteger ( MSIRECORD rec,
UINT  iField 
)

Definition at line 213 of file record.c.

214{
215 int ret = 0;
216
217 TRACE("%p %d\n", rec, iField );
218
219 if( iField > rec->count )
220 return MSI_NULL_INTEGER;
221
222 switch( rec->fields[iField].type )
223 {
224 case MSIFIELD_INT:
225 return rec->fields[iField].u.iVal;
226 case MSIFIELD_WSTR:
227 if( string2intW( rec->fields[iField].u.szwVal, &ret ) )
228 return ret;
229 return MSI_NULL_INTEGER;
230 default:
231 break;
232 }
233
234 return MSI_NULL_INTEGER;
235}
static BOOL string2intW(LPCWSTR str, int *out)
Definition: record.c:132
#define MSI_NULL_INTEGER
Definition: msiquery.h:32

Referenced by ACTION_CustomAction(), ACTION_ProcessComponents(), dialog_create(), dialog_create_window(), dialog_handle_event(), get_signature(), get_table_value_from_record(), internal_ui_handler(), ITERATE_CostFinalizeConditions(), ITERATE_CreateShortcuts(), ITERATE_DeleteService(), ITERATE_FindRelatedProducts(), ITERATE_InstallODBCDataSource(), ITERATE_InstallService(), iterate_load_verb(), ITERATE_MigrateFeatureStates(), ITERATE_MoveFiles(), ITERATE_RemoveExistingProducts(), ITERATE_RemoveFiles(), ITERATE_RemoveIniValuesOnInstall(), ITERATE_RemoveIniValuesOnUninstall(), ITERATE_RemoveODBCDataSource(), ITERATE_RemoveRegistryValuesOnInstall(), ITERATE_RemoveRegistryValuesOnUninstall(), ITERATE_StartService(), ITERATE_StopService(), ITERATE_UnregisterTypeLibraries(), ITERATE_WriteIniValues(), ITERATE_WriteRegistryValues(), load_class(), load_component(), load_feature(), load_file(), load_file_disk_id(), load_file_hash(), load_media(), load_patch(), load_patch_disk_id(), load_progid(), msi_dialog_add_control(), msi_dialog_add_font(), msi_dialog_adjust_dialog_pos(), msi_dialog_bitmap_control(), msi_dialog_button_control(), msi_dialog_combo_control(), msi_dialog_directory_combo(), msi_dialog_directory_list(), msi_dialog_hyperlink(), msi_dialog_icon_control(), msi_dialog_line_control(), msi_dialog_list_box(), msi_dialog_listview(), msi_dialog_oncreate(), msi_dialog_pathedit_control(), msi_dialog_progress_bar(), msi_dialog_radiogroup_control(), msi_dialog_selection_tree(), msi_dialog_text_control(), msi_dialog_volumeselect_combo(), msi_load_assembly(), msi_load_media_info(), msi_primary_key_iterator(), MSI_ProcessMessage(), msi_record_to_row(), msi_select_update(), msi_table_load_transform(), MsiRecordGetInteger(), patch_add_media(), patch_offset_get_filepatches(), patch_offset_get_files(), patch_set_offsets(), patch_update_file_sequence(), patch_update_filepatch_sequence(), resolve_keypath(), search_components(), search_dr(), search_ini(), search_reg(), table_validate_new(), and WHERE_evaluate().

◆ MSI_RecordGetIStream()

UINT MSI_RecordGetIStream ( MSIRECORD rec,
UINT  iField,
IStream **  pstm 
)

Definition at line 852 of file record.c.

853{
854 TRACE("%p %d %p\n", rec, iField, pstm);
855
856 if( iField > rec->count )
857 return ERROR_INVALID_FIELD;
858
859 if( rec->fields[iField].type != MSIFIELD_STREAM )
860 return ERROR_INVALID_FIELD;
861
862 *pstm = rec->fields[iField].u.stream;
863 IStream_AddRef( *pstm );
864
865 return ERROR_SUCCESS;
866}

Referenced by msi_load_picture(), MSI_RecordStreamToFile(), msi_select_update(), STORAGES_set_row(), STREAMS_set_row(), and TABLE_set_row().

◆ MSI_RecordGetString()

const WCHAR * MSI_RecordGetString ( const MSIRECORD rec,
UINT  iField 
)

Definition at line 433 of file record.c.

434{
435 return msi_record_get_string( rec, iField, NULL );
436}
const WCHAR * msi_record_get_string(const MSIRECORD *rec, UINT field, int *len)
Definition: record.c:420

Referenced by ACTION_CustomAction(), ACTION_PerformActionSequence(), create_diff_row_query(), dialog_create(), dialog_create_window(), dialog_handle_event(), find_feature_children(), find_folder_children(), get_assembly_name_attribute(), get_assembly_record(), get_duplicate_filename(), get_ini_file_name(), get_key_value(), get_link_file(), get_property(), HANDLE_CustomType19(), internal_ui_handler(), is_uninstallable(), ITERATE_Actions(), iterate_all_classes(), iterate_all_extensions(), iterate_all_mimes(), iterate_all_progids(), ITERATE_AppSearch(), ITERATE_BindImage(), ITERATE_CCPSearch(), ITERATE_CostFinalizeConditions(), ITERATE_CreateFolders(), ITERATE_CreateShortcuts(), ITERATE_DeleteService(), ITERATE_DuplicateFiles(), ITERATE_FindRelatedProducts(), ITERATE_InstallODBCDataSource(), ITERATE_InstallODBCDriver(), ITERATE_InstallODBCTranslator(), ITERATE_InstallService(), ITERATE_LaunchConditions(), iterate_load_featurecomponents(), iterate_load_verb(), ITERATE_MigrateFeatureStates(), ITERATE_MoveFiles(), iterate_patched_component(), ITERATE_PublishComponent(), ITERATE_PublishIcon(), ITERATE_RegisterFonts(), ITERATE_RegisterTypeLibraries(), ITERATE_RemoveDuplicateFiles(), ITERATE_RemoveEnvironmentString(), ITERATE_RemoveExistingProducts(), ITERATE_RemoveFiles(), ITERATE_RemoveFolders(), ITERATE_RemoveIniValuesOnInstall(), ITERATE_RemoveIniValuesOnUninstall(), ITERATE_RemoveODBCDataSource(), ITERATE_RemoveODBCDriver(), ITERATE_RemoveODBCTranslator(), ITERATE_RemoveRegistryValuesOnInstall(), ITERATE_RemoveRegistryValuesOnUninstall(), ITERATE_RemoveShortcuts(), ITERATE_SelfRegModules(), ITERATE_SelfUnregModules(), ITERATE_StartService(), ITERATE_StopService(), ITERATE_UnpublishComponent(), ITERATE_UnpublishIcon(), ITERATE_UnregisterFonts(), ITERATE_UnregisterTypeLibraries(), ITERATE_WriteEnvironmentString(), ITERATE_WriteIniValues(), ITERATE_WriteRegistryValues(), join_find_row(), load_appid(), load_class(), load_extension(), load_file(), load_media(), load_mime(), load_patch(), load_progid(), map_event(), merge_diff_tables(), merge_verify_colnames(), merge_verify_primary_keys(), msi_combobox_add_item(), msi_dialog_add_control(), msi_dialog_add_font(), msi_dialog_checkbox_control(), msi_dialog_combo_control(), msi_dialog_control_event(), msi_dialog_create_controls(), msi_dialog_create_radiobutton(), msi_dialog_directory_combo(), msi_dialog_directory_list(), msi_dialog_edit_control(), msi_dialog_get_uitext(), msi_dialog_hyperlink(), msi_dialog_line_control(), msi_dialog_list_box(), msi_dialog_listview(), msi_dialog_maskedit_control(), msi_dialog_oncreate(), msi_dialog_pathedit_control(), msi_dialog_radiogroup_control(), msi_dialog_scrolltext_control(), msi_dialog_selection_tree(), msi_dialog_seltree_handler(), msi_dialog_set_control_condition(), msi_dialog_text_control(), msi_dialog_vcl_add_columns(), msi_dialog_volumeselect_combo(), MSI_FormatRecordW(), msi_get_deformatted_field(), msi_get_query_columns(), msi_get_query_types(), msi_get_table_labels(), msi_listbox_add_item(), msi_listview_add_item(), msi_load_assembly(), msi_load_media_info(), msi_media_get_disk_info(), msi_primary_key_iterator(), MsiGetProductPropertyW(), patch_set_media_source_prop(), patch_update_file_sequence(), patch_update_filepatch_sequence(), resolve_keypath(), search_components(), search_dr(), search_reg(), storages_find_row(), STORAGES_set_row(), streams_find_row(), STREAMS_set_row(), STRING_evaluate(), and ui_actionstart().

◆ MSI_RecordGetStringA()

UINT MSI_RecordGetStringA ( MSIRECORD rec,
UINT  iField,
LPSTR  szValue,
LPDWORD  pcchValue 
)

Definition at line 351 of file record.c.

353{
354 UINT len = 0, ret = ERROR_SUCCESS;
355 CHAR buffer[16];
356
357 TRACE("%p %d %p %p\n", rec, iField, szValue, pcchValue);
358
359 if( iField > rec->count )
360 {
361 if ( szValue && *pcchValue > 0 )
362 szValue[0] = 0;
363
364 *pcchValue = 0;
365 return ERROR_SUCCESS;
366 }
367
368 switch( rec->fields[iField].type )
369 {
370 case MSIFIELD_INT:
371 wsprintfA(buffer, "%d", rec->fields[iField].u.iVal);
372 len = lstrlenA( buffer );
373 if (szValue)
374 lstrcpynA(szValue, buffer, *pcchValue);
375 break;
376 case MSIFIELD_WSTR:
377 len = WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal,
378 rec->fields[iField].len + 1, NULL, 0 , NULL, NULL );
379 if (szValue)
380 WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal,
381 rec->fields[iField].len + 1, szValue, *pcchValue, NULL, NULL );
382 if( szValue && *pcchValue && len>*pcchValue )
383 szValue[*pcchValue-1] = 0;
384 if( len )
385 len--;
386 break;
387 case MSIFIELD_NULL:
388 if( szValue && *pcchValue > 0 )
389 szValue[0] = 0;
390 break;
391 default:
393 break;
394 }
395
396 if( szValue && *pcchValue <= len )
398 *pcchValue = len;
399
400 return ret;
401}
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define lstrcpynA
Definition: compat.h:751
#define WideCharToMultiByte
Definition: compat.h:111
GLuint buffer
Definition: glext.h:5915
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
char CHAR
Definition: xmlstorage.h:175

Referenced by msi_export_field(), and MsiRecordGetStringA().

◆ MSI_RecordGetStringW()

UINT MSI_RecordGetStringW ( MSIRECORD rec,
UINT  iField,
WCHAR szValue,
DWORD pcchValue 
)

Definition at line 438 of file record.c.

439{
440 UINT len = 0, ret = ERROR_SUCCESS;
441 WCHAR buffer[16];
442
443 TRACE( "%p, %u, %p, %p\n", rec, iField, szValue, pcchValue );
444
445 if( iField > rec->count )
446 {
447 if ( szValue && *pcchValue > 0 )
448 szValue[0] = 0;
449
450 *pcchValue = 0;
451 return ERROR_SUCCESS;
452 }
453
454 switch( rec->fields[iField].type )
455 {
456 case MSIFIELD_INT:
457 wsprintfW(buffer, L"%d", rec->fields[iField].u.iVal);
458 len = lstrlenW( buffer );
459 if (szValue)
460 lstrcpynW(szValue, buffer, *pcchValue);
461 break;
462 case MSIFIELD_WSTR:
463 len = rec->fields[iField].len;
464 if (szValue)
465 memcpy( szValue, rec->fields[iField].u.szwVal, min(len + 1, *pcchValue) * sizeof(WCHAR) );
466 break;
467 case MSIFIELD_NULL:
468 if( szValue && *pcchValue > 0 )
469 szValue[0] = 0;
470 break;
471 default:
472 break;
473 }
474
475 if( szValue && *pcchValue <= len )
477 *pcchValue = len;
478
479 return ret;
480}
#define lstrcpynW
Definition: compat.h:738
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define min(a, b)
Definition: monoChain.cc:55
#define L(x)
Definition: ntvdm.h:50
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by msi_dup_record_field(), and MsiRecordGetStringW().

◆ MSI_RecordIsNull()

◆ MSI_RecordReadStream()

UINT MSI_RecordReadStream ( MSIRECORD rec,
UINT  iField,
char buf,
LPDWORD  sz 
)

Definition at line 761 of file record.c.

762{
763 ULONG count;
764 HRESULT r;
765 IStream *stm;
766
767 TRACE("%p %d %p %p\n", rec, iField, buf, sz);
768
769 if( !sz )
771
772 if( iField > rec->count)
774
775 if ( rec->fields[iField].type == MSIFIELD_NULL )
776 {
777 *sz = 0;
778 return ERROR_INVALID_DATA;
779 }
780
781 if( rec->fields[iField].type != MSIFIELD_STREAM )
783
784 stm = rec->fields[iField].u.stream;
785 if( !stm )
787
788 /* if there's no buffer pointer, calculate the length to the end */
789 if( !buf )
790 {
791 LARGE_INTEGER ofs;
793
794 ofs.QuadPart = cur.QuadPart = 0;
795 end.QuadPart = 0;
796 IStream_Seek( stm, ofs, STREAM_SEEK_SET, &cur );
797 IStream_Seek( stm, ofs, STREAM_SEEK_END, &end );
798 ofs.QuadPart = cur.QuadPart;
799 IStream_Seek( stm, ofs, STREAM_SEEK_SET, &cur );
800 *sz = end.QuadPart - cur.QuadPart;
801
802 return ERROR_SUCCESS;
803 }
804
805 /* read the data */
806 count = 0;
807 r = IStream_Read( stm, buf, *sz, &count );
808 if( FAILED( r ) )
809 {
810 *sz = 0;
812 }
813
814 *sz = count;
815
816 return ERROR_SUCCESS;
817}
FxCollectionEntry * cur
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
#define ERROR_INVALID_DATATYPE
Definition: winerror.h:1111
#define ERROR_INVALID_DATA
Definition: winerror.h:116

Referenced by create_temp_binary(), HANDLE_CustomType5_6(), ITERATE_PublishIcon(), msi_export_stream(), and MsiRecordReadStream().

◆ MSI_RecordsAreEqual()

BOOL MSI_RecordsAreEqual ( MSIRECORD a,
MSIRECORD b 
)

Definition at line 986 of file record.c.

987{
988 UINT i;
989
990 if (a->count != b->count)
991 return FALSE;
992
993 for (i = 0; i <= a->count; i++)
994 {
995 if (!MSI_RecordsAreFieldsEqual( a, b, i ))
996 return FALSE;
997 }
998
999 return TRUE;
1000}
#define FALSE
Definition: types.h:117
BOOL MSI_RecordsAreFieldsEqual(MSIRECORD *a, MSIRECORD *b, UINT field)
Definition: record.c:957
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by merge_diff_row().

◆ MSI_RecordsAreFieldsEqual()

BOOL MSI_RecordsAreFieldsEqual ( MSIRECORD a,
MSIRECORD b,
UINT  field 
)

Definition at line 957 of file record.c.

958{
959 if (a->fields[field].type != b->fields[field].type)
960 return FALSE;
961
962 switch (a->fields[field].type)
963 {
964 case MSIFIELD_NULL:
965 break;
966
967 case MSIFIELD_INT:
968 if (a->fields[field].u.iVal != b->fields[field].u.iVal)
969 return FALSE;
970 break;
971
972 case MSIFIELD_WSTR:
973 if (a->fields[field].len != b->fields[field].len) return FALSE;
974 if (memcmp( a->fields[field].u.szwVal, b->fields[field].u.szwVal,
975 a->fields[field].len * sizeof(WCHAR) )) return FALSE;
976 break;
977
978 case MSIFIELD_STREAM:
979 default:
980 return FALSE;
981 }
982 return TRUE;
983}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112

Referenced by join_modify_update(), and MSI_RecordsAreEqual().

◆ MSI_RecordSetInteger()

◆ MSI_RecordSetIStream()

UINT MSI_RecordSetIStream ( MSIRECORD rec,
UINT  iField,
IStream stm 
)

Definition at line 836 of file record.c.

837{
838 TRACE("%p %d %p\n", rec, iField, stm);
839
840 if( iField > rec->count )
841 return ERROR_INVALID_FIELD;
842
843 MSI_FreeField( &rec->fields[iField] );
844
845 rec->fields[iField].type = MSIFIELD_STREAM;
846 rec->fields[iField].u.stream = stm;
847 IStream_AddRef( stm );
848
849 return ERROR_SUCCESS;
850}

Referenced by add_stream(), copy_remote_record(), and msi_view_refresh_row().

◆ MSI_RecordSetStream()

UINT MSI_RecordSetStream ( MSIRECORD rec,
UINT  iField,
IStream stream 
)

Definition at line 671 of file record.c.

672{
673 if ( (iField == 0) || (iField > rec->count) )
675
676 MSI_FreeField( &rec->fields[iField] );
677 rec->fields[iField].type = MSIFIELD_STREAM;
678 rec->fields[iField].u.stream = stream;
679
680 return ERROR_SUCCESS;
681}
Definition: parse.h:23

Referenced by msi_get_transform_record(), and MSI_RecordSetStreamFromFileW().

◆ MSI_RecordSetStreamFromFileW()

UINT MSI_RecordSetStreamFromFileW ( MSIRECORD rec,
UINT  iField,
LPCWSTR  szFilename 
)

Definition at line 683 of file record.c.

684{
685 IStream *stm = NULL;
686 HRESULT hr;
687 UINT ret;
688
689 if( (iField == 0) || (iField > rec->count) )
691
692 /* no filename means we should seek back to the start of the stream */
693 if( !szFilename )
694 {
695 LARGE_INTEGER ofs;
697
698 if( rec->fields[iField].type != MSIFIELD_STREAM )
699 return ERROR_INVALID_FIELD;
700
701 stm = rec->fields[iField].u.stream;
702 if( !stm )
703 return ERROR_INVALID_FIELD;
704
705 ofs.QuadPart = 0;
706 hr = IStream_Seek( stm, ofs, STREAM_SEEK_SET, &cur );
707 if (FAILED( hr ))
709 }
710 else
711 {
712 /* read the file into a stream and save the stream in the record */
713 ret = RECORD_StreamFromFile(szFilename, &stm);
714 if (ret != ERROR_SUCCESS)
715 return ret;
716
717 /* if all's good, store it in the record */
718 MSI_RecordSetStream(rec, iField, stm);
719 }
720
721 return ERROR_SUCCESS;
722}
static UINT RECORD_StreamFromFile(LPCWSTR szFile, IStream **pstm)
Definition: record.c:623
UINT MSI_RecordSetStream(MSIRECORD *rec, UINT iField, IStream *stream)
Definition: record.c:671
HRESULT hr
Definition: shlfolder.c:183

Referenced by construct_record(), and MsiRecordSetStreamW().

◆ MSI_RecordSetStringW()

UINT MSI_RecordSetStringW ( MSIRECORD rec,
UINT  iField,
LPCWSTR  szValue 
)

Definition at line 597 of file record.c.

598{
599 TRACE("%p %d %s\n", rec, iField, debugstr_w(szValue));
600
601 return msi_record_set_string( rec, iField, szValue, -1 );
602}
UINT msi_record_set_string(MSIRECORD *rec, UINT field, const WCHAR *value, int len)
Definition: record.c:573

Referenced by ACTION_ExecuteAction(), ACTION_MsiPublishAssemblies(), ACTION_MsiUnpublishAssemblies(), ACTION_ProcessComponents(), ACTION_PublishFeatures(), ACTION_PublishProduct(), ACTION_RegisterClassInfo(), ACTION_RegisterExtensionInfo(), ACTION_RegisterMIMEInfo(), ACTION_RegisterProduct(), ACTION_RegisterProgIdInfo(), ACTION_RegisterUser(), ACTION_RemoveFiles(), ACTION_ResolveSource(), ACTION_ShowDialog(), ACTION_UnregisterClassInfo(), ACTION_UnregisterExtensionInfo(), ACTION_UnregisterMIMEInfo(), ACTION_UnregisterProgIdInfo(), add_stream(), construct_record(), copy_remote_record(), deformat_string(), dialog_create(), event_set_target_path(), internal_ui_handler(), ITERATE_AppSearch(), ITERATE_CreateFolders(), ITERATE_DeleteService(), ITERATE_DuplicateFiles(), ITERATE_FindRelatedProducts(), ITERATE_InstallODBCDataSource(), ITERATE_InstallODBCDriver(), ITERATE_InstallODBCTranslator(), ITERATE_MoveFiles(), iterate_properties(), ITERATE_PublishComponent(), ITERATE_RegisterFonts(), ITERATE_RemoveDuplicateFiles(), ITERATE_RemoveEnvironmentString(), ITERATE_RemoveFiles(), ITERATE_RemoveFolders(), ITERATE_RemoveIniValuesOnInstall(), ITERATE_RemoveIniValuesOnUninstall(), ITERATE_RemoveODBCDataSource(), ITERATE_RemoveODBCDriver(), ITERATE_RemoveODBCTranslator(), ITERATE_RemoveRegistryValuesOnInstall(), ITERATE_RemoveRegistryValuesOnUninstall(), ITERATE_SelfRegModules(), ITERATE_SelfUnregModules(), ITERATE_StartService(), ITERATE_StopService(), ITERATE_UnpublishComponent(), ITERATE_UnregisterFonts(), ITERATE_WriteEnvironmentString(), ITERATE_WriteIniValues(), ITERATE_WriteRegistryValues(), msi_change_media(), msi_create_table(), MSI_DatabaseExport(), msi_dialog_seltree_handler(), msi_file_update_ui(), MSI_FormatRecordW(), msi_get_property_row(), MSI_OpenPackageW(), msi_primary_key_iterator(), MSI_ProcessMessage(), msi_query_merge_record(), msi_set_record_type_string(), msi_unpublish_feature(), MSI_ViewGetColumnInfo(), MsiRecordSetStringA(), MsiRecordSetStringW(), patch_add_media(), patch_update_filepatch_sequence(), TABLE_add_column(), TABLE_drop(), TABLE_remove_column(), ui_actioninfo(), and ui_actionstart().

◆ MSI_RecordStreamToFile()

UINT MSI_RecordStreamToFile ( MSIRECORD rec,
UINT  iField,
LPCWSTR  name 
)

Definition at line 900 of file record.c.

901{
902 IStream *stm = NULL;
903 UINT r;
904
905 TRACE("%p %u %s\n", rec, iField, debugstr_w(name));
906
907 msiobj_lock( &rec->hdr );
908
909 r = MSI_RecordGetIStream( rec, iField, &stm );
910 if( r == ERROR_SUCCESS )
911 {
913 IStream_Release( stm );
914 }
915
916 msiobj_unlock( &rec->hdr );
917
918 return r;
919}
static UINT msi_dump_stream_to_file(IStream *stm, LPCWSTR name)
Definition: record.c:868
UINT MSI_RecordGetIStream(MSIRECORD *rec, UINT iField, IStream **pstm)
Definition: record.c:852

Referenced by msi_load_image().

◆ msi_strdupW()

WCHAR * msi_strdupW ( const WCHAR value,
int  len 
)

Definition at line 155 of file record.c.

156{
157 WCHAR *ret;
158
159 if (!value) return NULL;
160 if (!(ret = msi_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
161 memcpy( ret, value, len * sizeof(WCHAR) );
162 ret[len] = 0;
163 return ret;
164}

Referenced by ACTION_ExecuteAction(), msi_record_set_string(), MSI_RecordCopyField(), and parse_value().

◆ MsiCreateRecord()

◆ MsiRecordClearData()

UINT WINAPI MsiRecordClearData ( MSIHANDLE  handle)

Definition at line 256 of file record.c.

257{
258 MSIRECORD *rec;
259 UINT i;
260
261 TRACE( "%lu\n", handle );
262
264 if( !rec )
266
267 msiobj_lock( &rec->hdr );
268 for( i=0; i<=rec->count; i++)
269 {
270 MSI_FreeField( &rec->fields[i] );
271 rec->fields[i].type = MSIFIELD_NULL;
272 rec->fields[i].u.iVal = 0;
273 }
274 msiobj_unlock( &rec->hdr );
275 msiobj_release( &rec->hdr );
276
277 return ERROR_SUCCESS;
278}

Referenced by test_msirecord().

◆ MsiRecordDataSize()

UINT WINAPI MsiRecordDataSize ( MSIHANDLE  handle,
UINT  iField 
)

Definition at line 532 of file record.c.

533{
534 MSIRECORD *rec;
535 UINT ret;
536
537 TRACE( "%lu, %u\n", handle, iField );
538
540 if( !rec )
541 return 0;
542 msiobj_lock( &rec->hdr );
543 ret = MSI_RecordDataSize( rec, iField);
544 msiobj_unlock( &rec->hdr );
545 msiobj_release( &rec->hdr );
546 return ret;
547}
static UINT MSI_RecordDataSize(MSIRECORD *rec, UINT iField)
Definition: record.c:511

Referenced by test_msirecord().

◆ MsiRecordGetFieldCount()

UINT WINAPI MsiRecordGetFieldCount ( MSIHANDLE  handle)

Definition at line 113 of file record.c.

114{
115 MSIRECORD *rec;
116 UINT ret;
117
118 TRACE( "%lu\n", handle );
119
121 if( !rec )
122 return -1;
123
124 msiobj_lock( &rec->hdr );
126 msiobj_unlock( &rec->hdr );
127 msiobj_release( &rec->hdr );
128
129 return ret;
130}

Referenced by check_record_(), externalui_message_callback(), externalui_record_callback(), record_invoke(), test_db(), test_integers(), test_msiinsert(), test_msirecord(), and test_packagecoltypes().

◆ MsiRecordGetInteger()

◆ MsiRecordGetStringA()

UINT WINAPI MsiRecordGetStringA ( MSIHANDLE  handle,
UINT  iField,
char szValue,
DWORD pcchValue 
)

Definition at line 403 of file record.c.

404{
405 MSIRECORD *rec;
406 UINT ret;
407
408 TRACE( "%lu, %d, %p, %p\n", handle, iField, szValue, pcchValue );
409
411 if( !rec )
413 msiobj_lock( &rec->hdr );
414 ret = MSI_RecordGetStringA( rec, iField, szValue, pcchValue);
415 msiobj_unlock( &rec->hdr );
416 msiobj_release( &rec->hdr );
417 return ret;
418}
UINT MSI_RecordGetStringA(MSIRECORD *rec, UINT iField, LPSTR szValue, LPDWORD pcchValue)
Definition: record.c:351

Referenced by check_record(), check_record_(), externalui_message_callback(), find_prop_in_property(), get_string(), ok_callback(), test_binary(), test_binary_import(), test_collation(), test_createtable(), test_db(), test_embedded_nulls(), test_emptypackage(), test_fieldzero(), test_longstrings(), test_msiinsert(), test_msirecord(), test_MsiRecordGetString(), test_primary_keys(), test_storages_table(), test_streamtable(), and test_try_transform().

◆ MsiRecordGetStringW()

UINT WINAPI MsiRecordGetStringW ( MSIHANDLE  handle,
UINT  iField,
WCHAR szValue,
DWORD pcchValue 
)

Definition at line 482 of file record.c.

483{
484 MSIRECORD *rec;
485 UINT ret;
486
487 TRACE( "%lu, %u, %p, %p\n", handle, iField, szValue, pcchValue );
488
490 if( !rec )
492
493 msiobj_lock( &rec->hdr );
494 ret = MSI_RecordGetStringW( rec, iField, szValue, pcchValue );
495 msiobj_unlock( &rec->hdr );
496 msiobj_release( &rec->hdr );
497 return ret;
498}

Referenced by record_invoke(), test_collation(), and test_msirecord().

◆ MsiRecordIsNull()

BOOL WINAPI MsiRecordIsNull ( MSIHANDLE  handle,
UINT  iField 
)

Definition at line 333 of file record.c.

334{
335 MSIRECORD *rec;
336 UINT ret;
337
338 TRACE( "%lu, %u\n", handle, iField );
339
341 if( !rec )
342 return FALSE;
343 msiobj_lock( &rec->hdr );
344 ret = MSI_RecordIsNull( rec, iField );
345 msiobj_unlock( &rec->hdr );
346 msiobj_release( &rec->hdr );
347 return ret;
348
349}

Referenced by test_fieldzero(), test_msiinsert(), and test_msirecord().

◆ MsiRecordReadStream()

UINT WINAPI MsiRecordReadStream ( MSIHANDLE  handle,
UINT  iField,
char buf,
DWORD sz 
)

Definition at line 819 of file record.c.

820{
821 MSIRECORD *rec;
822 UINT ret;
823
824 TRACE( "%lu, %u, %p, %p\n", handle, iField, buf, sz );
825
827 if( !rec )
829 msiobj_lock( &rec->hdr );
830 ret = MSI_RecordReadStream( rec, iField, buf, sz );
831 msiobj_unlock( &rec->hdr );
832 msiobj_release( &rec->hdr );
833 return ret;
834}
UINT MSI_RecordReadStream(MSIRECORD *rec, UINT iField, char *buf, LPDWORD sz)
Definition: record.c:761

Referenced by test_binary(), test_binary_import(), test_db(), test_dbmerge(), test_msirecord(), test_storages_table(), test_streamtable(), and test_try_transform().

◆ MsiRecordSetInteger()

◆ MsiRecordSetStreamA()

UINT WINAPI MsiRecordSetStreamA ( MSIHANDLE  hRecord,
UINT  iField,
const char szFilename 
)

Definition at line 724 of file record.c.

725{
726 WCHAR *wstr = NULL;
727 UINT ret;
728
729 TRACE( "%lu, %u, %s\n", hRecord, iField, debugstr_a(szFilename) );
730
731 if( szFilename )
732 {
733 wstr = strdupAtoW( szFilename );
734 if( !wstr )
735 return ERROR_OUTOFMEMORY;
736 }
737 ret = MsiRecordSetStreamW(hRecord, iField, wstr);
738 msi_free(wstr);
739
740 return ret;
741}
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
UINT WINAPI MsiRecordSetStreamW(MSIHANDLE handle, UINT iField, const WCHAR *szFilename)
Definition: record.c:743
#define debugstr_a
Definition: kernel32.h:31

Referenced by add_custom_dll(), generate_transform(), test_binary(), test_customaction1(), test_dbmerge(), test_icon_table(), test_msirecord(), test_storages_table(), test_streamtable(), and test_try_transform().

◆ MsiRecordSetStreamW()

UINT WINAPI MsiRecordSetStreamW ( MSIHANDLE  handle,
UINT  iField,
const WCHAR szFilename 
)

Definition at line 743 of file record.c.

744{
745 MSIRECORD *rec;
746 UINT ret;
747
748 TRACE( "%lu, %u, %s\n", handle, iField, debugstr_w(szFilename) );
749
751 if( !rec )
753
754 msiobj_lock( &rec->hdr );
755 ret = MSI_RecordSetStreamFromFileW( rec, iField, szFilename );
756 msiobj_unlock( &rec->hdr );
757 msiobj_release( &rec->hdr );
758 return ret;
759}
UINT MSI_RecordSetStreamFromFileW(MSIRECORD *rec, UINT iField, LPCWSTR szFilename)
Definition: record.c:683

Referenced by MsiRecordSetStreamA().

◆ MsiRecordSetStringA()

◆ MsiRecordSetStringW()

UINT WINAPI MsiRecordSetStringW ( MSIHANDLE  handle,
UINT  iField,
const WCHAR szValue 
)

Definition at line 604 of file record.c.

605{
606 MSIRECORD *rec;
607 UINT ret;
608
609 TRACE( "%lu, %u, %s\n", handle, iField, debugstr_w(szValue) );
610
612 if( !rec )
614
615 msiobj_lock( &rec->hdr );
616 ret = MSI_RecordSetStringW( rec, iField, szValue );
617 msiobj_unlock( &rec->hdr );
618 msiobj_release( &rec->hdr );
619 return ret;
620}

Referenced by record_invoke().

◆ RECORD_StreamFromFile()

static UINT RECORD_StreamFromFile ( LPCWSTR  szFile,
IStream **  pstm 
)
static

Definition at line 623 of file record.c.

624{
625 DWORD sz, szHighWord = 0, read;
627 HGLOBAL hGlob = 0;
628 HRESULT hr;
629 ULARGE_INTEGER ulSize;
630
631 TRACE("reading %s\n", debugstr_w(szFile));
632
633 /* read the file into memory */
636 return GetLastError();
637 sz = GetFileSize(handle, &szHighWord);
638 if( sz != INVALID_FILE_SIZE && szHighWord == 0 )
639 {
640 hGlob = GlobalAlloc(GMEM_FIXED, sz);
641 if( hGlob )
642 {
643 BOOL r = ReadFile(handle, hGlob, sz, &read, NULL) && read == sz;
644 if( !r )
645 {
646 GlobalFree(hGlob);
647 hGlob = 0;
648 }
649 }
650 }
652 if( !hGlob )
654
655 /* make a stream out of it, and set the correct file size */
656 hr = CreateStreamOnHGlobal(hGlob, TRUE, pstm);
657 if( FAILED( hr ) )
658 {
659 GlobalFree(hGlob);
661 }
662
663 /* set the correct size - CreateStreamOnHGlobal screws it up */
664 ulSize.QuadPart = sz;
665 IStream_SetSize(*pstm, ulSize);
666
667 TRACE( "read %s, %lu bytes into IStream %p\n", debugstr_w(szFile), sz, *pstm );
668 return ERROR_SUCCESS;
669}
#define read
Definition: acwin.h:96
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GMEM_FIXED
Definition: winbase.h:293
#define INVALID_FILE_SIZE
Definition: winbase.h:548

Referenced by MSI_RecordSetStreamFromFileW().

◆ string2intW()

static BOOL string2intW ( LPCWSTR  str,
int out 
)
static

Definition at line 132 of file record.c.

133{
134 int x = 0;
135 LPCWSTR p = str;
136
137 if( *p == '-' ) /* skip the minus sign */
138 p++;
139 while ( *p )
140 {
141 if( (*p < '0') || (*p > '9') )
142 return FALSE;
143 x *= 10;
144 x += (*p - '0');
145 p++;
146 }
147
148 if( str[0] == '-' ) /* check if it's negative */
149 x = -x;
150 *out = x;
151
152 return TRUE;
153}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLfloat GLfloat p
Definition: glext.h:8902
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by MSI_RecordGetInteger().

◆ unmarshal_record()

UINT unmarshal_record ( const struct wire_record in,
MSIHANDLE out 
)

Definition at line 1095 of file record.c.

1096{
1097 if (!in)
1098 {
1099 *out = 0;
1100 return ERROR_SUCCESS;
1101 }
1102
1103 *out = MsiCreateRecord(in->count);
1104 if (!*out) return ERROR_OUTOFMEMORY;
1105
1106 return copy_remote_record(in, *out);
1107}
MSIHANDLE WINAPI MsiCreateRecord(UINT cParams)
Definition: record.c:92
UINT copy_remote_record(const struct wire_record *in, MSIHANDLE out)
Definition: record.c:1052

Referenced by MsiDatabaseGetPrimaryKeysW(), MsiViewFetch(), MsiViewGetColumnInfo(), s_remote_FormatRecord(), s_remote_ProcessMessage(), s_remote_ViewExecute(), and s_remote_ViewModify().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msidb  )