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
dd7514a3
Commit
dd7514a3
authored
Aug 27, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 27, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Move database initialization to a separate function.
parent
eef54ffe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
28 deletions
+51
-28
database.c
dlls/msi/database.c
+51
-28
No files found.
dlls/msi/database.c
View file @
dd7514a3
...
...
@@ -255,6 +255,43 @@ static VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
}
}
static
HRESULT
db_initialize
(
IStorage
*
stg
,
const
GUID
*
clsid
)
{
static
const
WCHAR
szTables
[]
=
{
'_'
,
'T'
,
'a'
,
'b'
,
'l'
,
'e'
,
's'
,
0
};
HRESULT
hr
;
hr
=
IStorage_SetClass
(
stg
,
clsid
);
if
(
FAILED
(
hr
))
{
WARN
(
"failed to set class id 0x%08x
\n
"
,
hr
);
return
hr
;
}
/* create the _Tables stream */
hr
=
write_stream_data
(
stg
,
szTables
,
NULL
,
0
,
TRUE
);
if
(
FAILED
(
hr
))
{
WARN
(
"failed to create _Tables stream 0x%08x
\n
"
,
hr
);
return
hr
;
}
hr
=
msi_init_string_table
(
stg
);
if
(
FAILED
(
hr
))
{
WARN
(
"failed to initialize string table 0x%08x
\n
"
,
hr
);
return
hr
;
}
hr
=
IStorage_Commit
(
stg
,
0
);
if
(
FAILED
(
hr
))
{
WARN
(
"failed to commit changes 0x%08x
\n
"
,
hr
);
return
hr
;
}
return
S_OK
;
}
UINT
MSI_OpenDatabaseW
(
LPCWSTR
szDBPath
,
LPCWSTR
szPersist
,
MSIDATABASE
**
pdb
)
{
IStorage
*
stg
=
NULL
;
...
...
@@ -266,8 +303,6 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
BOOL
created
=
FALSE
,
patch
=
FALSE
;
WCHAR
path
[
MAX_PATH
];
static
const
WCHAR
szTables
[]
=
{
'_'
,
'T'
,
'a'
,
'b'
,
'l'
,
'e'
,
's'
,
0
};
TRACE
(
"%s %s
\n
"
,
debugstr_w
(
szDBPath
),
debugstr_w
(
szPersist
)
);
if
(
!
pdb
)
...
...
@@ -298,34 +333,22 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
r
=
StgOpenStorage
(
szDBPath
,
NULL
,
STGM_DIRECT
|
STGM_READ
|
STGM_SHARE_DENY_WRITE
,
NULL
,
0
,
&
stg
);
}
else
if
(
szPersist
==
MSIDBOPEN_CREATE
||
szPersist
==
MSIDBOPEN_CREATEDIRECT
)
else
if
(
szPersist
==
MSIDBOPEN_CREATE
)
{
if
(
szPersist
==
MSIDBOPEN_CREATE
)
{
r
=
StgCreateDocfile
(
szDBPath
,
STGM_CREATE
|
STGM_TRANSACTED
|
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stg
);
}
else
{
r
=
StgCreateDocfile
(
szDBPath
,
STGM_CREATE
|
STGM_DIRECT
|
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stg
);
}
r
=
StgCreateDocfile
(
szDBPath
,
STGM_CREATE
|
STGM_TRANSACTED
|
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stg
);
if
(
SUCCEEDED
(
r
)
)
{
IStorage_SetClass
(
stg
,
patch
?
&
CLSID_MsiPatch
:
&
CLSID_MsiDatabase
);
/* create the _Tables stream */
r
=
write_stream_data
(
stg
,
szTables
,
NULL
,
0
,
TRUE
);
if
(
SUCCEEDED
(
r
))
{
r
=
msi_init_string_table
(
stg
);
if
(
SUCCEEDED
(
r
))
{
r
=
IStorage_Commit
(
stg
,
0
);
if
(
FAILED
(
r
))
WARN
(
"failed to commit changes 0x%08x
\n
"
,
r
);
}
}
}
r
=
db_initialize
(
stg
,
patch
?
&
CLSID_MsiPatch
:
&
CLSID_MsiDatabase
);
created
=
TRUE
;
}
else
if
(
szPersist
==
MSIDBOPEN_CREATEDIRECT
)
{
r
=
StgCreateDocfile
(
szDBPath
,
STGM_CREATE
|
STGM_DIRECT
|
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stg
);
if
(
SUCCEEDED
(
r
)
)
r
=
db_initialize
(
stg
,
patch
?
&
CLSID_MsiPatch
:
&
CLSID_MsiDatabase
);
created
=
TRUE
;
}
else
if
(
szPersist
==
MSIDBOPEN_TRANSACT
)
...
...
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