diff --git a/dlls/msi/database.c b/dlls/msi/database.c index 01c32497a37..986dcbb0b4d 100644 --- a/dlls/msi/database.c +++ b/dlls/msi/database.c @@ -300,26 +300,38 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb) } else if( szPersist == MSIDBOPEN_CREATE || szPersist == MSIDBOPEN_CREATEDIRECT ) { - /* FIXME: MSIDBOPEN_CREATE should case STGM_TRANSACTED flag to be - * used here: */ - r = StgCreateDocfile( szDBPath, - STGM_CREATE|STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg); - if( r == ERROR_SUCCESS ) + if ( szPersist == MSIDBOPEN_CREATE ) + { + r = StgCreateDocfile( szDBPath, + STGM_CREATE|STGM_TRANSACTED|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg); + } + else + { + r = StgCreateDocfile( szDBPath, + STGM_CREATE|STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg); + } + if( SUCCEEDED(r) ) { IStorage_SetClass( stg, patch ? &CLSID_MsiPatch : &CLSID_MsiDatabase ); /* create the _Tables stream */ r = write_stream_data(stg, szTables, NULL, 0, TRUE); if (SUCCEEDED(r)) + { r = msi_init_string_table( stg ); + if (SUCCEEDED(r)) + { + r = IStorage_Commit( stg, 0 ); + if (FAILED(r)) + WARN("failed to commit changes 0x%08x\n", r); + } + } } created = TRUE; } else if( szPersist == MSIDBOPEN_TRANSACT ) { - /* FIXME: MSIDBOPEN_TRANSACT should case STGM_TRANSACTED flag to be - * used here: */ r = StgOpenStorage( szDBPath, NULL, - STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg); + STGM_TRANSACTED|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg); } else if( szPersist == MSIDBOPEN_DIRECT ) { diff --git a/dlls/msi/table.c b/dlls/msi/table.c index 72d1f2103a5..67554968b14 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -2319,6 +2319,7 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) UINT MSI_CommitTables( MSIDATABASE *db ) { UINT r; + HRESULT hr; MSITABLE *table = NULL; TRACE("%p\n",db); @@ -2344,7 +2345,13 @@ UINT MSI_CommitTables( MSIDATABASE *db ) /* force everything to reload next time */ free_cached_tables( db ); - return ERROR_SUCCESS; + hr = IStorage_Commit( db->storage, 0 ); + if (FAILED( hr )) + { + WARN("failed to commit changes 0x%08x\n", hr); + r = ERROR_FUNCTION_FAILED; + } + return r; } MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table )