From b4005c15f0ea05d6e26208a6690f988c90839605 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Wed, 13 Sep 2006 15:55:57 +0900 Subject: [PATCH] msi: Fix database creation. --- dlls/msi/database.c | 2 +- dlls/msi/tests/db.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/msi/database.c b/dlls/msi/database.c index 1c0a586f461..d98461355a4 100644 --- a/dlls/msi/database.c +++ b/dlls/msi/database.c @@ -107,7 +107,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb) /* FIXME: MSIDBOPEN_CREATE should case STGM_TRANSACTED flag to be * used here: */ 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 ) { IStorage_SetClass( stg, &CLSID_MsiDatabase ); diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 44a2532d922..26b6fa031b3 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -109,23 +109,28 @@ static void test_msidatabase(void) ok( res == ERROR_SUCCESS , "Failed to close database\n" ); ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n"); - todo_wine { /* MSIDBOPEN_CREATE deletes the database if MsiCommitDatabase isn't called */ res = MsiOpenDatabase( msifile, MSIDBOPEN_CREATE, &hdb ); ok( res == ERROR_SUCCESS , "Failed to open database\n" ); + ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n"); + res = MsiCloseHandle( hdb ); 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 ); ok( res == ERROR_SUCCESS , "Failed to open database\n" ); res = MsiDatabaseCommit( hdb ); ok( res == ERROR_SUCCESS , "Failed to commit database\n" ); + ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n"); + res = MsiCloseHandle( hdb ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - } + res = DeleteFile( msifile2 ); ok( res == TRUE, "Failed to delete database\n" );