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
046d7c6d
Commit
046d7c6d
authored
Apr 07, 2014
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Try to open 1Ole stream before trying to create it in SetConvertStg function.
parent
f83d24d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
29 deletions
+30
-29
storage32.c
dlls/ole32/storage32.c
+30
-29
No files found.
dlls/ole32/storage32.c
View file @
046d7c6d
...
...
@@ -9510,51 +9510,52 @@ HRESULT WINAPI GetConvertStg(IStorage *stg)
*/
HRESULT
WINAPI
SetConvertStg
(
IStorage
*
storage
,
BOOL
convert
)
{
static
const
WCHAR
stream_1oleW
[]
=
{
1
,
'O'
,
'l'
,
'e'
,
0
};
DWORD
flags
=
convert
?
OleStream_Convert
:
0
;
IStream
*
stream
;
DWORD
header
[
2
];
HRESULT
hr
;
TRACE
(
"(%p, %d)
\n
"
,
storage
,
convert
);
hr
=
STORAGE_CreateOleStream
(
storage
,
flags
);
if
(
hr
==
STG_E_FILEALREADYEXISTS
)
hr
=
IStorage_OpenStream
(
storage
,
stream_1oleW
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stream
);
if
(
FAILED
(
hr
)
)
{
static
const
WCHAR
stream_1oleW
[]
=
{
1
,
'O'
,
'l'
,
'e'
,
0
};
IStream
*
stream
;
DWORD
header
[
2
];
if
(
hr
!=
STG_E_FILENOTFOUND
)
return
hr
;
return
STORAGE_CreateOleStream
(
storage
,
flags
);
}
hr
=
IStorage_OpenStream
(
storage
,
stream_1oleW
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stream
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IStream_Read
(
stream
,
header
,
sizeof
(
header
),
NULL
);
if
(
FAILED
(
hr
))
{
IStream_Release
(
stream
);
return
hr
;
}
hr
=
IStream_Read
(
stream
,
header
,
sizeof
(
header
),
NULL
);
/* update flag if differs */
if
((
header
[
1
]
^
flags
)
&
OleStream_Convert
)
{
LARGE_INTEGER
pos
=
{{
0
}};
if
(
header
[
1
]
&
OleStream_Convert
)
flags
=
header
[
1
]
&
~
OleStream_Convert
;
else
flags
=
header
[
1
]
|
OleStream_Convert
;
pos
.
QuadPart
=
sizeof
(
DWORD
);
hr
=
IStream_Seek
(
stream
,
pos
,
STREAM_SEEK_SET
,
NULL
);
if
(
FAILED
(
hr
))
{
IStream_Release
(
stream
);
return
hr
;
}
/* update flag if differs */
if
((
header
[
1
]
^
flags
)
&
OleStream_Convert
)
{
LARGE_INTEGER
pos
;
if
(
header
[
1
]
&
OleStream_Convert
)
flags
=
header
[
1
]
&
~
OleStream_Convert
;
else
flags
=
header
[
1
]
|
OleStream_Convert
;
pos
.
QuadPart
=
sizeof
(
DWORD
);
hr
=
IStream_Seek
(
stream
,
pos
,
STREAM_SEEK_SET
,
NULL
);
if
(
FAILED
(
hr
))
{
IStream_Release
(
stream
);
return
hr
;
}
hr
=
IStream_Write
(
stream
,
&
flags
,
sizeof
(
flags
),
NULL
);
}
IStream_Release
(
stream
);
hr
=
IStream_Write
(
stream
,
&
flags
,
sizeof
(
flags
),
NULL
);
}
IStream_Release
(
stream
);
return
hr
;
}
...
...
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