Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Mayr
wine
Commits
74a6a1e7
Commit
74a6a1e7
authored
18 years ago
by
Michael McCormack
Committed by
Alexandre Julliard
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
msi: Delete databases we create but never commit.
parent
1c60e3bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dlls/msi/database.c
+20
-6
20 additions, 6 deletions
dlls/msi/database.c
dlls/msi/msipriv.h
+1
-0
1 addition, 0 deletions
dlls/msi/msipriv.h
dlls/msi/msiquery.c
+6
-0
6 additions, 0 deletions
dlls/msi/msiquery.c
dlls/msi/tests/db.c
+34
-7
34 additions, 7 deletions
dlls/msi/tests/db.c
with
61 additions
and
13 deletions
dlls/msi/database.c
+
20
−
6
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
);
...
...
This diff is collapsed.
Click to expand it.
dlls/msi/msipriv.h
+
1
−
0
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
;
...
...
This diff is collapsed.
Click to expand it.
dlls/msi/msiquery.c
+
6
−
0
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
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/msi/tests/db.c
+
34
−
7
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
"
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment