msi: Fix database creation.

This commit is contained in:
Mike McCormack 2006-09-13 15:55:57 +09:00 committed by Alexandre Julliard
parent 4fa08a638c
commit b4005c15f0
2 changed files with 8 additions and 3 deletions

View File

@ -107,7 +107,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
/* FIXME: MSIDBOPEN_CREATE should case STGM_TRANSACTED flag to be /* FIXME: MSIDBOPEN_CREATE should case STGM_TRANSACTED flag to be
* used here: */ * used here: */
r = StgCreateDocfile( szDBPath, r = StgCreateDocfile( szDBPath,
STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg); STGM_CREATE|STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg);
if( r == ERROR_SUCCESS ) if( r == ERROR_SUCCESS )
{ {
IStorage_SetClass( stg, &CLSID_MsiDatabase ); IStorage_SetClass( stg, &CLSID_MsiDatabase );

View File

@ -109,23 +109,28 @@ static void test_msidatabase(void)
ok( res == ERROR_SUCCESS , "Failed to close database\n" ); ok( res == ERROR_SUCCESS , "Failed to close database\n" );
ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n"); ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n");
todo_wine {
/* MSIDBOPEN_CREATE deletes the database if MsiCommitDatabase isn't called */ /* MSIDBOPEN_CREATE deletes the database if MsiCommitDatabase isn't called */
res = MsiOpenDatabase( msifile, MSIDBOPEN_CREATE, &hdb ); res = MsiOpenDatabase( msifile, MSIDBOPEN_CREATE, &hdb );
ok( res == ERROR_SUCCESS , "Failed to open database\n" ); ok( res == ERROR_SUCCESS , "Failed to open database\n" );
ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n");
res = MsiCloseHandle( hdb ); res = MsiCloseHandle( hdb );
ok( res == ERROR_SUCCESS , "Failed to close database\n" ); ok( res == ERROR_SUCCESS , "Failed to close database\n" );
ok( INVALID_FILE_ATTRIBUTES == GetFileAttributes( msifile ), "database should exist\n");
res = MsiOpenDatabase( msifile, MSIDBOPEN_CREATE, &hdb ); res = MsiOpenDatabase( msifile, MSIDBOPEN_CREATE, &hdb );
ok( res == ERROR_SUCCESS , "Failed to open database\n" ); ok( res == ERROR_SUCCESS , "Failed to open database\n" );
res = MsiDatabaseCommit( hdb ); res = MsiDatabaseCommit( hdb );
ok( res == ERROR_SUCCESS , "Failed to commit database\n" ); ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n");
res = MsiCloseHandle( hdb ); res = MsiCloseHandle( hdb );
ok( res == ERROR_SUCCESS , "Failed to close database\n" ); ok( res == ERROR_SUCCESS , "Failed to close database\n" );
}
res = DeleteFile( msifile2 ); res = DeleteFile( msifile2 );
ok( res == TRUE, "Failed to delete database\n" ); ok( res == TRUE, "Failed to delete database\n" );