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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
70 deletions
+29
-70
dmloader_private.h
dlls/dmloader/dmloader_private.h
+1
-17
loader.c
dlls/dmloader/loader.c
+28
-53
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;
...
@@ -59,26 +59,9 @@ typedef struct IDirectMusicLoaderGenericStream IDirectMusicLoaderGenericStream;
*/
*/
extern
HRESULT
create_dmloader
(
REFIID
riid
,
void
**
ret_iface
);
extern
HRESULT
create_dmloader
(
REFIID
riid
,
void
**
ret_iface
);
extern
HRESULT
create_dmcontainer
(
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
);
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
* IDirectMusicLoaderResourceStream implementation structure
*/
*/
struct
IDirectMusicLoaderResourceStream
{
struct
IDirectMusicLoaderResourceStream
{
...
@@ -98,6 +81,7 @@ extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach(LPSTREAM iface, LP
...
@@ -98,6 +81,7 @@ extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach(LPSTREAM iface, LP
LONGLONG
llMemLength
,
LONGLONG
llPos
);
LONGLONG
llMemLength
,
LONGLONG
llPos
);
extern
HRESULT
loader_stream_create
(
IDirectMusicLoader
*
loader
,
IStream
*
stream
,
IStream
**
ret_iface
);
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"
#include "debug.h"
...
...
dlls/dmloader/loader.c
View file @
1ffc47b5
...
@@ -305,39 +305,28 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
...
@@ -305,39 +305,28 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
TRACE
(
": no cache/alias entry found for requested object
\n
"
);
TRACE
(
": no cache/alias entry found for requested object
\n
"
);
}
}
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_URL
)
{
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_URL
)
{
TRACE
(
": loading from URLs not supported yet
\n
"
);
TRACE
(
": loading from URLs not supported yet
\n
"
);
return
DMUS_E_LOADER_FORMATNOTSUPPORTED
;
return
DMUS_E_LOADER_FORMATNOTSUPPORTED
;
}
}
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
{
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
/* load object from file */
{
/* generate filename; if it's full path, don't add search
WCHAR
file_name
[
MAX_PATH
];
directory path, otherwise do */
WCHAR
wszFileName
[
MAX_PATH
];
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FULLPATH
)
{
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FULLPATH
)
lstrcpyW
(
wszFileName
,
pDesc
->
wszFileName
);
lstrcpyW
(
file_name
,
pDesc
->
wszFileName
);
}
else
{
else
{
WCHAR
*
p
;
WCHAR
*
p
;
get_search_path
(
This
,
&
pDesc
->
guidClass
,
wszFileN
ame
);
get_search_path
(
This
,
&
pDesc
->
guidClass
,
file_n
ame
);
p
=
wszFileName
+
lstrlenW
(
wszFileN
ame
);
p
=
file_name
+
lstrlenW
(
file_n
ame
);
if
(
p
>
wszFileN
ame
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
if
(
p
>
file_n
ame
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
lstrcpyW
(
p
,
pDesc
->
wszFileName
);
lstrcpyW
(
p
,
pDesc
->
wszFileName
);
}
}
TRACE
(
": loading from file (%s)
\n
"
,
debugstr_w
(
wszFileName
));
/* create stream and associate it with file */
TRACE
(
": loading from file (%s)
\n
"
,
debugstr_w
(
file_name
));
result
=
DMUSIC_CreateDirectMusicLoaderFileStream
((
LPVOID
*
)
&
pStream
);
if
(
FAILED
(
hr
=
file_stream_create
(
file_name
,
&
pStream
)))
return
hr
;
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
;
}
}
}
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_MEMORY
)
{
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_MEMORY
)
{
/* load object from resource */
/* load object from resource */
...
@@ -363,9 +352,8 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
...
@@ -363,9 +352,8 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
}
}
else
else
{
{
/* nowhere to load from */
FIXME
(
": unknown/unsupported way of loading
\n
"
);
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
)))
if
(
FAILED
(
hr
=
loader_stream_create
((
IDirectMusicLoader
*
)
iface
,
pStream
,
&
loader_stream
)))
...
@@ -459,35 +447,22 @@ static HRESULT WINAPI loader_SetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
...
@@ -459,35 +447,22 @@ static HRESULT WINAPI loader_SetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
if
(
TRACE_ON
(
dmloader
))
if
(
TRACE_ON
(
dmloader
))
dump_DMUS_OBJECTDESC
(
pDesc
);
dump_DMUS_OBJECTDESC
(
pDesc
);
/* create stream and load additional info from it */
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
{
{
/* generate filename; if it's full path, don't add search
WCHAR
file_name
[
MAX_PATH
];
directory path, otherwise do */
WCHAR
wszFileName
[
MAX_PATH
];
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FULLPATH
)
{
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FULLPATH
)
lstrcpyW
(
wszFileName
,
pDesc
->
wszFileName
);
lstrcpyW
(
file_name
,
pDesc
->
wszFileName
);
}
else
{
else
{
WCHAR
*
p
;
WCHAR
*
p
;
get_search_path
(
This
,
&
pDesc
->
guidClass
,
wszFileN
ame
);
get_search_path
(
This
,
&
pDesc
->
guidClass
,
file_n
ame
);
p
=
wszFileName
+
lstrlenW
(
wszFileN
ame
);
p
=
file_name
+
lstrlenW
(
file_n
ame
);
if
(
p
>
wszFileN
ame
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
if
(
p
>
file_n
ame
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
lstrcpyW
(
p
,
pDesc
->
wszFileName
);
lstrcpyW
(
p
,
pDesc
->
wszFileName
);
}
}
/* create stream */
hr
=
DMUSIC_CreateDirectMusicLoaderFileStream
((
LPVOID
*
)
&
pStream
);
if
(
FAILED
(
hr
=
file_stream_create
(
file_name
,
&
pStream
)))
return
hr
;
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
;
}
}
}
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_STREAM
)
else
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_STREAM
)
{
{
...
...
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