Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
74a6a1e7
Commit
74a6a1e7
authored
Sep 13, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Sep 13, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Delete databases we create but never commit.
parent
1c60e3bf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
13 deletions
+61
-13
database.c
dlls/msi/database.c
+20
-6
msipriv.h
dlls/msi/msipriv.h
+1
-0
msiquery.c
dlls/msi/msiquery.c
+6
-0
db.c
dlls/msi/tests/db.c
+34
-7
No files found.
dlls/msi/database.c
View file @
74a6a1e7
...
...
@@ -64,6 +64,11 @@ static VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
r
=
IStorage_Release
(
db
->
storage
);
if
(
r
)
ERR
(
"database reference count was not zero (%ld)
\n
"
,
r
);
if
(
db
->
deletefile
)
{
DeleteFileW
(
db
->
deletefile
);
msi_free
(
db
->
deletefile
);
}
}
UINT
MSI_OpenDatabaseW
(
LPCWSTR
szDBPath
,
LPCWSTR
szPersist
,
MSIDATABASE
**
pdb
)
...
...
@@ -74,6 +79,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
UINT
ret
=
ERROR_FUNCTION_FAILED
;
LPCWSTR
szMode
;
STATSTG
stat
;
BOOL
created
=
FALSE
;
TRACE
(
"%s %s
\n
"
,
debugstr_w
(
szDBPath
),
debugstr_w
(
szPersist
)
);
...
...
@@ -83,12 +89,15 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
szMode
=
szPersist
;
if
(
HIWORD
(
szPersist
)
)
{
/* UINT len = lstrlenW( szPerist ) + 1; */
FIXME
(
"don't support persist files yet
\b
"
);
return
ERROR_INVALID_PARAMETER
;
/* szMode = msi_alloc( len * sizeof (DWORD) ); */
if
(
!
CopyFileW
(
szDBPath
,
szPersist
,
FALSE
))
return
ERROR_OPEN_FAILED
;
szDBPath
=
szPersist
;
szPersist
=
MSIDBOPEN_TRANSACT
;
created
=
TRUE
;
}
else
if
(
szPersist
==
MSIDBOPEN_READONLY
)
if
(
szPersist
==
MSIDBOPEN_READONLY
)
{
r
=
StgOpenStorage
(
szDBPath
,
NULL
,
STGM_DIRECT
|
STGM_READ
|
STGM_SHARE_DENY_WRITE
,
NULL
,
0
,
&
stg
);
...
...
@@ -97,13 +106,14 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
{
/* FIXME: MSIDBOPEN_CREATE should case STGM_TRANSACTED flag to be
* used here: */
r
=
StgCreateDocfile
(
szDBPath
,
r
=
StgCreateDocfile
(
szDBPath
,
STGM_DIRECT
|
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stg
);
if
(
r
==
ERROR_SUCCESS
)
{
IStorage_SetClass
(
stg
,
&
CLSID_MsiDatabase
);
r
=
init_string_table
(
stg
);
}
created
=
TRUE
;
}
else
if
(
szPersist
==
MSIDBOPEN_TRANSACT
)
{
...
...
@@ -157,6 +167,10 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
db
->
storage
=
stg
;
db
->
mode
=
szMode
;
if
(
created
)
db
->
deletefile
=
strdupW
(
szDBPath
);
else
db
->
deletefile
=
NULL
;
list_init
(
&
db
->
tables
);
list_init
(
&
db
->
transforms
);
...
...
dlls/msi/msipriv.h
View file @
74a6a1e7
...
...
@@ -71,6 +71,7 @@ typedef struct tagMSIDATABASE
MSIOBJECTHDR
hdr
;
IStorage
*
storage
;
string_table
*
strings
;
LPWSTR
deletefile
;
LPCWSTR
mode
;
struct
list
tables
;
struct
list
transforms
;
...
...
dlls/msi/msiquery.c
View file @
74a6a1e7
...
...
@@ -753,6 +753,12 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb )
msiobj_release
(
&
db
->
hdr
);
if
(
r
==
ERROR_SUCCESS
)
{
msi_free
(
db
->
deletefile
);
db
->
deletefile
=
NULL
;
}
return
r
;
}
...
...
dlls/msi/tests/db.c
View file @
74a6a1e7
...
...
@@ -40,6 +40,15 @@ static void test_msidatabase(void)
DeleteFile
(
msifile
);
res
=
MsiOpenDatabase
(
msifile
,
msifile2
,
&
hdb
);
ok
(
res
==
ERROR_OPEN_FAILED
,
"expected failure
\n
"
);
res
=
MsiOpenDatabase
(
msifile
,
(
LPSTR
)
0xff
,
&
hdb
);
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"expected failure
\n
"
);
res
=
MsiCloseHandle
(
hdb
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to close database
\n
"
);
/* create an empty database */
res
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_CREATE
,
&
hdb
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to create database
\n
"
);
...
...
@@ -51,18 +60,36 @@ static void test_msidatabase(void)
res
=
MsiCloseHandle
(
hdb
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to close database
\n
"
);
todo_wine
{
res
=
MsiOpenDatabase
(
msifile
,
msifile2
,
&
hdb2
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to
close
database
\n
"
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to
open
database
\n
"
);
ok
(
INVALID_FILE_ATTRIBUTES
!=
GetFileAttributes
(
msifile2
),
"database should exist
\n
"
);
res
=
MsiDatabaseCommit
(
hdb2
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to commit database
\n
"
);
}
res
=
MsiCloseHandle
(
hdb2
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to close database
\n
"
);
res
=
MsiOpenDatabase
(
msifile
,
msifile2
,
&
hdb2
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to open database
\n
"
);
res
=
MsiCloseHandle
(
hdb2
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to close database
\n
"
);
ok
(
INVALID_FILE_ATTRIBUTES
==
GetFileAttributes
(
msifile2
),
"uncommitted database should not exist
\n
"
);
res
=
MsiOpenDatabase
(
msifile
,
msifile2
,
&
hdb2
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to close database
\n
"
);
res
=
MsiDatabaseCommit
(
hdb2
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to commit database
\n
"
);
res
=
MsiCloseHandle
(
hdb2
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to close database
\n
"
);
ok
(
INVALID_FILE_ATTRIBUTES
!=
GetFileAttributes
(
msifile2
),
"committed database should exist
\n
"
);
res
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_READONLY
,
&
hdb
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to open database
\n
"
);
...
...
@@ -80,9 +107,9 @@ static void test_msidatabase(void)
res
=
MsiCloseHandle
(
hdb
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to close database
\n
"
);
todo_wine
{
ok
(
INVALID_FILE_ATTRIBUTES
!=
GetFileAttributes
(
msifile2
),
"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 */
res
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_CREATE
,
&
hdb
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to open database
\n
"
);
...
...
@@ -98,10 +125,10 @@ static void test_msidatabase(void)
res
=
MsiCloseHandle
(
hdb
);
ok
(
res
==
ERROR_SUCCESS
,
"Failed to close database
\n
"
);
}
res
=
DeleteFile
(
msifile2
);
ok
(
res
==
TRUE
,
"Failed to delete database
\n
"
);
}
res
=
DeleteFile
(
msifile
);
ok
(
res
==
TRUE
,
"Failed to delete database
\n
"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment