53#define IS_INTMSIDBOPEN(x) (((ULONG_PTR)(x) >> 16) == 0)
61 IStorage_Release(
t->stg );
82 IStorage_AddRef( stg );
95 IStorage_Release( db->
storage );
108 hr = IStorage_SetClass( stg,
clsid );
111 WARN(
"failed to set class id %#lx\n",
hr);
119 WARN(
"failed to create _Tables stream %#lx\n",
hr);
126 WARN(
"failed to initialize string table %#lx\n",
hr);
130 hr = IStorage_Commit( stg, 0 );
133 WARN(
"failed to commit changes %#lx\n",
hr);
167 szDBPath = szPersist;
174 TRACE(
"Database is a patch\n");
175 mode &= ~MSI_OPEN_PATCHFILE;
190 r =
db_initialize( stg, patch ? &CLSID_MsiPatch : &CLSID_MsiDatabase );
199 r =
db_initialize( stg, patch ? &CLSID_MsiPatch : &CLSID_MsiDatabase );
224 r = IStorage_Stat( stg, &
stat, STATFLAG_NONAME );
227 FIXME(
"Failed to stat storage\n");
235 ERR(
"storage GUID is not a MSI database GUID %s\n",
242 ERR(
"storage GUID is not the MSI patch GUID %s\n",
252 FIXME(
"Failed to allocate a handle\n");
286 IStorage_AddRef( stg );
293 IStorage_Release( stg );
388 while (chars_left && *
ptr !=
'\n')
402 if (*num_entries && *num_entries !=
count)
413 while (chars_left && *
ptr ==
'\r')
420 while (chars_left && *
ptr !=
'\t' && *
ptr !=
'\n' && *
ptr !=
'\r')
433 if (*
ptr ==
'\n' || *
ptr ==
'\r')
435 while (chars_left && (*
ptr ==
'\n' || *
ptr ==
'\r'))
446 (*entries)[
i] = save;
453 *num_entries =
count;
484 for (
i = 0;
i < num_columns;
i++)
489 if (
i == num_columns - 1)
525 WARN(
"invalid int width %lu\n",
len);
564 for (
i = 0,
size = 1;
i < num_keys;
i++)
571 for (
i = 0,
ptr = keys;
i < num_keys;
i++)
598 LPWSTR prelude, columns_sql, postlude;
604 if (!prelude || !columns_sql || !postlude)
665 for (
i = 0;
i < num_columns;
i++)
669 case 'L':
case 'l':
case 'S':
case 's':
691 ERR(
"Unhandled column type: %c\n",
types[
i][0]);
701 int num_columns,
int num_records,
WCHAR *
path)
720 for (
i = 0;
i < num_records;
i++)
744 DWORD len,
i, num_labels = 0, num_types = 0, num_columns = 0, num_records = 0;
773 if (num_columns == 1 && !columns[0][0] && num_labels == 1 && !labels[0][0] &&
774 num_types == 2 && !
wcscmp(
types[1],
L"_ForceCodepage" ))
780 if (num_columns != num_types)
801 temp_records =
realloc(records, (num_records + 1) *
sizeof(
WCHAR **));
807 records = temp_records;
810 if (!
wcscmp(labels[0],
L"_SummaryInformation"))
841 for (
i = 0;
i < num_records;
i++)
934 if (*
ptr ==
'\r' && *(
ptr + 1 ) ==
'\n')
955 DWORD sz, read_size, write_size;
984 read_size =
sizeof(
buffer);
985 while (read_size ==
sizeof(
buffer))
1035 sep = (
i <
count) ?
"\t" :
"\r\n";
1049 static const char fmt[] =
"\r\n\r\n%u\t_ForceCodepage\r\n";
1061 static const char header[] =
"PropertyId\tValue\r\n"
1063 "_SummaryInformation\tPropertyId\r\n";
1227 TRACE(
"%lu, %lu, %s\n", hDatabase, hDatabaseMerge,
debugstr_a(szTableName) );
1267 if (((type1[0] ==
'l') || (type1[0] ==
's')) &&
1268 ((type2[0] ==
'l') || (type2[0] ==
's')))
1271 if (((type1[0] ==
'L') || (type1[0] ==
'S')) &&
1272 ((type2[0] ==
'L') || (type2[0] ==
'S')))
1275 return !
wcscmp( type1, type2 );
1309 dbrec = mergerec =
NULL;
1430 ERR(
"failed to get string!\n");
1459 setptr =
L"`%s` = %s ";
1461 setptr =
L"`%s` = %s AND ";
1471 clause = new_clause;
1517 table->numconflicts++;
1526 mergerow =
malloc(
sizeof(*mergerow));
1534 if (!mergerow->
data)
1560 *numlabels =
count + 1;
1601 *numcolumns =
count;
1656 for (
i = 0;
i <
table->numlabels;
i++)
1664 for (
i = 0;
i <
table->numcolumns;
i++)
1672 for (
i = 0;
i <
table->numtypes;
i++)
1716 table->numconflicts = 0;
1764 data->curview = mergeview;
1781 struct list *tabledata)
1836 r =
MSI_OpenQuery(db, &
view,
L"CREATE TABLE `%s` (`Table` CHAR(255) NOT NULL, `NumRowMergeConflicts` SHORT "
1837 "NOT NULL PRIMARY KEY `Table`)" ,
error);
1848 table, numconflicts);
1866 TRACE(
"%lu, %lu, %s\n", hDatabase, hDatabaseMerge,
debugstr_w(szTableName) );
1868 if (szTableName && !*szTableName)
1886 if (
table->numconflicts)
1891 table->numconflicts);
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
ACPI_SIZE strlen(const char *String)
static struct @1561 save_path[MOVE_LIST_SIZE]
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static int list_empty(struct list_entry *head)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_add_head(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
static const CHAR suminfo[]
#define ERROR_NOT_ENOUGH_MEMORY
static WCHAR * strdupAtoW(const char *str)
#define ERROR_INVALID_PARAMETER
#define GetCurrentDirectoryW(x, y)
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define ERROR_NO_MORE_ITEMS
#define ERROR_INVALID_HANDLE
#define FILE_ATTRIBUTE_NORMAL
#define MultiByteToWideChar
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
static UINT get_query_types(MSIQUERY *query, WCHAR ***types, DWORD *numtypes)
UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, const WCHAR *szFolder, const WCHAR *szFilename)
static UINT gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge, struct list *tabledata)
static WCHAR * build_createsql_columns(WCHAR **columns_data, WCHAR **types, DWORD num_columns)
UINT __cdecl s_remote_DatabaseOpenView(MSIHANDLE db, LPCWSTR query, MSIHANDLE *view)
static UINT merge_verify_primary_keys(MSIDATABASE *db, MSIDATABASE *mergedb, LPCWSTR table)
MSIDBSTATE WINAPI MsiGetDatabaseState(MSIHANDLE handle)
static UINT export_row(MSIRECORD *row, void *arg)
static WCHAR * build_createsql_prelude(const WCHAR *table)
UINT WINAPI MsiDatabaseImportA(MSIHANDLE handle, const char *szFolder, const char *szFilename)
static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, LPWSTR table, MSIRECORD *rec)
static void merge_free_rows(struct merge_table *table)
static UINT MSI_DatabaseExport(MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, LPCWSTR file)
UINT __cdecl s_remote_DatabaseGetSummaryInformation(MSIHANDLE db, UINT updatecount, MSIHANDLE *suminfo)
static UINT update_merge_errors(MSIDATABASE *db, LPCWSTR error, LPWSTR table, DWORD numconflicts)
static UINT merge_diff_tables(MSIRECORD *rec, LPVOID param)
UINT WINAPI MsiDatabaseExportW(MSIHANDLE handle, const WCHAR *szTable, const WCHAR *szFolder, const WCHAR *szFilename)
UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
static VOID MSI_CloseDatabase(MSIOBJECTHDR *arg)
static UINT parse_line(WCHAR **line, WCHAR ***entries, DWORD *num_entries, DWORD *len)
static UINT export_stream(const WCHAR *folder, const WCHAR *table, MSIRECORD *row, UINT field, UINT start)
static UINT add_records_to_table(MSIDATABASE *db, WCHAR **columns, WCHAR **types, WCHAR **labels, WCHAR ***records, int num_columns, int num_records, WCHAR *path)
static UINT export_summaryinformation(MSIDATABASE *db, HANDLE handle)
static UINT get_query_columns(MSIQUERY *query, WCHAR ***columns, DWORD *numcolumns)
static void free_merge_table(struct merge_table *table)
static UINT merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview)
#define IS_INTMSIDBOPEN(x)
static WCHAR * import_stream_filename(const WCHAR *path, const WCHAR *name)
static UINT export_record(struct row_export_info *row_export_info, MSIRECORD *row, UINT start)
static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file)
static UINT export_forcecodepage(HANDLE handle, UINT codepage)
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
static LPWSTR get_key_value(MSIQUERY *view, LPCWSTR key, MSIRECORD *rec)
MSICONDITION __cdecl s_remote_DatabaseIsTablePersistent(MSIHANDLE db, LPCWSTR table)
static UINT get_merge_table(MSIDATABASE *db, const WCHAR *name, struct merge_table **ptable)
UINT WINAPI MsiDatabaseMergeA(MSIHANDLE hDatabase, MSIHANDLE hDatabaseMerge, const char *szTableName)
static UINT merge_diff_row(MSIRECORD *rec, LPVOID param)
static UINT export_field(HANDLE handle, MSIRECORD *row, UINT field)
void append_storage_to_db(MSIDATABASE *db, IStorage *stg)
static WCHAR * build_createsql_postlude(WCHAR **primary_keys, DWORD num_keys)
static void free_streams(MSIDATABASE *db)
UINT WINAPI MsiDatabaseExportA(MSIHANDLE handle, const char *szTable, const char *szFolder, const char *szFilename)
static UINT get_table_labels(MSIDATABASE *db, const WCHAR *table, WCHAR ***labels, DWORD *numlabels)
static BOOL merge_type_match(LPCWSTR type1, LPCWSTR type2)
static UINT add_table_to_db(MSIDATABASE *db, WCHAR **columns, WCHAR **types, WCHAR **labels, DWORD num_labels, DWORD num_columns)
UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
static UINT construct_record(DWORD num_columns, LPWSTR *types, LPWSTR *data, LPWSTR path, MSIRECORD **rec)
static WCHAR * read_text_archive(const WCHAR *path, DWORD *len)
UINT __cdecl s_remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, struct wire_record **rec)
static void free_transforms(MSIDATABASE *db)
static HRESULT db_initialize(IStorage *stg, const GUID *clsid)
UINT WINAPI MsiDatabaseMergeW(MSIHANDLE hDatabase, MSIHANDLE hDatabaseMerge, const WCHAR *szTableName)
void * alloc_msiobject(UINT type, UINT size, msihandledestructor destroy)
MSIHANDLE alloc_msihandle(MSIOBJECTHDR *obj)
void msiobj_addref(MSIOBJECTHDR *info)
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
int msiobj_release(MSIOBJECTHDR *info)
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
UINT WINAPI MsiGetSummaryInformationW(MSIHANDLE hDatabase, const WCHAR *szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
HRESULT WINAPI StgOpenStorage(const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
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
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
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
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
#define ERROR_ALREADY_EXISTS
#define sprintf(buf, format,...)
#define cmp(status, error)
BOOL MSI_RecordsAreEqual(MSIRECORD *, MSIRECORD *)
UINT MSI_ViewExecute(MSIQUERY *, MSIRECORD *)
#define MSI_INITIAL_MEDIA_TRANSFORM_DISKID
UINT MSI_RecordSetStreamFromFileW(MSIRECORD *, UINT, LPCWSTR)
UINT MSI_RecordGetStringA(MSIRECORD *, UINT, LPSTR, LPDWORD)
#define MSIHANDLETYPE_DATABASE
UINT msi_get_string_table_codepage(const string_table *st)
#define MSI_OPEN_CREATEDIRECT
BOOL TABLE_Exists(MSIDATABASE *db, LPCWSTR name)
UINT msi_add_suminfo(MSIDATABASE *db, LPWSTR **records, int num_records, int num_columns)
UINT MSI_RecordSetInteger(MSIRECORD *, UINT, int)
#define MSI_OPEN_TRANSACT
WCHAR * msi_dup_record_field(MSIRECORD *row, INT index)
UINT MSI_ViewClose(MSIQUERY *)
UINT MSI_DatabaseGetPrimaryKeys(MSIDATABASE *, LPCWSTR, MSIRECORD **)
UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY **)
UINT MSI_RecordReadStream(MSIRECORD *, UINT, char *, LPDWORD)
#define MAX_STREAM_NAME_LEN
HRESULT msi_init_string_table(IStorage *stg)
string_table * msi_load_string_table(IStorage *stg, UINT *bytes_per_strref)
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT)
UINT WINAPIV MSI_OpenQuery(MSIDATABASE *, MSIQUERY **, LPCWSTR,...)
UINT MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **)
#define MSI_OPEN_READONLY
UINT msi_export_suminfo(MSIDATABASE *db, HANDLE handle)
void enum_stream_names(IStorage *stg)
VOID msi_destroy_stringtable(string_table *st)
UINT msi_set_string_table_codepage(string_table *st, UINT codepage)
UINT MSI_ViewFetch(MSIQUERY *, MSIRECORD **)
#define MSI_INITIAL_MEDIA_TRANSFORM_OFFSET
void free_cached_tables(MSIDATABASE *db)
UINT MSI_RecordSetStringW(MSIRECORD *, UINT, LPCWSTR)
MSIRECORD * MSI_CreateRecord(UINT)
struct wire_record * marshal_record(MSIHANDLE handle)
UINT MSI_ViewModify(MSIQUERY *, MSIMODIFY, MSIRECORD *)
UINT MSI_IterateRecords(MSIQUERY *, LPDWORD, record_func, LPVOID)
#define MSI_OPEN_PATCHFILE
UINT MSI_RecordGetFieldCount(const MSIRECORD *rec)
UINT MSI_RecordGetStringW(MSIRECORD *, UINT, LPWSTR, LPDWORD)
MSIRECORD * MSI_CloneRecord(MSIRECORD *)
UINT write_stream_data(IStorage *stg, LPCWSTR stname, LPCVOID data, UINT sz, BOOL bTable)
UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb, LPCWSTR szQuery, MSIHANDLE *phView)
UINT WINAPI MsiDatabaseGetPrimaryKeysW(MSIHANDLE hdb, const WCHAR *table, MSIHANDLE *phRec)
MSICONDITION WINAPI MsiDatabaseIsTablePersistentW(MSIHANDLE hDatabase, const WCHAR *szTableName)
enum tagMSIDBSTATE MSIDBSTATE
#define STGM_SHARE_EXCLUSIVE
#define STGM_SHARE_DENY_WRITE
#define IsEqualGUID(rguid1, rguid2)
UINT TABLE_CreateView(MSIDATABASE *db, LPCWSTR name, MSIVIEW **view)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP wchar_t *__cdecl wcsdup(_In_z_ const wchar_t *_Str)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
struct merge_table * curtable
const struct column * columns
UINT media_transform_disk_id
UINT media_transform_offset
UINT(* insert_row)(struct tagMSIVIEW *view, MSIRECORD *record, UINT row, BOOL temporary)
UINT(* delete)(struct tagMSIVIEW *)
DWORD WINAPI GetLastError(void)
#define ERROR_WRITE_FAULT
#define ERROR_OPEN_FAILED
#define ERROR_INVALID_TABLE
#define ERROR_FUNCTION_FAILED
#define ERROR_DATATYPE_MISMATCH