[AMSTREAM]

* Sync to Wine 1.3.37.

svn path=/trunk/; revision=55199
This commit is contained in:
Amine Khaldi 2012-01-26 15:03:30 +00:00
parent 3abad07395
commit 20becb4a6e
13 changed files with 240 additions and 764 deletions

View file

@ -6,6 +6,7 @@ add_definitions(-D_WIN32_WINNT=0x600)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
set_rc_compiler()
spec2def(amstream.dll amstream.spec)
add_library(amstream SHARED
@ -13,24 +14,11 @@ add_library(amstream SHARED
main.c
mediastream.c
mediastreamfilter.c
regsvr.c
amstream_i.c
version.rc
${CMAKE_CURRENT_BINARY_DIR}/amstream.def)
set_module_type(amstream win32dll)
target_link_libraries(amstream
strmiids
uuid
wine)
add_importlibs(amstream
ole32
advapi32
msvcrt
kernel32
ntdll)
target_link_libraries(amstream strmiids uuid wine)
add_importlibs(amstream ole32 advapi32 msvcrt kernel32 ntdll)
add_dependencies(amstream dxsdk)
add_cd_file(TARGET amstream DESTINATION reactos/system32 FOR all)

View file

@ -4,9 +4,6 @@
* Copyright 2004 Christian Costa
* Copyright 2006 Ivan Leo Puoti
*
* This file contains the (internal) driver registration functions,
* driver enumeration APIs and DirectDraw creation functions.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@ -35,7 +32,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
typedef struct {
const IAMMultiMediaStreamVtbl *lpVtbl;
IAMMultiMediaStream IAMMultiMediaStream_iface;
LONG ref;
IGraphBuilder* pFilterGraph;
IPin* ipin;
@ -45,6 +42,11 @@ typedef struct {
STREAM_TYPE StreamType;
} IAMMultiMediaStreamImpl;
static inline IAMMultiMediaStreamImpl *impl_from_IAMMultiMediaStream(IAMMultiMediaStream *iface)
{
return CONTAINING_RECORD(iface, IAMMultiMediaStreamImpl, IAMMultiMediaStream_iface);
}
static const struct IAMMultiMediaStreamVtbl AM_Vtbl;
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj)
@ -63,7 +65,7 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj)
return E_OUTOFMEMORY;
}
object->lpVtbl = &AM_Vtbl;
object->IAMMultiMediaStream_iface.lpVtbl = &AM_Vtbl;
object->ref = 1;
*ppObj = object;
@ -74,14 +76,15 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj)
/*** IUnknown methods ***/
static HRESULT WINAPI IAMMultiMediaStreamImpl_QueryInterface(IAMMultiMediaStream* iface, REFIID riid, void** ppvObject)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IMultiMediaStream) ||
IsEqualGUID(riid, &IID_IAMMultiMediaStream))
{
IClassFactory_AddRef(iface);
IUnknown_AddRef(iface);
*ppvObject = This;
return S_OK;
}
@ -93,7 +96,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_QueryInterface(IAMMultiMediaStream
static ULONG WINAPI IAMMultiMediaStreamImpl_AddRef(IAMMultiMediaStream* iface)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
TRACE("(%p/%p)\n", iface, This);
@ -102,7 +105,7 @@ static ULONG WINAPI IAMMultiMediaStreamImpl_AddRef(IAMMultiMediaStream* iface)
static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)\n", iface, This);
@ -116,7 +119,7 @@ static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface)
/*** IMultiMediaStream methods ***/
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetInformation(IAMMultiMediaStream* iface, DWORD* pdwFlags, STREAM_TYPE* pStreamType)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pdwFlags, pStreamType);
@ -125,7 +128,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetInformation(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream* iface, REFMSPID idPurpose, IMediaStream** ppMediaStream)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
MSPID PurposeId;
unsigned int i;
@ -147,7 +150,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_EnumMediaStreams(IAMMultiMediaStream* iface, LONG Index, IMediaStream** ppMediaStream)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%d,%p) stub!\n", This, iface, Index, ppMediaStream);
@ -156,7 +159,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_EnumMediaStreams(IAMMultiMediaStre
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetState(IAMMultiMediaStream* iface, STREAM_STATE* pCurrentState)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentState);
@ -165,7 +168,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetState(IAMMultiMediaStream* ifac
static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* iface, STREAM_STATE NewState)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->() stub!\n", This, iface);
@ -174,7 +177,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* ifac
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetTime(IAMMultiMediaStream* iface, STREAM_TIME* pCurrentTime)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentTime);
@ -183,7 +186,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetTime(IAMMultiMediaStream* iface
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetDuration(IAMMultiMediaStream* iface, STREAM_TIME* pDuration)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDuration);
@ -192,7 +195,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetDuration(IAMMultiMediaStream* i
static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface, STREAM_TIME SeekTime)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->() stub!\n", This, iface);
@ -201,7 +204,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface, S
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream* iface, HANDLE* phEOS)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, phEOS);
@ -211,7 +214,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream
/*** IAMMultiMediaStream methods ***/
static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* iface, STREAM_TYPE StreamType, DWORD dwFlags, IGraphBuilder* pFilterGraph)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
HRESULT hr = S_OK;
TRACE("(%p/%p)->(%x,%x,%p)\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph);
@ -236,7 +239,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream* iface, IGraphBuilder** ppGraphBuilder)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, ppGraphBuilder);
@ -253,7 +256,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppFilter);
@ -263,29 +266,22 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* ifa
static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream* iface, IUnknown* pStreamObject, const MSPID* PurposeId,
DWORD dwFlags, IMediaStream** ppNewStream)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
HRESULT hr;
IMediaStream* pStream;
IMediaStream** pNewStreams;
FIXME("(%p/%p)->(%p,%s,%x,%p) partial stub!\n", This, iface, pStreamObject, debugstr_guid(PurposeId), dwFlags, ppNewStream);
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
hr = DirectDrawMediaStream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
else
hr = MediaStream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
hr = mediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
if (SUCCEEDED(hr))
{
pNewStreams = CoTaskMemAlloc((This->nbStreams+1)*sizeof(IMediaStream*));
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IMediaStream*));
if (!pNewStreams)
{
IMediaStream_Release(pStream);
return E_OUTOFMEMORY;
}
if (This->nbStreams)
CopyMemory(pNewStreams, This->pStreams, This->nbStreams*sizeof(IMediaStream*));
CoTaskMemFree(This->pStreams);
This->pStreams = pNewStreams;
This->pStreams[This->nbStreams] = pStream;
This->nbStreams++;
@ -300,7 +296,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR pszFileName, DWORD dwFlags)
{
HRESULT ret;
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
IFileSourceFilter *SourceFilter;
IBaseFilter *BaseFilter;
IEnumPins *EnumPins;
@ -373,7 +369,7 @@ end:
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenMoniker(IAMMultiMediaStream* iface, IBindCtx* pCtx, IMoniker* pMoniker, DWORD dwFlags)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p,%p,%x) stub!\n", This, iface, pCtx, pMoniker, dwFlags);
@ -382,7 +378,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenMoniker(IAMMultiMediaStream* i
static HRESULT WINAPI IAMMultiMediaStreamImpl_Render(IAMMultiMediaStream* iface, DWORD dwFlags)
{
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%x) partial stub!\n", This, iface, dwFlags);

View file

@ -9,8 +9,6 @@
<file>main.c</file>
<file>mediastream.c</file>
<file>mediastreamfilter.c</file>
<file>regsvr.c</file>
<file>amstream_i.c</file>
<file>version.rc</file>
<library>wine</library>
<library>strmiids</library>

View file

@ -0,0 +1,21 @@
HKCR
{
NoRemove Interface
{
}
NoRemove CLSID
{
'{49C47CE0-9BA4-11D0-8212-00C04FC32C45}' = s 'SFilter Class'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
}
'{49C47CE4-9BA4-11D0-8212-00C04FC32C45}' = s 'Stream Class'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
}
'{49C47CE5-9BA4-11D0-8212-00C04FC32C45}' = s 'MMStream Class'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
}
}
}

