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
68d2b338
Commit
68d2b338
authored
Feb 10, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Implement MFCreateTempFile().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c058e562
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
15 deletions
+58
-15
Makefile.in
dlls/mfplat/Makefile.in
+2
-1
main.c
dlls/mfplat/main.c
+53
-13
mfplat.spec
dlls/mfplat/mfplat.spec
+1
-1
mfapi.h
include/mfapi.h
+2
-0
No files found.
dlls/mfplat/Makefile.in
View file @
68d2b338
EXTRADEFS
=
-DWINE_NO_LONG_TYPES
MODULE
=
mfplat.dll
IMPORTLIB
=
mfplat
IMPORTS
=
advapi32 ole32 mfuuid propsys rtworkq
IMPORTS
=
advapi32 ole32 mfuuid propsys rtworkq kernelbase
DELAYIMPORTS
=
bcrypt
EXTRADLLFLAGS
=
-Wb
,--prefer-native
...
...
dlls/mfplat/main.c
View file @
68d2b338
...
...
@@ -52,6 +52,9 @@
#include "initguid.h"
#include "mfd3d12.h"
#include "bcrypt.h"
#include "pathcch.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
mfplat
);
struct
local_handler
...
...
@@ -4576,11 +4579,8 @@ static const IMFGetServiceVtbl bytestream_file_getservice_vtbl =
bytestream_file_getservice_GetService
,
};
/***********************************************************************
* MFCreateFile (mfplat.@)
*/
HRESULT
WINAPI
MFCreateFile
(
MF_FILE_ACCESSMODE
accessmode
,
MF_FILE_OPENMODE
openmode
,
MF_FILE_FLAGS
flags
,
LPCWSTR
url
,
IMFByteStream
**
bytestream
)
static
HRESULT
create_file_bytestream
(
MF_FILE_ACCESSMODE
accessmode
,
MF_FILE_OPENMODE
openmode
,
MF_FILE_FLAGS
flags
,
const
WCHAR
*
path
,
BOOL
is_tempfile
,
IMFByteStream
**
bytestream
)
{
DWORD
capabilities
=
MFBYTESTREAM_IS_SEEKABLE
|
MFBYTESTREAM_DOES_NOT_USE_NETWORK
;
DWORD
filecreation_disposition
=
0
,
fileaccessmode
=
0
,
fileattributes
=
0
;
...
...
@@ -4590,8 +4590,6 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
HANDLE
file
;
HRESULT
hr
;
TRACE
(
"%d, %d, %#x, %s, %p.
\n
"
,
accessmode
,
openmode
,
flags
,
debugstr_w
(
url
),
bytestream
);
switch
(
accessmode
)
{
case
MF_ACCESSMODE_READ
:
...
...
@@ -4630,12 +4628,12 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
if
(
flags
&
MF_FILEFLAGS_NOBUFFERING
)
fileattributes
|=
FILE_FLAG_NO_BUFFERING
;
if
(
is_tempfile
)
fileattributes
|=
FILE_FLAG_DELETE_ON_CLOSE
;
/* Open HANDLE to file */
file
=
CreateFileW
(
url
,
fileaccessmode
,
filesharemode
,
NULL
,
filecreation_disposition
,
fileattributes
,
0
);
if
(
file
==
INVALID_HANDLE_VALUE
)
file
=
CreateFileW
(
path
,
fileaccessmode
,
filesharemode
,
NULL
,
filecreation_disposition
,
fileattributes
,
0
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
...
...
@@ -4660,19 +4658,61 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
object
->
capabilities
=
capabilities
;
object
->
hfile
=
file
;
if
(
GetFileTime
(
file
,
NULL
,
NULL
,
&
writetime
))
if
(
!
is_tempfile
&&
GetFileTime
(
file
,
NULL
,
NULL
,
&
writetime
))
{
IMFAttributes_SetBlob
(
&
object
->
attributes
.
IMFAttributes_iface
,
&
MF_BYTESTREAM_LAST_MODIFIED_TIME
,
(
const
UINT8
*
)
&
writetime
,
sizeof
(
writetime
));
}
IMFAttributes_SetString
(
&
object
->
attributes
.
IMFAttributes_iface
,
&
MF_BYTESTREAM_ORIGIN_NAME
,
url
);
IMFAttributes_SetString
(
&
object
->
attributes
.
IMFAttributes_iface
,
&
MF_BYTESTREAM_ORIGIN_NAME
,
path
);
*
bytestream
=
&
object
->
IMFByteStream_iface
;
return
S_OK
;
}
/***********************************************************************
* MFCreateFile (mfplat.@)
*/
HRESULT
WINAPI
MFCreateFile
(
MF_FILE_ACCESSMODE
accessmode
,
MF_FILE_OPENMODE
openmode
,
MF_FILE_FLAGS
flags
,
const
WCHAR
*
path
,
IMFByteStream
**
bytestream
)
{
TRACE
(
"%d, %d, %#x, %s, %p.
\n
"
,
accessmode
,
openmode
,
flags
,
debugstr_w
(
path
),
bytestream
);
return
create_file_bytestream
(
accessmode
,
openmode
,
flags
,
path
,
FALSE
,
bytestream
);
}
/***********************************************************************
* MFCreateTempFile (mfplat.@)
*/
HRESULT
WINAPI
MFCreateTempFile
(
MF_FILE_ACCESSMODE
accessmode
,
MF_FILE_OPENMODE
openmode
,
MF_FILE_FLAGS
flags
,
IMFByteStream
**
bytestream
)
{
WCHAR
name
[
24
],
tmppath
[
MAX_PATH
],
*
path
;
ULONG64
rnd
;
size_t
len
;
HRESULT
hr
;
TRACE
(
"%d, %d, %#x, %p.
\n
"
,
accessmode
,
openmode
,
flags
,
bytestream
);
BCryptGenRandom
(
NULL
,
(
UCHAR
*
)
&
rnd
,
sizeof
(
rnd
),
BCRYPT_USE_SYSTEM_PREFERRED_RNG
);
swprintf
(
name
,
ARRAY_SIZE
(
name
),
L"MFP%llX.TMP"
,
rnd
);
GetTempPathW
(
ARRAY_SIZE
(
tmppath
),
tmppath
);
len
=
wcslen
(
tmppath
)
+
wcslen
(
name
)
+
2
;
if
(
!
(
path
=
malloc
(
len
*
sizeof
(
*
path
))))
return
E_OUTOFMEMORY
;
wcscpy
(
path
,
tmppath
);
PathCchAppend
(
path
,
len
,
name
);
hr
=
create_file_bytestream
(
accessmode
,
openmode
,
flags
,
path
,
TRUE
,
bytestream
);
free
(
path
);
return
hr
;
}
struct
bytestream_wrapper
{
IMFByteStreamCacheControl
IMFByteStreamCacheControl_iface
;
...
...
dlls/mfplat/mfplat.spec
View file @
68d2b338
...
...
@@ -71,7 +71,7 @@
@ stdcall MFCreateStreamDescriptor(long long ptr ptr)
@ stdcall MFCreateSystemTimeSource(ptr)
@ stub MFCreateSystemUnderlyingClock
@ st
ub MFCreateTempFile
@ st
dcall MFCreateTempFile(long long long ptr)
@ stdcall MFCreateTrackedSample(ptr)
@ stdcall MFCreateTransformActivate(ptr)
@ stub MFCreateURLFromPath
...
...
include/mfapi.h
View file @
68d2b338
...
...
@@ -533,6 +533,8 @@ HRESULT WINAPI MFCreateMediaEvent(MediaEventType type, REFGUID extended_type, HR
HRESULT
WINAPI
MFCreateMediaType
(
IMFMediaType
**
type
);
HRESULT
WINAPI
MFCreateMFVideoFormatFromMFMediaType
(
IMFMediaType
*
media_type
,
MFVIDEOFORMAT
**
video_format
,
UINT32
*
size
);
HRESULT
WINAPI
MFCreateSample
(
IMFSample
**
sample
);
HRESULT
WINAPI
MFCreateTempFile
(
MF_FILE_ACCESSMODE
accessmode
,
MF_FILE_OPENMODE
openmode
,
MF_FILE_FLAGS
flags
,
IMFByteStream
**
bytestream
);
HRESULT
WINAPI
MFCreateVideoMediaTypeFromSubtype
(
const
GUID
*
subtype
,
IMFVideoMediaType
**
media_type
);
HRESULT
WINAPI
MFCreateVideoSampleAllocatorEx
(
REFIID
riid
,
void
**
allocator
);
HRESULT
WINAPI
MFCreateMemoryBuffer
(
DWORD
max_length
,
IMFMediaBuffer
**
buffer
);
...
...
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