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
c7b956f8
Commit
c7b956f8
authored
Jun 11, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Add MFRegisterLocalByteStreamHandler().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f8a04c7f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
14 deletions
+77
-14
main.c
dlls/mfplat/main.c
+61
-14
mfplat.spec
dlls/mfplat/mfplat.spec
+1
-0
mfplat.c
dlls/mfplat/tests/mfplat.c
+15
-0
No files found.
dlls/mfplat/main.c
View file @
c7b956f8
...
...
@@ -47,13 +47,22 @@ static LONG platform_lock;
struct
local_handler
{
struct
list
entry
;
WCHAR
*
scheme
;
union
{
WCHAR
*
scheme
;
struct
{
WCHAR
*
extension
;
WCHAR
*
mime
;
}
bytestream
;
}
u
;
IMFActivate
*
activate
;
};
static
CRITICAL_SECTION
local_handlers_section
=
{
NULL
,
-
1
,
0
,
0
,
0
,
0
};
static
struct
list
local_scheme_handlers
=
LIST_INIT
(
local_scheme_handlers
);
static
struct
list
local_bytestream_handlers
=
LIST_INIT
(
local_bytestream_handlers
);
struct
system_clock
{
...
...
@@ -7153,21 +7162,25 @@ static const IMFAsyncCallbackVtbl async_create_file_callback_vtbl =
async_create_file_callback_Invoke
,
};
static
WCHAR
*
heap_strdupW
(
const
WCHAR
*
str
)
static
HRESULT
heap_strdupW
(
const
WCHAR
*
str
,
WCHAR
**
dest
)
{
WCHAR
*
ret
=
NULL
;
HRESULT
hr
=
S_OK
;
if
(
str
)
{
unsigned
int
size
;
size
=
(
lstrlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
size
);
if
(
ret
)
memcpy
(
ret
,
str
,
size
);
*
dest
=
heap_alloc
(
size
);
if
(
*
dest
)
memcpy
(
*
dest
,
str
,
size
);
else
hr
=
E_OUTOFMEMORY
;
}
else
*
dest
=
NULL
;
return
ret
;
return
hr
;
}
/***********************************************************************
...
...
@@ -7201,12 +7214,8 @@ HRESULT WINAPI MFBeginCreateFile(MF_FILE_ACCESSMODE access_mode, MF_FILE_OPENMOD
async
->
access_mode
=
access_mode
;
async
->
open_mode
=
open_mode
;
async
->
flags
=
flags
;
async
->
path
=
heap_strdupW
(
path
);
if
(
!
async
->
path
)
{
hr
=
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
heap_strdupW
(
path
,
&
async
->
path
)))
goto
failed
;
}
hr
=
MFCreateAsyncResult
(
NULL
,
&
async
->
IMFAsyncCallback_iface
,
(
IUnknown
*
)
caller
,
&
item
);
if
(
FAILED
(
hr
))
...
...
@@ -7300,6 +7309,7 @@ HRESULT WINAPI MFCancelCreateFile(IUnknown *cancel_cookie)
HRESULT
WINAPI
MFRegisterLocalSchemeHandler
(
const
WCHAR
*
scheme
,
IMFActivate
*
activate
)
{
struct
local_handler
*
handler
;
HRESULT
hr
;
TRACE
(
"%s, %p.
\n
"
,
debugstr_w
(
scheme
),
activate
);
...
...
@@ -7309,10 +7319,10 @@ HRESULT WINAPI MFRegisterLocalSchemeHandler(const WCHAR *scheme, IMFActivate *ac
if
(
!
(
handler
=
heap_alloc
(
sizeof
(
*
handler
))))
return
E_OUTOFMEMORY
;
if
(
!
(
handler
->
scheme
=
heap_strdupW
(
scheme
)))
if
(
FAILED
(
hr
=
heap_strdupW
(
scheme
,
&
handler
->
u
.
scheme
)))
{
heap_free
(
handler
);
return
E_OUTOFMEMORY
;
return
hr
;
}
handler
->
activate
=
activate
;
IMFActivate_AddRef
(
handler
->
activate
);
...
...
@@ -7323,3 +7333,40 @@ HRESULT WINAPI MFRegisterLocalSchemeHandler(const WCHAR *scheme, IMFActivate *ac
return
S_OK
;
}
/***********************************************************************
* MFRegisterLocalByteStreamHandler (mfplat.@)
*/
HRESULT
WINAPI
MFRegisterLocalByteStreamHandler
(
const
WCHAR
*
extension
,
const
WCHAR
*
mime
,
IMFActivate
*
activate
)
{
struct
local_handler
*
handler
;
HRESULT
hr
;
TRACE
(
"%s, %s, %p.
\n
"
,
debugstr_w
(
extension
),
debugstr_w
(
mime
),
activate
);
if
((
!
extension
&&
!
mime
)
||
!
activate
)
return
E_INVALIDARG
;
if
(
!
(
handler
=
heap_alloc_zero
(
sizeof
(
*
handler
))))
return
E_OUTOFMEMORY
;
hr
=
heap_strdupW
(
extension
,
&
handler
->
u
.
bytestream
.
extension
);
if
(
SUCCEEDED
(
hr
))
hr
=
heap_strdupW
(
mime
,
&
handler
->
u
.
bytestream
.
mime
);
if
(
FAILED
(
hr
))
goto
failed
;
EnterCriticalSection
(
&
local_handlers_section
);
list_add_head
(
&
local_bytestream_handlers
,
&
handler
->
entry
);
LeaveCriticalSection
(
&
local_handlers_section
);
return
hr
;
failed:
heap_free
(
handler
->
u
.
bytestream
.
extension
);
heap_free
(
handler
->
u
.
bytestream
.
mime
);
heap_free
(
handler
);
return
hr
;
}
dlls/mfplat/mfplat.spec
View file @
c7b956f8
...
...
@@ -128,6 +128,7 @@
@ stdcall MFPutWorkItemEx(long ptr)
@ stdcall MFPutWorkItemEx2(long long ptr)
@ stub MFRecordError
@ stdcall MFRegisterLocalByteStreamHandler(wstr wstr ptr)
@ stdcall MFRegisterLocalSchemeHandler(wstr ptr)
@ stdcall MFRemovePeriodicCallback(long)
@ stdcall MFScheduleWorkItem(ptr ptr int64 ptr)
...
...
dlls/mfplat/tests/mfplat.c
View file @
c7b956f8
...
...
@@ -3591,6 +3591,21 @@ static void test_local_handlers(void)
hr
=
pMFRegisterLocalSchemeHandler
(
localW
,
&
local_activate
);
ok
(
hr
==
S_OK
,
"Failed to register scheme handler, hr %#x.
\n
"
,
hr
);
hr
=
pMFRegisterLocalByteStreamHandler
(
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
pMFRegisterLocalByteStreamHandler
(
NULL
,
NULL
,
&
local_activate
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
pMFRegisterLocalByteStreamHandler
(
NULL
,
localW
,
&
local_activate
);
ok
(
hr
==
S_OK
,
"Failed to register stream handler, hr %#x.
\n
"
,
hr
);
hr
=
pMFRegisterLocalByteStreamHandler
(
localW
,
NULL
,
&
local_activate
);
ok
(
hr
==
S_OK
,
"Failed to register stream handler, hr %#x.
\n
"
,
hr
);
hr
=
pMFRegisterLocalByteStreamHandler
(
localW
,
localW
,
&
local_activate
);
ok
(
hr
==
S_OK
,
"Failed to register stream handler, hr %#x.
\n
"
,
hr
);
}
START_TEST
(
mfplat
)
...
...
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