Commit eef54ffe authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Open the database storage in transacted mode when MSIDBOPEN_CREATE or…

msi: Open the database storage in transacted mode when MSIDBOPEN_CREATE or MSIDBOPEN_TRANSACT is specified.
parent d411c49d
......@@ -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 )
{
......
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment