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
1ffc47b5
Commit
1ffc47b5
authored
Sep 21, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmloader: Use a simpler file stream implementation.
parent
9e0487c4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
82 deletions
+41
-82
dmloader_private.h
dlls/dmloader/dmloader_private.h
+1
-17
loader.c
dlls/dmloader/loader.c
+40
-65
loaderstream.c
dlls/dmloader/loaderstream.c
+0
-0
No files found.
dlls/dmloader/dmloader_private.h
View file @
1ffc47b5
...
...
@@ -59,26 +59,9 @@ typedef struct IDirectMusicLoaderGenericStream IDirectMusicLoaderGenericStream;
*/
extern
HRESULT
create_dmloader
(
REFIID
riid
,
void
**
ret_iface
);
extern
HRESULT
create_dmcontainer
(
REFIID
riid
,
void
**
ret_iface
);
extern
HRESULT
DMUSIC_CreateDirectMusicLoaderFileStream
(
void
**
ppobj
);
extern
HRESULT
DMUSIC_CreateDirectMusicLoaderResourceStream
(
void
**
ppobj
);
/*****************************************************************************
* IDirectMusicLoaderFileStream implementation structure
*/
struct
IDirectMusicLoaderFileStream
{
/* VTABLEs */
const
IStreamVtbl
*
StreamVtbl
;
/* reference counter */
LONG
dwRef
;
/* file */
WCHAR
wzFileName
[
MAX_PATH
];
/* for clone */
HANDLE
hFile
;
};
/* Custom: */
extern
HRESULT
WINAPI
IDirectMusicLoaderFileStream_Attach
(
LPSTREAM
iface
,
LPCWSTR
wzFile
);
/*****************************************************************************
* IDirectMusicLoaderResourceStream implementation structure
*/
struct
IDirectMusicLoaderResourceStream
{
...
...
@@ -98,6 +81,7 @@ extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach(LPSTREAM iface, LP
LONGLONG
llMemLength
,
LONGLONG
llPos
);
extern
HRESULT
loader_stream_create
(
IDirectMusicLoader
*
loader
,
IStream
*
stream
,
IStream
**
ret_iface
);
extern
HRESULT
file_stream_create
(
const
WCHAR
*
path
,
IStream
**
ret_iface
);
#include "debug.h"
...
...
dlls/dmloader/loader.c
View file @
1ffc47b5
...
...
@@ -305,40 +305,29 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
TRACE
(
": no cache/alias entry found for requested object
\n
"
);
}
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_URL
)
{
TRACE
(
": loading from URLs not supported yet
\n
"
);
return
DMUS_E_LOADER_FORMATNOTSUPPORTED
;
}
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
{
/* load object from file */
/* generate filename; if it's full path, don't add search
directory path, otherwise do */
WCHAR
wszFileName
[
MAX_PATH
];
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FULLPATH
)
{
lstrcpyW
(
wszFileName
,
pDesc
->
wszFileName
);
}
else
{
WCHAR
*
p
;
get_search_path
(
This
,
&
pDesc
->
guidClass
,
wszFileName
);
p
=
wszFileName
+
lstrlenW
(
wszFileName
);
if
(
p
>
wszFileName
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
lstrcpyW
(
p
,
pDesc
->
wszFileName
);
}
TRACE
(
": loading from file (%s)
\n
"
,
debugstr_w
(
wszFileName
));
/* create stream and associate it with file */
result
=
DMUSIC_CreateDirectMusicLoaderFileStream
((
LPVOID
*
)
&
pStream
);
if
(
FAILED
(
result
))
{
ERR
(
": could not create file stream
\n
"
);
return
result
;
}
result
=
IDirectMusicLoaderFileStream_Attach
(
pStream
,
wszFileName
);
if
(
FAILED
(
result
))
{
ERR
(
": could not attach stream to file
\n
"
);
IStream_Release
(
pStream
);
return
result
;
}
}
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_URL
)
{
TRACE
(
": loading from URLs not supported yet
\n
"
);
return
DMUS_E_LOADER_FORMATNOTSUPPORTED
;
}
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
{
WCHAR
file_name
[
MAX_PATH
];
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FULLPATH
)
lstrcpyW
(
file_name
,
pDesc
->
wszFileName
);
else
{
WCHAR
*
p
;
get_search_path
(
This
,
&
pDesc
->
guidClass
,
file_name
);
p
=
file_name
+
lstrlenW
(
file_name
);
if
(
p
>
file_name
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
lstrcpyW
(
p
,
pDesc
->
wszFileName
);
}
TRACE
(
": loading from file (%s)
\n
"
,
debugstr_w
(
file_name
));
if
(
FAILED
(
hr
=
file_stream_create
(
file_name
,
&
pStream
)))
return
hr
;
}
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_MEMORY
)
{
/* load object from resource */
TRACE
(
": loading from resource
\n
"
);
...
...
@@ -363,9 +352,8 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
}
else
{
/* nowhere to load from */
FIXME
(
": unknown/unsupported way of loading
\n
"
);
return
DMUS_E_LOADER_NOFILENAME
;
/* test shows this is returned */
return
DMUS_E_LOADER_NOFILENAME
;
}
if
(
FAILED
(
hr
=
loader_stream_create
((
IDirectMusicLoader
*
)
iface
,
pStream
,
&
loader_stream
)))
...
...
@@ -459,36 +447,23 @@ static HRESULT WINAPI loader_SetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
if
(
TRACE_ON
(
dmloader
))
dump_DMUS_OBJECTDESC
(
pDesc
);
/* create stream and load additional info from it */
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
{
/* generate filename; if it's full path, don't add search
directory path, otherwise do */
WCHAR
wszFileName
[
MAX_PATH
];
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
{
WCHAR
file_name
[
MAX_PATH
];
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FULLPATH
)
{
lstrcpyW
(
wszFileName
,
pDesc
->
wszFileName
);
}
else
{
WCHAR
*
p
;
get_search_path
(
This
,
&
pDesc
->
guidClass
,
wszFileName
);
p
=
wszFileName
+
lstrlenW
(
wszFileName
);
if
(
p
>
wszFileName
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
lstrcpyW
(
p
,
pDesc
->
wszFileName
);
}
/* create stream */
hr
=
DMUSIC_CreateDirectMusicLoaderFileStream
((
LPVOID
*
)
&
pStream
);
if
(
FAILED
(
hr
))
{
ERR
(
": could not create file stream
\n
"
);
return
DMUS_E_LOADER_FAILEDOPEN
;
}
/* attach stream */
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
;
}
}
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FULLPATH
)
lstrcpyW
(
file_name
,
pDesc
->
wszFileName
);
else
{
WCHAR
*
p
;
get_search_path
(
This
,
&
pDesc
->
guidClass
,
file_name
);
p
=
file_name
+
lstrlenW
(
file_name
);
if
(
p
>
file_name
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
lstrcpyW
(
p
,
pDesc
->
wszFileName
);
}
if
(
FAILED
(
hr
=
file_stream_create
(
file_name
,
&
pStream
)))
return
hr
;
}
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_STREAM
)
{
pStream
=
pDesc
->
pStream
;
...
...
dlls/dmloader/loaderstream.c
View file @
1ffc47b5
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