View file

@ -0,0 +1,40 @@
/*
* COM Classes for amstream
*
* Copyright 2010 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
[
helpstring("SFilter Class"),
threading(both),
uuid(49c47ce0-9ba4-11d0-8212-00c04fc32c45)
]
coclass MediaStreamFilter { interface IMediaStreamFilter; }
[
helpstring("Stream Class"),
threading(both),
uuid(49c47ce4-9ba4-11d0-8212-00c04fc32c45)
]
coclass AMDirectDrawStream { interface IAMMultiMediaStream; }
[
helpstring("MMStream Class"),
threading(both),
uuid(49c47ce5-9ba4-11d0-8212-00c04fc32c45)
]
coclass AMMultiMediaStream { interface IAMMultiMediaStream; }

View file

@ -1,14 +0,0 @@
#include <rpc.h>
#include <rpcndr.h>
#include <initguid.h>
#ifdef __cplusplus
extern "C" {
#endif
DEFINE_GUID(CLSID_MediaStreamFilter, 0x49c47ce0, 0x9ba4, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);
#ifdef __cplusplus
}
#endif

View file

@ -3,9 +3,6 @@
*
* Copyright 2004 Christian Costa
*
* This file contains the (internal) driver registration functions,
* driver enumeration APIs and DirectDraw creation functions.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@ -34,9 +31,9 @@
#include "dshow.h"
#include "mmstream.h"
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj);
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj);
HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream);
HRESULT DirectDrawMediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream);
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT mediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
STREAM_TYPE StreamType, IMediaStream **ppMediaStream) DECLSPEC_HIDDEN;
#endif /* __AMSTREAM_PRIVATE_INCLUDED__ */

View file

@ -3,9 +3,6 @@
*
* Copyright 2004 Christian Costa
*
* This file contains the (internal) driver registration functions,
* driver enumeration APIs and DirectDraw creation functions.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@ -32,6 +29,7 @@
#include "winerror.h"
#include "ole2.h"
#include "rpcproxy.h"
#include "amstream_private.h"
#include "amstream.h"
@ -40,6 +38,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
static HINSTANCE instance;
static DWORD dll_ref = 0;
/* For the moment, do nothing here. */
@ -47,6 +46,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
instance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL);
break;
case DLL_PROCESS_DETACH:
@ -207,3 +207,19 @@ HRESULT WINAPI DllCanUnloadNow(void)
{
return dll_ref != 0 ? S_FALSE : S_OK;
}
/***********************************************************************
* DllRegisterServer (AMSTREAM.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( instance );
}
/***********************************************************************
* DllUnregisterServer (AMSTREAM.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( instance );
}

View file

@ -3,9 +3,6 @@
*
* Copyright 2005, 2008 Christian Costa
*
* This file contains the (internal) driver registration functions,
* driver enumeration APIs and DirectDraw creation functions.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@ -36,104 +33,75 @@
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
typedef struct {
const IMediaStreamVtbl *lpVtbl;
LONG ref;
IMultiMediaStream* Parent;
MSPID PurposeId;
STREAM_TYPE StreamType;
} IMediaStreamImpl;
typedef struct {
const IDirectDrawMediaStreamVtbl *lpVtbl;
IDirectDrawMediaStream IDirectDrawMediaStream_iface;
LONG ref;
IMultiMediaStream* Parent;
MSPID PurposeId;
STREAM_TYPE StreamType;
} IDirectDrawMediaStreamImpl;
static const struct IMediaStreamVtbl MediaStream_Vtbl;
static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStream_Vtbl;
HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream)
static inline IDirectDrawMediaStreamImpl *impl_from_IDirectDrawMediaStream(IDirectDrawMediaStream *iface)
{
IMediaStreamImpl* object;
TRACE("(%p,%s,%p)\n", Parent, debugstr_guid(pPurposeId), ppMediaStream);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
object->lpVtbl = &MediaStream_Vtbl;
object->ref = 1;
object->Parent = Parent;
object->PurposeId = *pPurposeId;
object->StreamType = StreamType;
*ppMediaStream = (IMediaStream*)object;
return S_OK;
return CONTAINING_RECORD(iface, IDirectDrawMediaStreamImpl, IDirectDrawMediaStream_iface);
}
/*** IUnknown methods ***/
static HRESULT WINAPI IMediaStreamImpl_QueryInterface(IMediaStream* iface, REFIID riid, void** ppvObject)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_QueryInterface(IDirectDrawMediaStream *iface,
REFIID riid, void **ppv)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppv);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IMediaStream))
IsEqualGUID(riid, &IID_IMediaStream) ||
IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
{
IClassFactory_AddRef(iface);
*ppvObject = This;
return S_OK;
IUnknown_AddRef(iface);
*ppv = This;
return S_OK;
}
ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
static ULONG WINAPI IMediaStreamImpl_AddRef(IMediaStream* iface)
static ULONG WINAPI IDirectDrawMediaStreamImpl_AddRef(IDirectDrawMediaStream *iface)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
TRACE("(%p/%p)\n", iface, This);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI IMediaStreamImpl_Release(IMediaStream* iface)
static ULONG WINAPI IDirectDrawMediaStreamImpl_Release(IDirectDrawMediaStream *iface)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)\n", iface, This);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
/*** IMediaStream methods ***/
static HRESULT WINAPI IMediaStreamImpl_GetMultiMediaStream(IMediaStream* iface, IMultiMediaStream** ppMultiMediaStream)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetMultiMediaStream(IDirectDrawMediaStream *iface,
IMultiMediaStream** ppMultiMediaStream)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppMultiMediaStream);
return S_FALSE;
}
static HRESULT WINAPI IMediaStreamImpl_GetInformation(IMediaStream* iface, MSPID* pPurposeId, STREAM_TYPE* pType)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetInformation(IDirectDrawMediaStream *iface,
MSPID *pPurposeId, STREAM_TYPE *pType)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, pPurposeId, pType);
@ -145,163 +113,109 @@ static HRESULT WINAPI IMediaStreamImpl_GetInformation(IMediaStream* iface, MSPID
return S_OK;
}
static HRESULT WINAPI IMediaStreamImpl_SetSameFormat(IMediaStream* iface, IMediaStream* pStreamThatHasDesiredFormat, DWORD dwFlags)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetSameFormat(IDirectDrawMediaStream *iface,
IMediaStream *pStreamThatHasDesiredFormat, DWORD dwFlags)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, dwFlags);
return S_FALSE;
}
static HRESULT WINAPI IMediaStreamImpl_AllocateSample(IMediaStream* iface, DWORD dwFlags, IStreamSample** ppSample)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_AllocateSample(IDirectDrawMediaStream *iface,
DWORD dwFlags, IStreamSample **ppSample)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, dwFlags, ppSample);
return S_FALSE;
}
static HRESULT WINAPI IMediaStreamImpl_CreateSharedSample(IMediaStream* iface, IStreamSample* pExistingSample, DWORD dwFlags, IStreamSample** ppSample)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_CreateSharedSample(IDirectDrawMediaStream *iface,
IStreamSample *pExistingSample, DWORD dwFlags, IStreamSample **ppSample)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, pExistingSample, dwFlags, ppSample);
return S_FALSE;
}
static HRESULT WINAPI IMediaStreamImpl_SendEndOfStream(IMediaStream* iface, DWORD dwFlags)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SendEndOfStream(IDirectDrawMediaStream *iface,
DWORD dwFlags)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%x) stub!\n", This, iface, dwFlags);
return S_FALSE;
}
static const struct IMediaStreamVtbl MediaStream_Vtbl =
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetFormat(IDirectDrawMediaStream *iface,
DDSURFACEDESC *pDDSDCurrent, IDirectDrawPalette **ppDirectDrawPalette,
DDSURFACEDESC *pDDSDDesired, DWORD *pdwFlags)
{
IMediaStreamImpl_QueryInterface,
IMediaStreamImpl_AddRef,
IMediaStreamImpl_Release,
IMediaStreamImpl_GetMultiMediaStream,
IMediaStreamImpl_GetInformation,
IMediaStreamImpl_SetSameFormat,
IMediaStreamImpl_AllocateSample,
IMediaStreamImpl_CreateSharedSample,
IMediaStreamImpl_SendEndOfStream
};
HRESULT DirectDrawMediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream)
{
IDirectDrawMediaStreamImpl* object;
TRACE("(%p,%s,%p)\n", Parent, debugstr_guid(pPurposeId), ppMediaStream);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
object->lpVtbl = &DirectDrawMediaStream_Vtbl;
object->ref = 1;
object->Parent = Parent;
object->PurposeId = *pPurposeId;
object->StreamType = StreamType;
*ppMediaStream = (IMediaStream*)object;
return S_OK;
}
static HRESULT WINAPI IDirectDrawMediaStreamImpl_QueryInterface(IDirectDrawMediaStream* iface, REFIID riid, void** ppvObject)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IMediaStream) ||
IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
{
IClassFactory_AddRef(iface);
*ppvObject = This;
return S_OK;
}
ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
return E_NOINTERFACE;
}
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetFormat(IDirectDrawMediaStream* iface, DDSURFACEDESC *pDDSDCurrent,
IDirectDrawPalette **ppDirectDrawPalette, DDSURFACEDESC *pDDSDDesired, DWORD *pdwFlags)
{
FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, pDDSDCurrent, ppDirectDrawPalette, pDDSDDesired, pdwFlags);
FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, pDDSDCurrent, ppDirectDrawPalette, pDDSDDesired,
pdwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetFormat(IDirectDrawMediaStream* iface, const DDSURFACEDESC *pDDSurfaceDesc,
IDirectDrawPalette *pDirectDrawPalette)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetFormat(IDirectDrawMediaStream *iface,
const DDSURFACEDESC *pDDSurfaceDesc, IDirectDrawPalette *pDirectDrawPalette)
{
FIXME("(%p)->(%p,%p) stub!\n", iface, pDDSurfaceDesc, pDirectDrawPalette);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetDirectDraw(IDirectDrawMediaStream* iface, IDirectDraw **ppDirectDraw)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetDirectDraw(IDirectDrawMediaStream *iface,
IDirectDraw **ppDirectDraw)
{
FIXME("(%p)->(%p) stub!\n", iface, ppDirectDraw);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetDirectDraw(IDirectDrawMediaStream* iface, IDirectDraw *pDirectDraw)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetDirectDraw(IDirectDrawMediaStream *iface,
IDirectDraw *pDirectDraw)
{
FIXME("(%p)->(%p) stub!\n", iface, pDirectDraw);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectDrawMediaStreamImpl_CreateSample(IDirectDrawMediaStream* iface, IDirectDrawSurface *pSurface, const RECT *pRect,
DWORD dwFlags, IDirectDrawStreamSample **ppSample)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_CreateSample(IDirectDrawMediaStream *iface,
IDirectDrawSurface *pSurface, const RECT *pRect, DWORD dwFlags,
IDirectDrawStreamSample **ppSample)
{
FIXME("(%p)->(%p,%p,%x,%p) stub!\n", iface, pSurface, pRect, dwFlags, ppSample);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetTimePerFrame(IDirectDrawMediaStream* iface, STREAM_TIME *pFrameTime)
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetTimePerFrame(IDirectDrawMediaStream *iface,
STREAM_TIME *pFrameTime)
{
FIXME("(%p)->(%p) stub!\n", iface, pFrameTime);
return E_NOTIMPL;
}
/* Note: Hack so we can reuse the old functions without compiler warnings */
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(DirectDrawMediaStream_Vtbl.fun))
#else
# define XCAST(fun) (void*)
#endif
static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStream_Vtbl =
{
IDirectDrawMediaStreamImpl_QueryInterface,
XCAST(AddRef)IMediaStreamImpl_AddRef,
XCAST(Release)IMediaStreamImpl_Release,
XCAST(GetMultiMediaStream)IMediaStreamImpl_GetMultiMediaStream,
XCAST(GetInformation)IMediaStreamImpl_GetInformation,
XCAST(SetSameFormat)IMediaStreamImpl_SetSameFormat,
XCAST(AllocateSample)IMediaStreamImpl_AllocateSample,
XCAST(CreateSharedSample)IMediaStreamImpl_CreateSharedSample,
XCAST(SendEndOfStream)IMediaStreamImpl_SendEndOfStream,
IDirectDrawMediaStreamImpl_AddRef,
IDirectDrawMediaStreamImpl_Release,
IDirectDrawMediaStreamImpl_GetMultiMediaStream,
IDirectDrawMediaStreamImpl_GetInformation,
IDirectDrawMediaStreamImpl_SetSameFormat,
IDirectDrawMediaStreamImpl_AllocateSample,
IDirectDrawMediaStreamImpl_CreateSharedSample,
IDirectDrawMediaStreamImpl_SendEndOfStream,
IDirectDrawMediaStreamImpl_GetFormat,
IDirectDrawMediaStreamImpl_SetFormat,
IDirectDrawMediaStreamImpl_GetDirectDraw,
@ -309,4 +223,29 @@ static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStream_Vtbl =
IDirectDrawMediaStreamImpl_CreateSample,
IDirectDrawMediaStreamImpl_GetTimePerFrame
};
#undef XCAST
HRESULT mediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
STREAM_TYPE StreamType, IMediaStream **ppMediaStream)
{
IDirectDrawMediaStreamImpl *object;
TRACE("(%p,%s,%p)\n", Parent, debugstr_guid(pPurposeId), ppMediaStream);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawMediaStreamImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStream_Vtbl;
object->ref = 1;
object->Parent = Parent;
object->PurposeId = *pPurposeId;
object->StreamType = StreamType;
*ppMediaStream = (IMediaStream*)&object->IDirectDrawMediaStream_iface;
return S_OK;
}

View file

@ -3,9 +3,6 @@
*
* Copyright 2008 Christian Costa
*
* This file contains the (internal) driver registration functions,
* driver enumeration APIs and DirectDraw creation functions.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@ -36,7 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
typedef struct {
const IMediaStreamFilterVtbl *lpVtbl;
IMediaStreamFilter IMediaStreamFilter_iface;
LONG ref;
CRITICAL_SECTION csFilter;
FILTER_STATE state;
@ -45,37 +42,17 @@ typedef struct {
FILTER_INFO filterInfo;
} IMediaStreamFilterImpl;
static const struct IMediaStreamFilterVtbl MediaStreamFilter_Vtbl;
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj)
static inline IMediaStreamFilterImpl *impl_from_IMediaStreamFilter(IMediaStreamFilter *iface)
{
IMediaStreamFilterImpl* object;
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
if( pUnkOuter )
return CLASS_E_NOAGGREGATION;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamFilterImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
object->lpVtbl = &MediaStreamFilter_Vtbl;
object->ref = 1;
*ppObj = object;
return S_OK;
return CONTAINING_RECORD(iface, IMediaStreamFilterImpl, IMediaStreamFilter_iface);
}
/*** IUnknown methods ***/
static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter * iface, REFIID riid, LPVOID * ppv)
static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *iface, REFIID riid,
void **ppv)
{
IMediaStreamFilterImpl *This = (IMediaStreamFilterImpl *)iface;
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
@ -101,9 +78,9 @@ static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *
return E_NOINTERFACE;
}
static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter * iface)
static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter *iface)
{
IMediaStreamFilterImpl *This = (IMediaStreamFilterImpl *)iface;
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->() AddRef from %d\n", iface, refCount - 1);
@ -111,18 +88,15 @@ static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter * iface)
return refCount;
}
static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter * iface)
static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter *iface)
{
IMediaStreamFilterImpl *This = (IMediaStreamFilterImpl *)iface;
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
if (!refCount)
{
This->lpVtbl = NULL;
HeapFree(GetProcessHeap(), 0, This);
}
return refCount;
}
@ -311,3 +285,27 @@ static const IMediaStreamFilterVtbl MediaStreamFilter_Vtbl =
MediaStreamFilterImpl_Flush,
MediaStreamFilterImpl_EndOfStream
};
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, void **ppObj)
{
IMediaStreamFilterImpl* object;
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
if( pUnkOuter )
return CLASS_E_NOAGGREGATION;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamFilterImpl));
if (!object)
{
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
object->IMediaStreamFilter_iface.lpVtbl = &MediaStreamFilter_Vtbl;
object->ref = 1;
*ppObj = object;
return S_OK;
}

View file

@ -1,505 +0,0 @@
/*
* self-registerable dll functions for amstream.dll
*
* Copyright (C) 2003 John K. Hohm
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "winreg.h"
#include "winerror.h"
#include "ole2.h"
#include "amstream.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
/*
* Near the bottom of this file are the exported DllRegisterServer and
* DllUnregisterServer, which make all this worthwhile.
*/
/***********************************************************************
* interface for self-registering
*/
struct regsvr_interface
{
IID const *iid; /* NULL for end of list */
LPCSTR name; /* can be NULL to omit */
IID const *base_iid; /* can be NULL to omit */
int num_methods; /* can be <0 to omit */
CLSID const *ps_clsid; /* can be NULL to omit */
CLSID const *ps_clsid32; /* can be NULL to omit */
};
static HRESULT register_interfaces(struct regsvr_interface const *list);
static HRESULT unregister_interfaces(struct regsvr_interface const *list);
struct regsvr_coclass
{
CLSID const *clsid; /* NULL for end of list */
LPCSTR name; /* can be NULL to omit */
LPCSTR ips; /* can be NULL to omit */
LPCSTR ips32; /* can be NULL to omit */
LPCSTR ips32_tmodel; /* can be NULL to omit */
LPCSTR progid; /* can be NULL to omit */
LPCSTR viprogid; /* can be NULL to omit */
LPCSTR progid_extra; /* can be NULL to omit */
};
static HRESULT register_coclasses(struct regsvr_coclass const *list);
static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
/***********************************************************************
* static string constants
*/
static WCHAR const interface_keyname[10] = {
'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
static WCHAR const base_ifa_keyname[14] = {
'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
'e', 0 };
static WCHAR const num_methods_keyname[11] = {
'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
static WCHAR const ps_clsid_keyname[15] = {
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
'i', 'd', 0 };
static WCHAR const ps_clsid32_keyname[17] = {
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
'i', 'd', '3', '2', 0 };
static WCHAR const clsid_keyname[6] = {
'C', 'L', 'S', 'I', 'D', 0 };
static WCHAR const curver_keyname[7] = {
'C', 'u', 'r', 'V', 'e', 'r', 0 };
static WCHAR const ips_keyname[13] = {
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
0 };
static WCHAR const ips32_keyname[15] = {
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
'3', '2', 0 };
static WCHAR const progid_keyname[7] = {
'P', 'r', 'o', 'g', 'I', 'D', 0 };
static WCHAR const viprogid_keyname[25] = {
'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p',
'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D',
0 };
static char const tmodel_valuename[] = "ThreadingModel";
/***********************************************************************
* static helper functions
*/
static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
WCHAR const *value);
static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
char const *value);
static LONG register_progid(WCHAR const *clsid,
char const *progid, char const *curver_progid,
char const *name, char const *extra);
/***********************************************************************
* register_interfaces
*/
static HRESULT register_interfaces(struct regsvr_interface const *list)
{
LONG res = ERROR_SUCCESS;
HKEY interface_key;
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
if (res != ERROR_SUCCESS) goto error_return;
for (; res == ERROR_SUCCESS && list->iid; ++list) {
WCHAR buf[39];
HKEY iid_key;
StringFromGUID2(list->iid, buf, 39);
res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
if (res != ERROR_SUCCESS) goto error_close_interface_key;
if (list->name) {
res = RegSetValueExA(iid_key, NULL, 0, REG_SZ,
(CONST BYTE*)(list->name),
strlen(list->name) + 1);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
if (list->base_iid) {
res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
if (0 <= list->num_methods) {
static WCHAR const fmt[3] = { '%', 'd', 0 };
HKEY key;
res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &key, NULL);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
sprintfW(buf, fmt, list->num_methods);
res = RegSetValueExW(key, NULL, 0, REG_SZ,
(CONST BYTE*)buf,
(lstrlenW(buf) + 1) * sizeof(WCHAR));
RegCloseKey(key);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
if (list->ps_clsid) {
res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
if (list->ps_clsid32) {
res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
error_close_iid_key:
RegCloseKey(iid_key);
}
error_close_interface_key:
RegCloseKey(interface_key);
error_return:
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
/***********************************************************************
* unregister_interfaces
*/
static HRESULT unregister_interfaces(struct regsvr_interface const *list)
{
LONG res = ERROR_SUCCESS;
HKEY interface_key;
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
KEY_READ | KEY_WRITE, &interface_key);
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
if (res != ERROR_SUCCESS) goto error_return;
for (; res == ERROR_SUCCESS && list->iid; ++list) {
WCHAR buf[39];
StringFromGUID2(list->iid, buf, 39);
res = RegDeleteTreeW(interface_key, buf);
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
}
RegCloseKey(interface_key);
error_return:
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
/***********************************************************************
* register_coclasses
*/
static HRESULT register_coclasses(struct regsvr_coclass const *list)
{
LONG res = ERROR_SUCCESS;
HKEY coclass_key;
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
if (res != ERROR_SUCCESS) goto error_return;
for (; res == ERROR_SUCCESS && list->clsid; ++list) {
WCHAR buf[39];
HKEY clsid_key;
StringFromGUID2(list->clsid, buf, 39);
res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
if (list->name) {
res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
(CONST BYTE*)(list->name),
strlen(list->name) + 1);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
if (list->ips) {
res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
if (list->ips32) {
HKEY ips32_key;
res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL,
&ips32_key, NULL);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
(CONST BYTE*)list->ips32,
lstrlenA(list->ips32) + 1);
if (res == ERROR_SUCCESS && list->ips32_tmodel)
res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
(CONST BYTE*)list->ips32_tmodel,
strlen(list->ips32_tmodel) + 1);
RegCloseKey(ips32_key);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
if (list->progid) {
res = register_key_defvalueA(clsid_key, progid_keyname,
list->progid);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
res = register_progid(buf, list->progid, NULL,
list->name, list->progid_extra);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
if (list->viprogid) {
res = register_key_defvalueA(clsid_key, viprogid_keyname,
list->viprogid);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
res = register_progid(buf, list->viprogid, list->progid,
list->name, list->progid_extra);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
error_close_clsid_key:
RegCloseKey(clsid_key);
}
error_close_coclass_key:
RegCloseKey(coclass_key);
error_return:
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
/***********************************************************************
* unregister_coclasses
*/
static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
{
LONG res = ERROR_SUCCESS;
HKEY coclass_key;
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
KEY_READ | KEY_WRITE, &coclass_key);
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
if (res != ERROR_SUCCESS) goto error_return;
for (; res == ERROR_SUCCESS && list->clsid; ++list) {
WCHAR buf[39];
StringFromGUID2(list->clsid, buf, 39);
res = RegDeleteTreeW(coclass_key, buf);
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
if (list->progid) {
res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid);
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
}
if (list->viprogid) {
res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->viprogid);
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
}
}
error_close_coclass_key:
RegCloseKey(coclass_key);
error_return:
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
}
/***********************************************************************
* regsvr_key_guid
*/
static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid)
{
WCHAR buf[39];
StringFromGUID2(guid, buf, 39);
return register_key_defvalueW(base, name, buf);
}
/***********************************************************************
* regsvr_key_defvalueW
*/
static LONG register_key_defvalueW(
HKEY base,
WCHAR const *name,
WCHAR const *value)
{
LONG res;
HKEY key;
res = RegCreateKeyExW(base, name, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &key, NULL);
if (res != ERROR_SUCCESS) return res;
res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
(lstrlenW(value) + 1) * sizeof(WCHAR));
RegCloseKey(key);
return res;
}
/***********************************************************************
* regsvr_key_defvalueA
*/
static LONG register_key_defvalueA(
HKEY base,
WCHAR const *name,
char const *value)
{
LONG res;
HKEY key;
res = RegCreateKeyExW(base, name, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &key, NULL);
if (res != ERROR_SUCCESS) return res;
res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
lstrlenA(value) + 1);
RegCloseKey(key);
return res;
}
/***********************************************************************
* regsvr_progid
*/
static LONG register_progid(
WCHAR const *clsid,
char const *progid,
char const *curver_progid,
char const *name,
char const *extra)
{
LONG res;
HKEY progid_key;
res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0,
NULL, 0, KEY_READ | KEY_WRITE, NULL,
&progid_key, NULL);
if (res != ERROR_SUCCESS) return res;
if (name) {
res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
(CONST BYTE*)name, strlen(name) + 1);
if (res != ERROR_SUCCESS) goto error_close_progid_key;
}
if (clsid) {
res = register_key_defvalueW(progid_key, clsid_keyname, clsid);
if (res != ERROR_SUCCESS) goto error_close_progid_key;
}
if (curver_progid) {
res = register_key_defvalueA(progid_key, curver_keyname,
curver_progid);
if (res != ERROR_SUCCESS) goto error_close_progid_key;
}
if (extra) {
HKEY extra_key;
res = RegCreateKeyExA(progid_key, extra, 0,
NULL, 0, KEY_READ | KEY_WRITE, NULL,
&extra_key, NULL);
if (res == ERROR_SUCCESS)
RegCloseKey(extra_key);
}
error_close_progid_key:
RegCloseKey(progid_key);
return res;
}
/***********************************************************************
* coclass list
*/
static struct regsvr_coclass const coclass_list[] = {
{ &CLSID_AMMultiMediaStream,
"ActiveMovie MultiMedia Stream",
NULL,
"amstream.dll",
"Both"
},
{ &CLSID_AMDirectDrawStream,
"ActiveMovie MultiMedia Stream",
NULL,
"amstream.dll",
"Both"
},
{ &CLSID_MediaStreamFilter,
"SFilter Class",
NULL,
"amstream.dll",
"Both"
},
{ NULL } /* list terminator */
};
/***********************************************************************
* interface list
*/
static struct regsvr_interface const interface_list[] = {
{ NULL } /* list terminator */
};
/***********************************************************************
* DllRegisterServer (AMSTREAM.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
HRESULT hr;
TRACE("\n");
hr = register_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = register_interfaces(interface_list);
return hr;
}
/***********************************************************************
* DllUnregisterServer (AMSTREAM.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
HRESULT hr;
TRACE("\n");
hr = unregister_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = unregister_interfaces(interface_list);
return hr;
}

View file

@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
1 WINE_REGISTRY amstream.rgs
#define WINE_FILEDESCRIPTION_STR "Wine AMStream dll"
#define WINE_FILENAME_STR "amstream.dll"
#define WINE_FILEVERSION 6,5,1,900

View file

@ -30,7 +30,7 @@ reactos/tools/wrc # Synced to Wine-1.3.26
The following libraries are shared with Wine.
reactos/dll/directx/amstream # Autosync
reactos/dll/directx/amstream # Synced to Wine-1.3.37
reactos/dll/directx/dinput # Synced to Wine-20090208
reactos/dll/directx/dinput8 # Synced to Wine-20090208
reactos/dll/directx/dmusic # Synced to Wine-1_1_23