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
d8504e05
Commit
d8504e05
authored
Apr 19, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Handle MSIDBOPEN_PATCHFILE properly in MsiOpenDatabase.
parent
9a9faeff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
2 deletions
+54
-2
database.c
dlls/msi/database.c
+11
-2
patch.c
dlls/msi/tests/patch.c
+43
-0
No files found.
dlls/msi/database.c
View file @
d8504e05
...
...
@@ -262,7 +262,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
UINT
ret
=
ERROR_FUNCTION_FAILED
;
LPCWSTR
szMode
,
save_path
;
STATSTG
stat
;
BOOL
created
=
FALSE
;
BOOL
created
=
FALSE
,
patch
=
FALSE
;
WCHAR
path
[
MAX_PATH
];
static
const
WCHAR
szTables
[]
=
{
'_'
,
'T'
,
'a'
,
'b'
,
'l'
,
'e'
,
's'
,
0
};
...
...
@@ -277,6 +277,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
{
TRACE
(
"Database is a patch
\n
"
);
szPersist
-=
MSIDBOPEN_PATCHFILE
;
patch
=
TRUE
;
}
save_path
=
szDBPath
;
...
...
@@ -304,7 +305,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
STGM_CREATE
|
STGM_DIRECT
|
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stg
);
if
(
r
==
ERROR_SUCCESS
)
{
IStorage_SetClass
(
stg
,
&
CLSID_MsiDatabase
);
IStorage_SetClass
(
stg
,
patch
?
&
CLSID_MsiPatch
:
&
CLSID_MsiDatabase
);
/* create the _Tables stream */
r
=
write_stream_data
(
stg
,
szTables
,
NULL
,
0
,
TRUE
);
if
(
SUCCEEDED
(
r
))
...
...
@@ -352,6 +353,14 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
goto
end
;
}
if
(
patch
&&
!
IsEqualGUID
(
&
stat
.
clsid
,
&
CLSID_MsiPatch
)
)
{
ERR
(
"storage GUID is not the MSI patch GUID %s
\n
"
,
debugstr_guid
(
&
stat
.
clsid
)
);
ret
=
ERROR_OPEN_FAILED
;
goto
end
;
}
db
=
alloc_msiobject
(
MSIHANDLETYPE_DATABASE
,
sizeof
(
MSIDATABASE
),
MSI_CloseDatabase
);
if
(
!
db
)
...
...
dlls/msi/tests/patch.c
View file @
d8504e05
...
...
@@ -723,6 +723,48 @@ static void test_simple_patch( void )
RemoveDirectoryA
(
"msitest"
);
}
static
void
test_MsiOpenDatabase
(
void
)
{
UINT
r
;
MSIHANDLE
hdb
;
r
=
MsiOpenDatabase
(
mspfile
,
MSIDBOPEN_CREATE
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to open database %u
\n
"
,
r
);
r
=
MsiDatabaseCommit
(
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to commit database %u
\n
"
,
r
);
MsiCloseHandle
(
hdb
);
r
=
MsiOpenDatabase
(
mspfile
,
MSIDBOPEN_READONLY
+
MSIDBOPEN_PATCHFILE
,
&
hdb
);
ok
(
r
==
ERROR_OPEN_FAILED
,
"expected ERROR_OPEN_FAILED, got %u
\n
"
,
r
);
DeleteFileA
(
mspfile
);
r
=
MsiOpenDatabase
(
mspfile
,
MSIDBOPEN_CREATE
+
MSIDBOPEN_PATCHFILE
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to open database %u
\n
"
,
r
);
r
=
MsiDatabaseCommit
(
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to commit database %u
\n
"
,
r
);
MsiCloseHandle
(
hdb
);
r
=
MsiOpenDatabase
(
mspfile
,
MSIDBOPEN_READONLY
+
MSIDBOPEN_PATCHFILE
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to open database %u
\n
"
,
r
);
MsiCloseHandle
(
hdb
);
DeleteFileA
(
mspfile
);
create_database
(
msifile
,
tables
,
sizeof
(
tables
)
/
sizeof
(
struct
msi_table
)
);
create_patch
(
mspfile
);
r
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_READONLY
+
MSIDBOPEN_PATCHFILE
,
&
hdb
);
ok
(
r
==
ERROR_OPEN_FAILED
,
"failed to open database %u
\n
"
,
r
);
r
=
MsiOpenDatabase
(
mspfile
,
MSIDBOPEN_READONLY
+
MSIDBOPEN_PATCHFILE
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to open database %u
\n
"
,
r
);
MsiCloseHandle
(
hdb
);
DeleteFileA
(
msifile
);
DeleteFileA
(
mspfile
);
}
START_TEST
(
patch
)
{
DWORD
len
;
...
...
@@ -743,6 +785,7 @@ START_TEST(patch)
get_program_files_dir
(
PROG_FILES_DIR
,
COMMON_FILES_DIR
);
test_simple_patch
();
test_MsiOpenDatabase
();
SetCurrentDirectoryA
(
prev_path
);
}
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