Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
36746279
Commit
36746279
authored
Oct 28, 2003
by
Mike McCormack
Committed by
Alexandre Julliard
Oct 28, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Treat missing MSI tables as empty.
parent
f0831227
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
37 deletions
+40
-37
table.c
dlls/msi/table.c
+40
-37
No files found.
dlls/msi/table.c
View file @
36746279
...
@@ -152,26 +152,22 @@ static BOOL decode_streamname(LPWSTR in, LPWSTR out)
...
@@ -152,26 +152,22 @@ static BOOL decode_streamname(LPWSTR in, LPWSTR out)
}
}
#endif
#endif
UINT
read_table_from_storage
(
IStorage
*
stg
,
LPCWSTR
name
,
MSITABLE
**
ptable
)
static
BOOL
read_stream_data
(
IStorage
*
stg
,
LPWSTR
stname
,
USHORT
**
pdata
,
UINT
*
psz
)
{
{
WCHAR
buffer
[
0x20
];
HRESULT
r
;
HRESULT
r
;
IStream
*
stm
=
NULL
;
STATSTG
stat
;
UINT
ret
=
ERROR_FUNCTION_FAILED
;
UINT
ret
=
ERROR_FUNCTION_FAILED
;
VOID
*
data
;
VOID
*
data
;
ULONG
sz
,
count
;
ULONG
sz
,
count
;
MSITABLE
*
t
;
IStream
*
stm
=
NULL
;
STATSTG
stat
;
encode_streamname
(
TRUE
,
name
,
buffer
);
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
name
),
debugstr_w
(
buffer
));
r
=
IStorage_OpenStream
(
stg
,
buffer
,
NULL
,
STGM_READ
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stm
);
r
=
IStorage_OpenStream
(
stg
,
stname
,
NULL
,
STGM_READ
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stm
);
if
(
FAILED
(
r
)
)
if
(
FAILED
(
r
)
)
{
{
ERR
(
"open stream failed r = %08lx!
\n
"
,
r
);
WARN
(
"open stream failed r = %08lx - empty table?
\n
"
,
r
);
return
r
;
return
r
et
;
}
}
r
=
IStream_Stat
(
stm
,
&
stat
,
STATFLAG_NONAME
);
r
=
IStream_Stat
(
stm
,
&
stat
,
STATFLAG_NONAME
);
...
@@ -192,47 +188,54 @@ UINT read_table_from_storage(IStorage *stg, LPCWSTR name, MSITABLE **ptable)
...
@@ -192,47 +188,54 @@ UINT read_table_from_storage(IStorage *stg, LPCWSTR name, MSITABLE **ptable)
if
(
!
data
)
if
(
!
data
)
{
{
ERR
(
"couldn't allocate memory r=%08lx!
\n
"
,
r
);
ERR
(
"couldn't allocate memory r=%08lx!
\n
"
,
r
);
ret
=
ERROR_NOT_ENOUGH_MEMORY
;
goto
end
;
goto
end
;
}
}
r
=
IStream_Read
(
stm
,
data
,
sz
,
&
count
);
r
=
IStream_Read
(
stm
,
data
,
sz
,
&
count
);
if
(
FAILED
(
r
)
)
if
(
FAILED
(
r
)
||
(
count
!=
sz
)
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
ERR
(
"read stream failed r = %08lx!
\n
"
,
r
);
ERR
(
"read stream failed r = %08lx!
\n
"
,
r
);
goto
end
;
goto
end
;
}
}
t
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MSITABLE
)
+
lstrlenW
(
name
)
*
sizeof
(
WCHAR
)
);
*
pdata
=
data
;
if
(
!
t
)
*
psz
=
sz
;
{
ret
=
ERROR_SUCCESS
;
HeapFree
(
GetProcessHeap
(),
0
,
data
);
ERR
(
"malloc failed!
\n
"
);
goto
end
;
}
if
(
count
==
sz
)
{
ret
=
ERROR_SUCCESS
;
t
->
size
=
sz
;
t
->
data
=
data
;
lstrcpyW
(
t
->
name
,
name
);
t
->
ref_count
=
1
;
*
ptable
=
t
;
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
ERR
(
"Count != sz
\n
"
);
}
end:
end:
if
(
stm
)
IStream_Release
(
stm
);
IStream_Release
(
stm
);
return
ret
;
return
ret
;
}
}
UINT
read_table_from_storage
(
IStorage
*
stg
,
LPCWSTR
name
,
MSITABLE
**
ptable
)
{
WCHAR
buffer
[
0x20
];
MSITABLE
*
t
;
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
name
),
debugstr_w
(
buffer
));
/* non-existing tables should be interpretted as empty tables */
t
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MSITABLE
)
+
lstrlenW
(
name
)
*
sizeof
(
WCHAR
)
);
if
(
!
t
)
return
ERROR_NOT_ENOUGH_MEMORY
;
t
->
size
=
0
;
t
->
data
=
NULL
;
lstrcpyW
(
t
->
name
,
name
);
t
->
ref_count
=
1
;
*
ptable
=
t
;
/* if we can't read the table, just assume that it's empty */
encode_streamname
(
TRUE
,
name
,
buffer
);
read_stream_data
(
stg
,
buffer
,
&
t
->
data
,
&
t
->
size
);
return
ERROR_SUCCESS
;
}
/* add this table to the list of cached tables in the database */
/* add this table to the list of cached tables in the database */
void
add_table
(
MSIDATABASE
*
db
,
MSITABLE
*
table
)
void
add_table
(
MSIDATABASE
*
db
,
MSITABLE
*
table
)
{
{
...
...
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