Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b47facb4
Commit
b47facb4
authored
Dec 18, 2012
by
Christian Costa
Committed by
Alexandre Julliard
Dec 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmloader: COM cleanup of IDirectMusicLoader object.
parent
bbf3e862
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
85 deletions
+111
-85
dmloader_private.h
dlls/dmloader/dmloader_private.h
+6
-8
loader.c
dlls/dmloader/loader.c
+105
-77
No files found.
dlls/dmloader/dmloader_private.h
View file @
b47facb4
...
...
@@ -91,14 +91,12 @@ typedef struct _WINE_LOADER_OPTION {
* IDirectMusicLoaderImpl implementation structure
*/
struct
IDirectMusicLoaderImpl
{
/* VTABLEs */
const
IDirectMusicLoader8Vtbl
*
LoaderVtbl
;
/* reference counter */
LONG
dwRef
;
/* simple cache (linked list) */
struct
list
*
pObjects
;
/* settings for certain object classes */
struct
list
*
pClassSettings
;
IDirectMusicLoader8
IDirectMusicLoader8_iface
;
LONG
ref
;
/* simple cache (linked list) */
struct
list
*
pObjects
;
/* settings for certain object classes */
struct
list
*
pClassSettings
;
};
/* contained object entry */
...
...
dlls/dmloader/loader.c
View file @
b47facb4
...
...
@@ -21,11 +21,17 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmloader
);
static
HRESULT
DMUSIC_InitLoaderSettings
(
LPDIRECTMUSICLOADER8
iface
);
static
HRESULT
DMUSIC_GetLoaderSettings
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
pClassID
,
WCHAR
*
wszSearchPath
,
LPBOOL
pbCache
);
static
HRESULT
DMUSIC_SetLoaderSettings
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
pClassID
,
WCHAR
*
wszSearchPath
,
LPBOOL
pbCache
);
static
inline
IDirectMusicLoaderImpl
*
impl_from_IDirectMusicLoader8
(
IDirectMusicLoader8
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirectMusicLoaderImpl
,
IDirectMusicLoader8_iface
);
}
static
HRESULT
DMUSIC_InitLoaderSettings
(
IDirectMusicLoader8
*
iface
);
static
HRESULT
DMUSIC_GetLoaderSettings
(
IDirectMusicLoader8
*
iface
,
REFGUID
class_id
,
WCHAR
*
search_path
,
BOOL
*
cache
);
static
HRESULT
DMUSIC_SetLoaderSettings
(
IDirectMusicLoader8
*
iface
,
REFGUID
class_id
,
WCHAR
*
search_path
,
BOOL
*
cache
);
static
HRESULT
DMUSIC_CopyDescriptor
(
LPDMUS_OBJECTDESC
pDst
,
LPDMUS_OBJECTDESC
pSrc
)
{
static
HRESULT
DMUSIC_CopyDescriptor
(
DMUS_OBJECTDESC
*
pDst
,
DMUS_OBJECTDESC
*
pSrc
)
{
TRACE
(
": copy
\n
%s
\n
"
,
debugstr_DMUS_OBJECTDESC
(
pSrc
));
/* copy field by field */
if
(
pSrc
->
dwValidData
&
DMUS_OBJ_CLASS
)
pDst
->
guidClass
=
pSrc
->
guidClass
;
...
...
@@ -69,8 +75,9 @@ static BOOL DMUSIC_IsValidLoadableClass (REFCLSID pClassID) {
*/
/* IUnknown/IDirectMusicLoader(8) part: */
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_QueryInterface
(
LPDIRECTMUSICLOADER8
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_QueryInterface
(
IDirectMusicLoader8
*
iface
,
REFIID
riid
,
void
**
ppobj
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
...
...
@@ -85,30 +92,37 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_QueryInterface (
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_AddRef
(
LPDIRECTMUSICLOADER8
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
TRACE
(
"(%p): AddRef from %d
\n
"
,
This
,
This
->
dwRef
);
return
InterlockedIncrement
(
&
This
->
dwRef
);
static
ULONG
WINAPI
IDirectMusicLoaderImpl_AddRef
(
IDirectMusicLoader8
*
iface
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(): new ref = %u
\n
"
,
iface
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_Release
(
LPDIRECTMUSICLOADER8
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
DWORD
dwRef
=
InterlockedDecrement
(
&
This
->
dwRef
);
TRACE
(
"(%p): ReleaseRef to %d
\n
"
,
This
,
This
->
dwRef
);
if
(
dwRef
==
0
)
{
/* firstly, release the cache */
IDirectMusicLoader8_ClearCache
(
iface
,
&
GUID_DirectMusicAllTypes
);
/* FIXME: release all allocated entries */
HeapFree
(
GetProcessHeap
(),
0
,
This
);
unlock_module
();
}
static
ULONG
WINAPI
IDirectMusicLoaderImpl_Release
(
IDirectMusicLoader8
*
iface
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(): new ref = %u
\n
"
,
iface
,
ref
);
if
(
!
ref
)
{
/* Firstly, release the cache */
IDirectMusicLoader8_ClearCache
(
iface
,
&
GUID_DirectMusicAllTypes
);
/* FIXME: Release all allocated entries */
HeapFree
(
GetProcessHeap
(),
0
,
This
);
unlock_module
();
}
return
dwR
ef
;
return
r
ef
;
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_GetObject
(
LPDIRECTMUSICLOADER8
iface
,
LPDMUS_OBJECTDESC
pDesc
,
REFIID
riid
,
LPVOID
*
ppv
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_GetObject
(
IDirectMusicLoader8
*
iface
,
DMUS_OBJECTDESC
*
pDesc
,
REFIID
riid
,
void
**
ppv
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
HRESULT
result
=
S_OK
;
HRESULT
ret
=
S_OK
;
/* used at the end of function, to determine whether everything went OK */
...
...
@@ -361,8 +375,9 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_GetObject (LPDIR
return
result
;
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_SetObject
(
LPDIRECTMUSICLOADER8
iface
,
LPDMUS_OBJECTDESC
pDesc
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_SetObject
(
IDirectMusicLoader8
*
iface
,
DMUS_OBJECTDESC
*
pDesc
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
LPSTREAM
pStream
;
LPDIRECTMUSICOBJECT
pObject
;
DMUS_OBJECTDESC
Desc
;
...
...
@@ -483,9 +498,10 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_SetObject (LPDIR
return
S_OK
;
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_SetSearchDirectory
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
rguidClass
,
WCHAR
*
pwzPath
,
BOOL
fClear
)
{
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_SetSearchDirectory
(
IDirectMusicLoader8
*
iface
,
REFGUID
rguidClass
,
WCHAR
*
pwzPath
,
BOOL
fClear
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
WCHAR
wszCurrentPath
[
MAX_PATH
];
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
TRACE
(
"(%p, %s, %s, %d)
\n
"
,
This
,
debugstr_dmguid
(
rguidClass
),
debugstr_w
(
pwzPath
),
fClear
);
FIXME
(
": fClear ignored
\n
"
);
DMUSIC_GetLoaderSettings
(
iface
,
rguidClass
,
wszCurrentPath
,
NULL
);
...
...
@@ -496,14 +512,15 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_SetSearchDirecto
return
DMUSIC_SetLoaderSettings
(
iface
,
rguidClass
,
pwzPath
,
NULL
);
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_ScanDirectory
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
rguidClass
,
WCHAR
*
pwzFileExtension
,
WCHAR
*
pwzScanFileName
)
{
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_ScanDirectory
(
IDirectMusicLoader8
*
iface
,
REFGUID
rguidClass
,
WCHAR
*
pwzFileExtension
,
WCHAR
*
pwzScanFileName
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
static
const
WCHAR
wszAny
[]
=
{
'*'
,
0
};
WIN32_FIND_DATAW
FileData
;
HANDLE
hSearch
;
WCHAR
wszSearchString
[
MAX_PATH
];
WCHAR
*
p
;
HRESULT
result
;
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
TRACE
(
"(%p, %s, %p, %p)
\n
"
,
This
,
debugstr_dmguid
(
rguidClass
),
pwzFileExtension
,
pwzScanFileName
);
if
(
IsEqualGUID
(
rguidClass
,
&
GUID_DirectMusicAllTypes
)
||
!
DMUSIC_IsValidLoadableClass
(
rguidClass
))
{
ERR
(
": rguidClass invalid CLSID
\n
"
);
...
...
@@ -550,13 +567,14 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_ScanDirectory (L
}
while
(
1
);
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_CacheObject
(
LPDIRECTMUSICLOADER8
iface
,
IDirectMusicObject
*
pObject
)
{
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_CacheObject
(
IDirectMusicLoader8
*
iface
,
IDirectMusicObject
*
pObject
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
DMUS_OBJECTDESC
Desc
;
HRESULT
result
=
DMUS_E_LOADER_OBJECTNOTFOUND
;
struct
list
*
pEntry
;
LPWINE_LOADER_ENTRY
pObjectEntry
=
NULL
;
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
TRACE
(
"(%p, %p)
\n
"
,
This
,
pObject
);
/* get descriptor */
...
...
@@ -630,13 +648,14 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_CacheObject (LPD
return
result
;
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_ReleaseObject
(
LPDIRECTMUSICLOADER8
iface
,
IDirectMusicObject
*
pObject
)
{
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_ReleaseObject
(
IDirectMusicLoader8
*
iface
,
IDirectMusicObject
*
pObject
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
DMUS_OBJECTDESC
Desc
;
struct
list
*
pEntry
;
LPWINE_LOADER_ENTRY
pObjectEntry
=
NULL
;
HRESULT
result
=
S_FALSE
;
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
TRACE
(
"(%p, %p)
\n
"
,
This
,
pObject
);
if
(
!
pObject
)
return
E_POINTER
;
...
...
@@ -695,10 +714,11 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_ReleaseObject (L
return
result
;
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_ClearCache
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
rguidClass
)
{
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_ClearCache
(
IDirectMusicLoader8
*
iface
,
REFGUID
rguidClass
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
struct
list
*
pEntry
;
LPWINE_LOADER_ENTRY
pObjectEntry
;
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
TRACE
(
"(%p, %s)
\n
"
,
This
,
debugstr_dmguid
(
rguidClass
));
LIST_FOR_EACH
(
pEntry
,
This
->
pObjects
)
{
...
...
@@ -714,8 +734,9 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_ClearCache (LPDI
return
S_OK
;
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_EnableCache
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
rguidClass
,
BOOL
fEnable
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_EnableCache
(
IDirectMusicLoader8
*
iface
,
REFGUID
rguidClass
,
BOOL
fEnable
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
BOOL
bCurrent
;
TRACE
(
"(%p, %s, %d)
\n
"
,
This
,
debugstr_dmguid
(
rguidClass
),
fEnable
);
DMUSIC_GetLoaderSettings
(
iface
,
rguidClass
,
NULL
,
&
bCurrent
);
...
...
@@ -725,11 +746,12 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_EnableCache (LPD
return
DMUSIC_SetLoaderSettings
(
iface
,
rguidClass
,
NULL
,
&
fEnable
);
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_EnumObject
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
rguidClass
,
DWORD
dwIndex
,
LPDMUS_OBJECTDESC
pDesc
)
{
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_EnumObject
(
IDirectMusicLoader8
*
iface
,
REFGUID
rguidClass
,
DWORD
dwIndex
,
DMUS_OBJECTDESC
*
pDesc
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
DWORD
dwCount
=
0
;
struct
list
*
pEntry
;
LPWINE_LOADER_ENTRY
pObjectEntry
;
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
TRACE
(
"(%p, %s, %d, %p)
\n
"
,
This
,
debugstr_dmguid
(
rguidClass
),
dwIndex
,
pDesc
);
DM_STRUCT_INIT
(
pDesc
);
...
...
@@ -755,13 +777,14 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_EnumObject (LPDI
return
S_FALSE
;
}
static
void
WINAPI
IDirectMusicLoaderImpl_
IDirectMusicLoader_CollectGarbage
(
LPDIRECTMUSICLOADER8
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
static
void
WINAPI
IDirectMusicLoaderImpl_
CollectGarbage
(
IDirectMusicLoader8
*
iface
)
{
FIXME
(
"(%p)->(): stub
\n
"
,
iface
);
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_ReleaseObjectByUnknown
(
LPDIRECTMUSICLOADER8
iface
,
IUnknown
*
pObject
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_ReleaseObjectByUnknown
(
IDirectMusicLoader8
*
iface
,
IUnknown
*
pObject
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
HRESULT
result
;
LPDIRECTMUSICOBJECT
pObjectInterface
;
...
...
@@ -781,8 +804,9 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_ReleaseObjectByU
return
result
;
}
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_IDirectMusicLoader_LoadObjectFromFile
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
rguidClassID
,
REFIID
iidInterfaceID
,
WCHAR
*
pwzFilePath
,
void
**
ppObject
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
static
HRESULT
WINAPI
IDirectMusicLoaderImpl_LoadObjectFromFile
(
IDirectMusicLoader8
*
iface
,
REFGUID
rguidClassID
,
REFIID
iidInterfaceID
,
WCHAR
*
pwzFilePath
,
void
**
ppObject
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
DMUS_OBJECTDESC
ObjDesc
;
WCHAR
wszLoaderSearchPath
[
MAX_PATH
];
...
...
@@ -808,25 +832,25 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_LoadObjectFromFi
TRACE
(
": full file path = %s
\n
"
,
debugstr_w
(
ObjDesc
.
wszFileName
));
return
IDirectMusicLoader
Impl_IDirectMusicLoader_GetObject
(
iface
,
&
ObjDesc
,
iidInterfaceID
,
ppObject
);
return
IDirectMusicLoader
_GetObject
(
iface
,
&
ObjDesc
,
iidInterfaceID
,
ppObject
);
}
static
const
IDirectMusicLoader8Vtbl
DirectMusicLoader_Loader_Vtbl
=
{
IDirectMusicLoaderImpl_IDirectMusicLoader
_QueryInterface
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_AddRef
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_Release
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_GetObject
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_SetObject
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_SetSearchDirectory
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_ScanDirectory
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_CacheObject
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_ReleaseObject
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_ClearCache
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_EnableCache
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_EnumObject
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_CollectGarbage
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_ReleaseObjectByUnknown
,
IDirectMusicLoaderImpl_IDirectMusicLoader
_LoadObjectFromFile
IDirectMusicLoaderImpl
_QueryInterface
,
IDirectMusicLoaderImpl
_AddRef
,
IDirectMusicLoaderImpl
_Release
,
IDirectMusicLoaderImpl
_GetObject
,
IDirectMusicLoaderImpl
_SetObject
,
IDirectMusicLoaderImpl
_SetSearchDirectory
,
IDirectMusicLoaderImpl
_ScanDirectory
,
IDirectMusicLoaderImpl
_CacheObject
,
IDirectMusicLoaderImpl
_ReleaseObject
,
IDirectMusicLoaderImpl
_ClearCache
,
IDirectMusicLoaderImpl
_EnableCache
,
IDirectMusicLoaderImpl
_EnumObject
,
IDirectMusicLoaderImpl
_CollectGarbage
,
IDirectMusicLoaderImpl
_ReleaseObjectByUnknown
,
IDirectMusicLoaderImpl
_LoadObjectFromFile
};
/* help function for DMUSIC_SetDefaultDLS */
...
...
@@ -847,7 +871,8 @@ static HRESULT DMUSIC_GetDefaultGMPath (WCHAR wszPath[MAX_PATH]) {
}
/* for ClassFactory */
HRESULT
WINAPI
DMUSIC_CreateDirectMusicLoaderImpl
(
LPCGUID
lpcGUID
,
LPVOID
*
ppobj
,
LPUNKNOWN
pUnkOuter
)
{
HRESULT
WINAPI
DMUSIC_CreateDirectMusicLoaderImpl
(
const
GUID
*
lpcGUID
,
void
**
ppobj
,
IUnknown
*
pUnkOuter
)
{
IDirectMusicLoaderImpl
*
obj
;
DMUS_OBJECTDESC
Desc
;
LPWINE_LOADER_ENTRY
pDefaultDLSEntry
;
...
...
@@ -859,15 +884,15 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppob
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
obj
->
Loader
Vtbl
=
&
DirectMusicLoader_Loader_Vtbl
;
obj
->
dwRef
=
0
;
/* w
ill be inited with QueryInterface */
obj
->
IDirectMusicLoader8_iface
.
lp
Vtbl
=
&
DirectMusicLoader_Loader_Vtbl
;
obj
->
ref
=
0
;
/* W
ill be inited with QueryInterface */
/* init cache/alias list */
obj
->
pObjects
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
list
));
list_init
(
obj
->
pObjects
);
/* init settings */
obj
->
pClassSettings
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
list
));
list_init
(
obj
->
pClassSettings
);
DMUSIC_InitLoaderSettings
((
LPDIRECTMUSICLOADER8
)
obj
);
DMUSIC_InitLoaderSettings
(
&
obj
->
IDirectMusicLoader8_iface
);
/* set default DLS collection (via SetObject... so that loading via DMUS_OBJ_OBJECT is possible) */
DM_STRUCT_INIT
(
&
Desc
);
...
...
@@ -875,7 +900,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppob
Desc
.
guidClass
=
CLSID_DirectMusicCollection
;
Desc
.
guidObject
=
GUID_DefaultGMCollection
;
DMUSIC_GetDefaultGMPath
(
Desc
.
wszFileName
);
IDirectMusicLoader_SetObject
((
LPDIRECTMUSICLOADER8
)
obj
,
&
Desc
);
IDirectMusicLoader_SetObject
(
&
obj
->
IDirectMusicLoader8_iface
,
&
Desc
);
/* and now the workaroundTM for "invalid" default DLS; basically,
my tests showed that if GUID chunk is present in default DLS
collection, loader treats it as "invalid" and returns
...
...
@@ -889,12 +914,13 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppob
lock_module
();
return
IDirectMusicLoader
Impl_IDirectMusicLoader_QueryInterface
((
LPDIRECTMUSICLOADER8
)
obj
,
lpcGUID
,
ppobj
);
return
IDirectMusicLoader
_QueryInterface
(
&
obj
->
IDirectMusicLoader8_iface
,
lpcGUID
,
ppobj
);
}
/* help function for retrieval of search path and caching option for certain class */
static
HRESULT
DMUSIC_GetLoaderSettings
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
pClassID
,
WCHAR
*
wszSearchPath
,
LPBOOL
pbCache
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
static
HRESULT
DMUSIC_GetLoaderSettings
(
IDirectMusicLoader8
*
iface
,
REFGUID
pClassID
,
WCHAR
*
wszSearchPath
,
BOOL
*
pbCache
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
struct
list
*
pEntry
;
TRACE
(
": (%p, %s, %p, %p)
\n
"
,
This
,
debugstr_dmguid
(
pClassID
),
wszSearchPath
,
pbCache
);
...
...
@@ -912,8 +938,9 @@ static HRESULT DMUSIC_GetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pCl
}
/* help function for setting search path and caching option for certain class */
static
HRESULT
DMUSIC_SetLoaderSettings
(
LPDIRECTMUSICLOADER8
iface
,
REFGUID
pClassID
,
WCHAR
*
wszSearchPath
,
LPBOOL
pbCache
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
static
HRESULT
DMUSIC_SetLoaderSettings
(
IDirectMusicLoader8
*
iface
,
REFGUID
pClassID
,
WCHAR
*
wszSearchPath
,
BOOL
*
pbCache
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
struct
list
*
pEntry
;
HRESULT
result
=
S_FALSE
;
/* in case pClassID != GUID_DirectMusicAllTypes and not a valid CLSID */
TRACE
(
": (%p, %s, %p, %p)
\n
"
,
This
,
debugstr_dmguid
(
pClassID
),
wszSearchPath
,
pbCache
);
...
...
@@ -935,9 +962,10 @@ static HRESULT DMUSIC_SetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pCl
return
result
;
}
static
HRESULT
DMUSIC_InitLoaderSettings
(
LPDIRECTMUSICLOADER8
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicLoaderImpl
,
LoaderVtbl
,
iface
);
static
HRESULT
DMUSIC_InitLoaderSettings
(
IDirectMusicLoader8
*
iface
)
{
IDirectMusicLoaderImpl
*
This
=
impl_from_IDirectMusicLoader8
(
iface
);
/* hard-coded list of classes */
static
REFCLSID
classes
[]
=
{
&
CLSID_DirectMusicAudioPathConfig
,
...
...
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