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
975f2629
Commit
975f2629
authored
Sep 20, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmloader: Introduce a new loader_stream_create helper.
parent
7d33a77b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
28 deletions
+41
-28
dmloader_private.h
dlls/dmloader/dmloader_private.h
+6
-12
loader.c
dlls/dmloader/loader.c
+35
-16
loaderstream.c
dlls/dmloader/loaderstream.c
+0
-0
No files found.
dlls/dmloader/dmloader_private.h
View file @
975f2629
...
...
@@ -69,18 +69,15 @@ extern HRESULT DMUSIC_CreateDirectMusicLoaderGenericStream(void **ppobj);
struct
IDirectMusicLoaderFileStream
{
/* VTABLEs */
const
IStreamVtbl
*
StreamVtbl
;
const
IDirectMusicGetLoaderVtbl
*
GetLoaderVtbl
;
/* reference counter */
LONG
dwRef
;
/* file */
WCHAR
wzFileName
[
MAX_PATH
];
/* for clone */
HANDLE
hFile
;
/* loader */
LPDIRECTMUSICLOADER8
pLoader
;
};
/* Custom: */
extern
HRESULT
WINAPI
IDirectMusicLoaderFileStream_Attach
(
LPSTREAM
iface
,
LPCWSTR
wzFile
,
LPDIRECTMUSICLOADER8
pLoader
);
extern
HRESULT
WINAPI
IDirectMusicLoaderFileStream_Attach
(
LPSTREAM
iface
,
LPCWSTR
wzFile
);
/*****************************************************************************
* IDirectMusicLoaderResourceStream implementation structure
...
...
@@ -88,7 +85,6 @@ extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWS
struct
IDirectMusicLoaderResourceStream
{
/* IUnknown fields */
const
IStreamVtbl
*
StreamVtbl
;
const
IDirectMusicGetLoaderVtbl
*
GetLoaderVtbl
;
/* reference counter */
LONG
dwRef
;
/* data */
...
...
@@ -96,12 +92,11 @@ struct IDirectMusicLoaderResourceStream {
LONGLONG
llMemLength
;
/* current position */
LONGLONG
llPos
;
/* loader */
LPDIRECTMUSICLOADER8
pLoader
;
};
/* Custom: */
extern
HRESULT
WINAPI
IDirectMusicLoaderResourceStream_Attach
(
LPSTREAM
iface
,
LPBYTE
pbMemData
,
LONGLONG
llMemLength
,
LONGLONG
llPos
,
LPDIRECTMUSICLOADER8
pLoader
);
extern
HRESULT
WINAPI
IDirectMusicLoaderResourceStream_Attach
(
LPSTREAM
iface
,
LPBYTE
pbMemData
,
LONGLONG
llMemLength
,
LONGLONG
llPos
);
/*****************************************************************************
* IDirectMusicLoaderGenericStream implementation structure
...
...
@@ -109,17 +104,16 @@ extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, L
struct
IDirectMusicLoaderGenericStream
{
/* IUnknown fields */
const
IStreamVtbl
*
StreamVtbl
;
const
IDirectMusicGetLoaderVtbl
*
GetLoaderVtbl
;
/* reference counter */
LONG
dwRef
;
/* stream */
LPSTREAM
pStream
;
/* loader */
LPDIRECTMUSICLOADER8
pLoader
;
};
/* Custom: */
extern
HRESULT
WINAPI
IDirectMusicLoaderGenericStream_Attach
(
LPSTREAM
iface
,
LPSTREAM
pStream
,
LPDIRECTMUSICLOADER8
pLoader
);
extern
HRESULT
WINAPI
IDirectMusicLoaderGenericStream_Attach
(
LPSTREAM
iface
,
LPSTREAM
pStream
);
extern
HRESULT
loader_stream_create
(
IDirectMusicLoader
*
loader
,
IStream
*
stream
,
IStream
**
ret_iface
);
#include "debug.h"
...
...
dlls/dmloader/loader.c
View file @
975f2629
...
...
@@ -256,8 +256,10 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
LPDIRECTMUSICOBJECT
pObject
;
DMUS_OBJECTDESC
GotDesc
;
BOOL
bCache
;
IStream
*
loader_stream
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p, %s, %p)
\n
"
,
This
,
pDesc
,
debugstr_dmguid
(
riid
),
ppv
);
TRACE
(
"(%p)->(%p, %s, %p)
\n
"
,
This
,
pDesc
,
debugstr_dmguid
(
riid
),
ppv
);
if
(
TRACE_ON
(
dmloader
))
dump_DMUS_OBJECTDESC
(
pDesc
);
...
...
@@ -329,8 +331,9 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
ERR
(
": could not create file stream
\n
"
);
return
result
;
}
result
=
IDirectMusicLoaderFileStream_Attach
(
pStream
,
wszFileName
,
iface
);
if
(
FAILED
(
result
))
{
result
=
IDirectMusicLoaderFileStream_Attach
(
pStream
,
wszFileName
);
if
(
FAILED
(
result
))
{
ERR
(
": could not attach stream to file
\n
"
);
IStream_Release
(
pStream
);
return
result
;
...
...
@@ -345,8 +348,9 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
ERR
(
": could not create resource stream
\n
"
);
return
result
;
}
result
=
IDirectMusicLoaderResourceStream_Attach
(
pStream
,
pDesc
->
pbMemData
,
pDesc
->
llMemLength
,
0
,
iface
);
if
(
FAILED
(
result
))
{
result
=
IDirectMusicLoaderResourceStream_Attach
(
pStream
,
pDesc
->
pbMemData
,
pDesc
->
llMemLength
,
0
);
if
(
FAILED
(
result
))
{
ERR
(
": could not attach stream to resource
\n
"
);
IStream_Release
(
pStream
);
return
result
;
...
...
@@ -361,8 +365,9 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
ERR
(
": could not create generic stream
\n
"
);
return
result
;
}
result
=
IDirectMusicLoaderGenericStream_Attach
(
pStream
,
pDesc
->
pStream
,
iface
);
if
(
FAILED
(
result
))
{
result
=
IDirectMusicLoaderGenericStream_Attach
(
pStream
,
pDesc
->
pStream
);
if
(
FAILED
(
result
))
{
ERR
(
": failed to attach stream
\n
"
);
IStream_Release
(
pStream
);
return
result
;
...
...
@@ -373,7 +378,12 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
return
DMUS_E_LOADER_NOFILENAME
;
/* test shows this is returned */
}
/* create object */
if
(
FAILED
(
hr
=
loader_stream_create
((
IDirectMusicLoader
*
)
iface
,
pStream
,
&
loader_stream
)))
return
hr
;
IStream_Release
(
pStream
);
pStream
=
loader_stream
;
/* create object */
result
=
CoCreateInstance
(
&
pDesc
->
guidClass
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicObject
,
(
LPVOID
*
)
&
pObject
);
if
(
FAILED
(
result
))
{
IStream_Release
(
pStream
);
...
...
@@ -451,7 +461,8 @@ static HRESULT WINAPI loader_SetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
LPDIRECTMUSICOBJECT
pObject
;
DMUS_OBJECTDESC
Desc
;
struct
cache_entry
*
pObjectEntry
,
*
pNewEntry
;
HRESULT
hr
;
IStream
*
loader_stream
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pDesc
);
...
...
@@ -480,8 +491,9 @@ static HRESULT WINAPI loader_SetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
return
DMUS_E_LOADER_FAILEDOPEN
;
}
/* attach stream */
hr
=
IDirectMusicLoaderFileStream_Attach
(
pStream
,
wszFileName
,
iface
);
if
(
FAILED
(
hr
))
{
hr
=
IDirectMusicLoaderFileStream_Attach
(
pStream
,
wszFileName
);
if
(
FAILED
(
hr
))
{
ERR
(
": could not attach stream to file %s, make sure it exists
\n
"
,
debugstr_w
(
wszFileName
));
IStream_Release
(
pStream
);
return
DMUS_E_LOADER_FAILEDOPEN
;
...
...
@@ -495,8 +507,9 @@ static HRESULT WINAPI loader_SetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
return
DMUS_E_LOADER_FAILEDOPEN
;
}
/* attach stream */
hr
=
IDirectMusicLoaderGenericStream_Attach
(
pStream
,
pDesc
->
pStream
,
iface
);
if
(
FAILED
(
hr
))
{
hr
=
IDirectMusicLoaderGenericStream_Attach
(
pStream
,
pDesc
->
pStream
);
if
(
FAILED
(
hr
))
{
ERR
(
": could not attach stream
\n
"
);
IStream_Release
(
pStream
);
return
DMUS_E_LOADER_FAILEDOPEN
;
...
...
@@ -510,8 +523,9 @@ static HRESULT WINAPI loader_SetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
return
DMUS_E_LOADER_FAILEDOPEN
;
}
/* attach stream */
hr
=
IDirectMusicLoaderResourceStream_Attach
(
pStream
,
pDesc
->
pbMemData
,
pDesc
->
llMemLength
,
0
,
iface
);
if
(
FAILED
(
hr
))
{
hr
=
IDirectMusicLoaderResourceStream_Attach
(
pStream
,
pDesc
->
pbMemData
,
pDesc
->
llMemLength
,
0
);
if
(
FAILED
(
hr
))
{
ERR
(
": could not attach stream to resource
\n
"
);
IStream_Release
(
pStream
);
return
DMUS_E_LOADER_FAILEDOPEN
;
...
...
@@ -522,7 +536,12 @@ static HRESULT WINAPI loader_SetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
return
DMUS_E_LOADER_FAILEDOPEN
;
}
/* create object */
if
(
FAILED
(
hr
=
loader_stream_create
((
IDirectMusicLoader
*
)
iface
,
pStream
,
&
loader_stream
)))
return
hr
;
IStream_Release
(
pStream
);
pStream
=
loader_stream
;
/* create object */
hr
=
CoCreateInstance
(
&
pDesc
->
guidClass
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicObject
,
(
LPVOID
*
)
&
pObject
);
if
(
FAILED
(
hr
))
{
IStream_Release
(
pStream
);
...
...
dlls/dmloader/loaderstream.c
View file @
975f2629
This diff is collapsed.
Click to expand it.
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