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
b74b5991
Commit
b74b5991
authored
Mar 26, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Keep file handle open for file stream.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b2d3567c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
28 deletions
+21
-28
main.c
dlls/mfplat/main.c
+5
-3
mfplat.c
dlls/mfplat/tests/mfplat.c
+16
-25
No files found.
dlls/mfplat/main.c
View file @
b74b5991
...
...
@@ -1971,6 +1971,7 @@ typedef struct bytestream
IMFAsyncCallback
read_callback
;
IMFAsyncCallback
write_callback
;
IStream
*
stream
;
HANDLE
hfile
;
QWORD
position
;
DWORD
capabilities
;
struct
list
pending
;
...
...
@@ -2235,6 +2236,8 @@ static ULONG WINAPI bytestream_Release(IMFByteStream *iface)
DeleteCriticalSection
(
&
stream
->
cs
);
if
(
stream
->
stream
)
IStream_Release
(
stream
->
stream
);
if
(
stream
->
hfile
)
CloseHandle
(
stream
->
hfile
);
heap_free
(
stream
);
}
...
...
@@ -2820,7 +2823,7 @@ static const IMFGetServiceVtbl bytestream_file_getservice_vtbl =
HRESULT
WINAPI
MFCreateFile
(
MF_FILE_ACCESSMODE
accessmode
,
MF_FILE_OPENMODE
openmode
,
MF_FILE_FLAGS
flags
,
LPCWSTR
url
,
IMFByteStream
**
bytestream
)
{
mf
bytestream
*
object
;
struct
bytestream
*
object
;
DWORD
fileaccessmode
=
0
;
DWORD
filesharemode
=
FILE_SHARE_READ
;
DWORD
filecreation_disposition
=
0
;
...
...
@@ -2894,6 +2897,7 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
object
->
write_callback
.
lpVtbl
=
&
bytestream_file_write_callback_vtbl
;
InitializeCriticalSection
(
&
object
->
cs
);
list_init
(
&
object
->
pending
);
object
->
hfile
=
file
;
if
(
GetFileTime
(
file
,
NULL
,
NULL
,
&
writetime
))
{
...
...
@@ -2905,8 +2909,6 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
*
bytestream
=
&
object
->
IMFByteStream_iface
;
CloseHandle
(
file
);
return
S_OK
;
}
...
...
dlls/mfplat/tests/mfplat.c
View file @
b74b5991
...
...
@@ -1187,15 +1187,11 @@ todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IMFByteStream_Release
(
bytestream2
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_WRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_NONE
,
filename
,
&
bytestream2
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IMFByteStream_Release
(
bytestream2
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_WRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_NONE
,
filename
,
&
bytestream2
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_READWRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_NONE
,
filename
,
&
bytestream2
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IMFByteStream_Release
(
bytestream2
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_READWRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_NONE
,
filename
,
&
bytestream2
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"Unexpected hr %#x.
\n
"
,
hr
);
IMFByteStream_Release
(
bytestream
);
...
...
@@ -1211,20 +1207,15 @@ todo_wine
MF_FILEFLAGS_NONE
,
newfilename
,
&
bytestream
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_READ
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_NONE
,
newfilename
,
&
bytestream2
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IMFByteStream_Release
(
bytestream2
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_READ
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_NONE
,
newfilename
,
&
bytestream2
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_WRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_NONE
,
newfilename
,
&
bytestream2
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IMFByteStream_Release
(
bytestream2
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_WRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_NONE
,
newfilename
,
&
bytestream2
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_WRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_ALLOW_WRITE_SHARING
,
newfilename
,
&
bytestream2
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IMFByteStream_Release
(
bytestream2
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_WRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_ALLOW_WRITE_SHARING
,
newfilename
,
&
bytestream2
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"Unexpected hr %#x.
\n
"
,
hr
);
IMFByteStream_Release
(
bytestream
);
...
...
@@ -1233,14 +1224,14 @@ todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* Opening the file again fails even though MF_FILEFLAGS_ALLOW_WRITE_SHARING is set. */
hr
=
MFCreateFile
(
MF_ACCESSMODE_WRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_ALLOW_WRITE_SHARING
,
newfilename
,
&
bytestream2
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IMFByteStream_Release
(
bytestream2
);
hr
=
MFCreateFile
(
MF_ACCESSMODE_WRITE
,
MF_OPENMODE_FAIL_IF_NOT_EXIST
,
MF_FILEFLAGS_ALLOW_WRITE_SHARING
,
newfilename
,
&
bytestream2
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"Unexpected hr %#x.
\n
"
,
hr
);
IMFByteStream_Release
(
bytestream
);
MFShutdown
();
hr
=
MFShutdown
();
ok
(
hr
==
S_OK
,
"Failed to shut down, hr %#x.
\n
"
,
hr
);
DeleteFileW
(
filename
);
DeleteFileW
(
newfilename
);
...
...
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