mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +00:00
- Replace stub msdmo on msdmo from Wine
svn path=/trunk/; revision=40207
This commit is contained in:
parent
9f3467c174
commit
c0212e7286
6 changed files with 1071 additions and 140 deletions
835
reactos/dll/directx/msdmo/dmoreg.c
Normal file
835
reactos/dll/directx/msdmo/dmoreg.c
Normal file
|
@ -0,0 +1,835 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2003 Michael Günnewig
|
||||||
|
* Copyright (C) 2003 CodeWeavers Inc. (Ulrich Czekalla)
|
||||||
|
*
|
||||||
|
* 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 "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winuser.h"
|
||||||
|
#include "winerror.h"
|
||||||
|
#include "winreg.h"
|
||||||
|
#include "objbase.h"
|
||||||
|
#include "wine/unicode.h"
|
||||||
|
#include "wine/debug.h"
|
||||||
|
#include "initguid.h"
|
||||||
|
#include "dmo.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
|
||||||
|
|
||||||
|
#define MSDMO_MAJOR_VERSION 6
|
||||||
|
|
||||||
|
static const WCHAR szDMORootKey[] =
|
||||||
|
{
|
||||||
|
'D','i','r','e','c','t','S','h','o','w','\\',
|
||||||
|
'M','e','d','i','a','O','b','j','e','c','t','s',0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR szDMOInputType[] =
|
||||||
|
{
|
||||||
|
'I','n','p','u','t','T','y','p','e','s',0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR szDMOOutputType[] =
|
||||||
|
{
|
||||||
|
'O','u','t','p','u','t','T','y','p','e','s',0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR szDMOKeyed[] =
|
||||||
|
{
|
||||||
|
'K','e','y','e','d',0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR szDMOCategories[] =
|
||||||
|
{
|
||||||
|
'C','a','t','e','g','o','r','i','e','s',0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR szGUIDFmt[] =
|
||||||
|
{
|
||||||
|
'%','0','8','X','-','%','0','4','X','-','%','0','4','X','-','%','0',
|
||||||
|
'2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2',
|
||||||
|
'X','%','0','2','X','%','0','2','X','%','0','2','X',0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR szCat3Fmt[] =
|
||||||
|
{
|
||||||
|
'%','s','\\','%','s','\\','%','s',0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR szCat2Fmt[] =
|
||||||
|
{
|
||||||
|
'%','s','\\','%','s',0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR szToGuidFmt[] =
|
||||||
|
{
|
||||||
|
'{','%','s','}',0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const IEnumDMOVtbl *lpVtbl;
|
||||||
|
LONG ref;
|
||||||
|
DWORD index;
|
||||||
|
const GUID* guidCategory;
|
||||||
|
DWORD dwFlags;
|
||||||
|
DWORD cInTypes;
|
||||||
|
DMO_PARTIAL_MEDIATYPE *pInTypes;
|
||||||
|
DWORD cOutTypes;
|
||||||
|
DMO_PARTIAL_MEDIATYPE *pOutTypes;
|
||||||
|
HKEY hkey;
|
||||||
|
} IEnumDMOImpl;
|
||||||
|
|
||||||
|
static HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO_PARTIAL_MEDIATYPE* types);
|
||||||
|
|
||||||
|
static const IEnumDMOVtbl edmovt;
|
||||||
|
|
||||||
|
static LPWSTR GUIDToString(LPWSTR lpwstr, REFGUID lpcguid)
|
||||||
|
{
|
||||||
|
wsprintfW(lpwstr, szGUIDFmt, lpcguid->Data1, lpcguid->Data2,
|
||||||
|
lpcguid->Data3, lpcguid->Data4[0], lpcguid->Data4[1],
|
||||||
|
lpcguid->Data4[2], lpcguid->Data4[3], lpcguid->Data4[4],
|
||||||
|
lpcguid->Data4[5], lpcguid->Data4[6], lpcguid->Data4[7]);
|
||||||
|
|
||||||
|
return lpwstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL IsMediaTypeEqual(const DMO_PARTIAL_MEDIATYPE* mt1, const DMO_PARTIAL_MEDIATYPE* mt2)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IsEqualCLSID(&mt1->type, &mt2->type) ||
|
||||||
|
IsEqualCLSID(&mt2->type, &GUID_NULL) ||
|
||||||
|
IsEqualCLSID(&mt1->type, &GUID_NULL)) &&
|
||||||
|
(IsEqualCLSID(&mt1->subtype, &mt2->subtype) ||
|
||||||
|
IsEqualCLSID(&mt2->subtype, &GUID_NULL) ||
|
||||||
|
IsEqualCLSID(&mt1->subtype, &GUID_NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT write_types(HKEY hkey, LPCWSTR name, const DMO_PARTIAL_MEDIATYPE* types, DWORD count)
|
||||||
|
{
|
||||||
|
HRESULT hres = S_OK;
|
||||||
|
if (MSDMO_MAJOR_VERSION > 5)
|
||||||
|
{
|
||||||
|
hres = RegSetValueExW(hkey, name, 0, REG_BINARY, (const BYTE*) types,
|
||||||
|
count* sizeof(DMO_PARTIAL_MEDIATYPE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HKEY skey1,skey2,skey3;
|
||||||
|
DWORD index = 0;
|
||||||
|
WCHAR szGuidKey[64];
|
||||||
|
|
||||||
|
hres = RegCreateKeyExW(hkey, name, 0, NULL, REG_OPTION_NON_VOLATILE,
|
||||||
|
KEY_WRITE, NULL, &skey1, NULL);
|
||||||
|
while (index < count)
|
||||||
|
{
|
||||||
|
GUIDToString(szGuidKey,&types[index].type);
|
||||||
|
hres = RegCreateKeyExW(skey1, szGuidKey, 0, NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &skey2, NULL);
|
||||||
|
GUIDToString(szGuidKey,&types[index].subtype);
|
||||||
|
hres = RegCreateKeyExW(skey2, szGuidKey, 0, NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &skey3, NULL);
|
||||||
|
RegCloseKey(skey3);
|
||||||
|
RegCloseKey(skey2);
|
||||||
|
index ++;
|
||||||
|
}
|
||||||
|
RegCloseKey(skey1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
* DMORegister (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Register a DirectX Media Object.
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI DMORegister(
|
||||||
|
LPCWSTR szName,
|
||||||
|
REFCLSID clsidDMO,
|
||||||
|
REFGUID guidCategory,
|
||||||
|
DWORD dwFlags,
|
||||||
|
DWORD cInTypes,
|
||||||
|
const DMO_PARTIAL_MEDIATYPE *pInTypes,
|
||||||
|
DWORD cOutTypes,
|
||||||
|
const DMO_PARTIAL_MEDIATYPE *pOutTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
WCHAR szguid[64];
|
||||||
|
HRESULT hres;
|
||||||
|
HKEY hrkey = 0;
|
||||||
|
HKEY hkey = 0;
|
||||||
|
HKEY hckey = 0;
|
||||||
|
HKEY hclskey = 0;
|
||||||
|
|
||||||
|
TRACE("%s\n", debugstr_w(szName));
|
||||||
|
|
||||||
|
hres = RegCreateKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hrkey, NULL);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
/* Create clsidDMO key under MediaObjects */
|
||||||
|
hres = RegCreateKeyExW(hrkey, GUIDToString(szguid, clsidDMO), 0, NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, NULL);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
/* Set default Name value */
|
||||||
|
hres = RegSetValueExW(hkey, NULL, 0, REG_SZ, (const BYTE*) szName,
|
||||||
|
(strlenW(szName) + 1) * sizeof(WCHAR));
|
||||||
|
|
||||||
|
/* Set InputTypes */
|
||||||
|
hres = write_types(hkey, szDMOInputType, pInTypes, cInTypes);
|
||||||
|
|
||||||
|
/* Set OutputTypes */
|
||||||
|
hres = write_types(hkey, szDMOOutputType, pOutTypes, cOutTypes);
|
||||||
|
|
||||||
|
if (dwFlags & DMO_REGISTERF_IS_KEYED)
|
||||||
|
{
|
||||||
|
/* Create Keyed key */
|
||||||
|
hres = RegCreateKeyExW(hkey, szDMOKeyed, 0, NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hckey, NULL);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
RegCloseKey(hckey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Register the category */
|
||||||
|
hres = RegCreateKeyExW(hrkey, szDMOCategories, 0, NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hckey, NULL);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
|
||||||
|
hres = RegCreateKeyExW(hckey, GUIDToString(szguid, guidCategory), 0, NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, NULL);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
hres = RegCreateKeyExW(hkey, GUIDToString(szguid, clsidDMO), 0, NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hclskey, NULL);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
lend:
|
||||||
|
if (hkey)
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
if (hckey)
|
||||||
|
RegCloseKey(hckey);
|
||||||
|
if (hclskey)
|
||||||
|
RegCloseKey(hclskey);
|
||||||
|
if (hrkey)
|
||||||
|
RegCloseKey(hrkey);
|
||||||
|
|
||||||
|
TRACE(" hresult=0x%08x\n", hres);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
* DMOUnregister (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Unregister a DirectX Media Object.
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI DMOUnregister(REFCLSID clsidDMO, REFGUID guidCategory)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
WCHAR szguid[64];
|
||||||
|
HKEY hrkey = 0;
|
||||||
|
HKEY hckey = 0;
|
||||||
|
|
||||||
|
GUIDToString(szguid, clsidDMO);
|
||||||
|
|
||||||
|
TRACE("%s %p\n", debugstr_w(szguid), guidCategory);
|
||||||
|
|
||||||
|
hres = RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_WRITE, &hrkey);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
hres = RegDeleteKeyW(hrkey, szguid);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
hres = RegOpenKeyExW(hrkey, szDMOCategories, 0, KEY_WRITE, &hckey);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
hres = RegDeleteKeyW(hckey, szguid);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
lend:
|
||||||
|
if (hckey)
|
||||||
|
RegCloseKey(hckey);
|
||||||
|
if (hrkey)
|
||||||
|
RegCloseKey(hrkey);
|
||||||
|
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
* DMOGetName (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Get DMP Name from the registry
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI DMOGetName(REFCLSID clsidDMO, WCHAR szName[])
|
||||||
|
{
|
||||||
|
WCHAR szguid[64];
|
||||||
|
HRESULT hres;
|
||||||
|
HKEY hrkey = 0;
|
||||||
|
HKEY hkey = 0;
|
||||||
|
static const INT max_name_len = 80;
|
||||||
|
DWORD count;
|
||||||
|
|
||||||
|
TRACE("%s\n", debugstr_guid(clsidDMO));
|
||||||
|
|
||||||
|
hres = RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey,
|
||||||
|
0, KEY_READ, &hrkey);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
hres = RegOpenKeyExW(hrkey, GUIDToString(szguid, clsidDMO),
|
||||||
|
0, KEY_READ, &hkey);
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
goto lend;
|
||||||
|
|
||||||
|
count = max_name_len * sizeof(WCHAR);
|
||||||
|
hres = RegQueryValueExW(hkey, NULL, NULL, NULL,
|
||||||
|
(LPBYTE) szName, &count);
|
||||||
|
|
||||||
|
TRACE(" szName=%s\n", debugstr_w(szName));
|
||||||
|
lend:
|
||||||
|
if (hkey)
|
||||||
|
RegCloseKey(hrkey);
|
||||||
|
if (hkey)
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* IEnumDMO_Destructor
|
||||||
|
*/
|
||||||
|
static BOOL IEnumDMO_Destructor(IEnumDMO* iface)
|
||||||
|
{
|
||||||
|
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
|
||||||
|
|
||||||
|
TRACE("%p\n", This);
|
||||||
|
|
||||||
|
if (This->hkey)
|
||||||
|
RegCloseKey(This->hkey);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, This->pInTypes);
|
||||||
|
HeapFree(GetProcessHeap(), 0, This->pOutTypes);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* IEnumDMO_Constructor
|
||||||
|
*/
|
||||||
|
static IEnumDMO * IEnumDMO_Constructor(
|
||||||
|
REFGUID guidCategory,
|
||||||
|
DWORD dwFlags,
|
||||||
|
DWORD cInTypes,
|
||||||
|
const DMO_PARTIAL_MEDIATYPE *pInTypes,
|
||||||
|
DWORD cOutTypes,
|
||||||
|
const DMO_PARTIAL_MEDIATYPE *pOutTypes)
|
||||||
|
{
|
||||||
|
UINT size;
|
||||||
|
IEnumDMOImpl* lpedmo;
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
lpedmo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumDMOImpl));
|
||||||
|
|
||||||
|
if (lpedmo)
|
||||||
|
{
|
||||||
|
lpedmo->ref = 1;
|
||||||
|
lpedmo->lpVtbl = &edmovt;
|
||||||
|
lpedmo->index = -1;
|
||||||
|
lpedmo->guidCategory = guidCategory;
|
||||||
|
lpedmo->dwFlags = dwFlags;
|
||||||
|
|
||||||
|
if (cInTypes > 0)
|
||||||
|
{
|
||||||
|
size = cInTypes * sizeof(DMO_PARTIAL_MEDIATYPE);
|
||||||
|
lpedmo->pInTypes = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
if (!lpedmo->pInTypes)
|
||||||
|
goto lerr;
|
||||||
|
memcpy(lpedmo->pInTypes, pInTypes, size);
|
||||||
|
lpedmo->cInTypes = cInTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cOutTypes > 0)
|
||||||
|
{
|
||||||
|
size = cOutTypes * sizeof(DMO_PARTIAL_MEDIATYPE);
|
||||||
|
lpedmo->pOutTypes = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
if (!lpedmo->pOutTypes)
|
||||||
|
goto lerr;
|
||||||
|
memcpy(lpedmo->pOutTypes, pOutTypes, size);
|
||||||
|
lpedmo->cOutTypes = cOutTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If not filtering by category enum from media objects root */
|
||||||
|
if (IsEqualGUID(guidCategory, &GUID_NULL))
|
||||||
|
{
|
||||||
|
if (ERROR_SUCCESS == RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey,
|
||||||
|
0, KEY_READ, &lpedmo->hkey))
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WCHAR szguid[64];
|
||||||
|
WCHAR szKey[MAX_PATH];
|
||||||
|
|
||||||
|
wsprintfW(szKey, szCat3Fmt, szDMORootKey, szDMOCategories,
|
||||||
|
GUIDToString(szguid, guidCategory));
|
||||||
|
if (ERROR_SUCCESS == RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey,
|
||||||
|
0, KEY_READ, &lpedmo->hkey))
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
lerr:
|
||||||
|
if(!ret)
|
||||||
|
{
|
||||||
|
IEnumDMO_Destructor((IEnumDMO*)lpedmo);
|
||||||
|
HeapFree(GetProcessHeap(),0,lpedmo);
|
||||||
|
lpedmo = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("returning %p\n", lpedmo);
|
||||||
|
|
||||||
|
return (IEnumDMO*)lpedmo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* IEnumDMO_fnAddRef
|
||||||
|
*/
|
||||||
|
static ULONG WINAPI IEnumDMO_fnAddRef(IEnumDMO * iface)
|
||||||
|
{
|
||||||
|
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
|
||||||
|
return InterlockedIncrement(&This->ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* EnumDMO_QueryInterface
|
||||||
|
*/
|
||||||
|
static HRESULT WINAPI IEnumDMO_fnQueryInterface(
|
||||||
|
IEnumDMO* iface,
|
||||||
|
REFIID riid,
|
||||||
|
LPVOID *ppvObj)
|
||||||
|
{
|
||||||
|
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
|
||||||
|
|
||||||
|
*ppvObj = NULL;
|
||||||
|
|
||||||
|
if(IsEqualIID(riid, &IID_IUnknown))
|
||||||
|
*ppvObj = This;
|
||||||
|
else if(IsEqualIID(riid, &IID_IEnumDMO))
|
||||||
|
*ppvObj = This;
|
||||||
|
|
||||||
|
if(*ppvObj)
|
||||||
|
{
|
||||||
|
IEnumDMO_fnAddRef(*ppvObj);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* IEnumDMO_fnRelease
|
||||||
|
*/
|
||||||
|
static ULONG WINAPI IEnumDMO_fnRelease(IEnumDMO * iface)
|
||||||
|
{
|
||||||
|
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
|
if (!refCount)
|
||||||
|
{
|
||||||
|
IEnumDMO_Destructor((IEnumDMO*)This);
|
||||||
|
HeapFree(GetProcessHeap(),0,This);
|
||||||
|
}
|
||||||
|
return refCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* IEnumDMO_fnNext
|
||||||
|
*/
|
||||||
|
static HRESULT WINAPI IEnumDMO_fnNext(
|
||||||
|
IEnumDMO * iface,
|
||||||
|
DWORD cItemsToFetch,
|
||||||
|
CLSID * pCLSID,
|
||||||
|
WCHAR ** Names,
|
||||||
|
DWORD * pcItemsFetched)
|
||||||
|
{
|
||||||
|
FILETIME ft;
|
||||||
|
HKEY hkey;
|
||||||
|
WCHAR szNextKey[MAX_PATH];
|
||||||
|
WCHAR szGuidKey[64];
|
||||||
|
WCHAR szKey[MAX_PATH];
|
||||||
|
WCHAR szValue[MAX_PATH];
|
||||||
|
DWORD len;
|
||||||
|
UINT count = 0;
|
||||||
|
HRESULT hres = S_OK;
|
||||||
|
|
||||||
|
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
|
||||||
|
|
||||||
|
TRACE("--> (%p) %d %p %p %p\n", iface, cItemsToFetch, pCLSID, Names, pcItemsFetched);
|
||||||
|
|
||||||
|
if (!pCLSID || !Names || !pcItemsFetched)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
while (count < cItemsToFetch)
|
||||||
|
{
|
||||||
|
This->index++;
|
||||||
|
|
||||||
|
len = MAX_PATH;
|
||||||
|
hres = RegEnumKeyExW(This->hkey, This->index, szNextKey, &len, NULL, NULL, NULL, &ft);
|
||||||
|
if (hres != ERROR_SUCCESS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
TRACE("found %s\n", debugstr_w(szNextKey));
|
||||||
|
|
||||||
|
if (!(This->dwFlags & DMO_ENUMF_INCLUDE_KEYED))
|
||||||
|
{
|
||||||
|
wsprintfW(szKey, szCat3Fmt, szDMORootKey, szNextKey, szDMOKeyed);
|
||||||
|
hres = RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &hkey);
|
||||||
|
if (ERROR_SUCCESS == hres)
|
||||||
|
{
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
/* Skip Keyed entries */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wsprintfW(szKey, szCat2Fmt, szDMORootKey, szNextKey);
|
||||||
|
hres = RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &hkey);
|
||||||
|
|
||||||
|
if (This->pInTypes)
|
||||||
|
{
|
||||||
|
UINT i, j;
|
||||||
|
DWORD cInTypes;
|
||||||
|
DMO_PARTIAL_MEDIATYPE* pInTypes;
|
||||||
|
|
||||||
|
hres = read_types(hkey, szDMOInputType, &cInTypes,
|
||||||
|
sizeof(szValue)/sizeof(DMO_PARTIAL_MEDIATYPE),
|
||||||
|
(DMO_PARTIAL_MEDIATYPE*)szValue);
|
||||||
|
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
{
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pInTypes = (DMO_PARTIAL_MEDIATYPE*) szValue;
|
||||||
|
|
||||||
|
for (i = 0; i < This->cInTypes; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < cInTypes; j++)
|
||||||
|
{
|
||||||
|
if (IsMediaTypeEqual(&pInTypes[j], &This->pInTypes[i]))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j >= cInTypes)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i < This->cInTypes)
|
||||||
|
{
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (This->pOutTypes)
|
||||||
|
{
|
||||||
|
UINT i, j;
|
||||||
|
DWORD cOutTypes;
|
||||||
|
DMO_PARTIAL_MEDIATYPE* pOutTypes;
|
||||||
|
|
||||||
|
hres = read_types(hkey, szDMOOutputType, &cOutTypes,
|
||||||
|
sizeof(szValue)/sizeof(DMO_PARTIAL_MEDIATYPE),
|
||||||
|
(DMO_PARTIAL_MEDIATYPE*)szValue);
|
||||||
|
|
||||||
|
if (ERROR_SUCCESS != hres)
|
||||||
|
{
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pOutTypes = (DMO_PARTIAL_MEDIATYPE*) szValue;
|
||||||
|
|
||||||
|
for (i = 0; i < This->cOutTypes; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < cOutTypes; j++)
|
||||||
|
{
|
||||||
|
if (IsMediaTypeEqual(&pOutTypes[j], &This->pOutTypes[i]))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j >= cOutTypes)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i < This->cOutTypes)
|
||||||
|
{
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Media object wasn't filtered so add it to return list */
|
||||||
|
Names[count] = NULL;
|
||||||
|
len = MAX_PATH * sizeof(WCHAR);
|
||||||
|
hres = RegQueryValueExW(hkey, NULL, NULL, NULL, (LPBYTE) szValue, &len);
|
||||||
|
if (ERROR_SUCCESS == hres)
|
||||||
|
{
|
||||||
|
Names[count] = HeapAlloc(GetProcessHeap(), 0, strlenW(szValue) + 1);
|
||||||
|
if (Names[count])
|
||||||
|
strcmpW(Names[count], szValue);
|
||||||
|
}
|
||||||
|
wsprintfW(szGuidKey,szToGuidFmt,szNextKey);
|
||||||
|
CLSIDFromString(szGuidKey, &pCLSID[count]);
|
||||||
|
|
||||||
|
TRACE("found match %s %s\n", debugstr_w(szValue), debugstr_w(szNextKey));
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pcItemsFetched = count;
|
||||||
|
if (*pcItemsFetched < cItemsToFetch)
|
||||||
|
hres = S_FALSE;
|
||||||
|
|
||||||
|
TRACE("<-- %i found\n",count);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* IEnumDMO_fnSkip
|
||||||
|
*/
|
||||||
|
static HRESULT WINAPI IEnumDMO_fnSkip(IEnumDMO * iface, DWORD cItemsToSkip)
|
||||||
|
{
|
||||||
|
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
|
||||||
|
|
||||||
|
This->index += cItemsToSkip;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* IEnumDMO_fnReset
|
||||||
|
*/
|
||||||
|
static HRESULT WINAPI IEnumDMO_fnReset(IEnumDMO * iface)
|
||||||
|
{
|
||||||
|
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
|
||||||
|
|
||||||
|
This->index = -1;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* IEnumDMO_fnClone
|
||||||
|
*/
|
||||||
|
static HRESULT WINAPI IEnumDMO_fnClone(IEnumDMO * iface, IEnumDMO **ppEnum)
|
||||||
|
{
|
||||||
|
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
|
||||||
|
|
||||||
|
FIXME("(%p)->() to (%p)->() E_NOTIMPL\n", This, ppEnum);
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
* DMOEnum (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Enumerate DirectX Media Objects in the registry.
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI DMOEnum(
|
||||||
|
REFGUID guidCategory,
|
||||||
|
DWORD dwFlags,
|
||||||
|
DWORD cInTypes,
|
||||||
|
const DMO_PARTIAL_MEDIATYPE *pInTypes,
|
||||||
|
DWORD cOutTypes,
|
||||||
|
const DMO_PARTIAL_MEDIATYPE *pOutTypes,
|
||||||
|
IEnumDMO **ppEnum)
|
||||||
|
{
|
||||||
|
HRESULT hres = E_FAIL;
|
||||||
|
|
||||||
|
TRACE("guidCategory=%p dwFlags=0x%08x cInTypes=%d cOutTypes=%d\n",
|
||||||
|
guidCategory, dwFlags, cInTypes, cOutTypes);
|
||||||
|
|
||||||
|
*ppEnum = IEnumDMO_Constructor(guidCategory, dwFlags, cInTypes,
|
||||||
|
pInTypes, cOutTypes, pOutTypes);
|
||||||
|
if (*ppEnum)
|
||||||
|
hres = S_OK;
|
||||||
|
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const IEnumDMOVtbl edmovt =
|
||||||
|
{
|
||||||
|
IEnumDMO_fnQueryInterface,
|
||||||
|
IEnumDMO_fnAddRef,
|
||||||
|
IEnumDMO_fnRelease,
|
||||||
|
IEnumDMO_fnNext,
|
||||||
|
IEnumDMO_fnSkip,
|
||||||
|
IEnumDMO_fnReset,
|
||||||
|
IEnumDMO_fnClone,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO_PARTIAL_MEDIATYPE* types )
|
||||||
|
{
|
||||||
|
HRESULT ret = S_OK;
|
||||||
|
if (MSDMO_MAJOR_VERSION > 5)
|
||||||
|
{
|
||||||
|
DWORD len;
|
||||||
|
len = requested * sizeof(DMO_PARTIAL_MEDIATYPE);
|
||||||
|
ret = RegQueryValueExW(root, key, NULL, NULL, (LPBYTE) types, &len);
|
||||||
|
*supplied = len / sizeof(DMO_PARTIAL_MEDIATYPE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HKEY hkey;
|
||||||
|
WCHAR szGuidKey[64];
|
||||||
|
|
||||||
|
*supplied = 0;
|
||||||
|
if (ERROR_SUCCESS == RegOpenKeyExW(root, key, 0, KEY_READ, &hkey))
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
WCHAR szNextKey[MAX_PATH];
|
||||||
|
DWORD len;
|
||||||
|
LONG rc = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
while (rc == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
len = MAX_PATH;
|
||||||
|
rc = RegEnumKeyExW(hkey, index, szNextKey, &len, NULL, NULL, NULL, NULL);
|
||||||
|
if (rc == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
HKEY subk;
|
||||||
|
int sub_index = 0;
|
||||||
|
LONG rcs = ERROR_SUCCESS;
|
||||||
|
WCHAR szSubKey[MAX_PATH];
|
||||||
|
|
||||||
|
RegOpenKeyExW(hkey, szNextKey, 0, KEY_READ, &subk);
|
||||||
|
while (rcs == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
len = MAX_PATH;
|
||||||
|
rcs = RegEnumKeyExW(subk, sub_index, szSubKey, &len, NULL, NULL, NULL, NULL);
|
||||||
|
if (rcs == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
if (*supplied >= requested)
|
||||||
|
{
|
||||||
|
/* Bailing */
|
||||||
|
ret = S_FALSE;
|
||||||
|
rc = ERROR_MORE_DATA;
|
||||||
|
rcs = ERROR_MORE_DATA;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wsprintfW(szGuidKey,szToGuidFmt,szNextKey);
|
||||||
|
CLSIDFromString(szGuidKey, &types[*supplied].type);
|
||||||
|
wsprintfW(szGuidKey,szToGuidFmt,szSubKey);
|
||||||
|
CLSIDFromString(szGuidKey, &types[*supplied].subtype);
|
||||||
|
TRACE("Adding type %s subtype %s at index %i\n",
|
||||||
|
debugstr_guid(&types[*supplied].type),
|
||||||
|
debugstr_guid(&types[*supplied].subtype),
|
||||||
|
*supplied);
|
||||||
|
(*supplied)++;
|
||||||
|
}
|
||||||
|
sub_index++;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
* DMOGetTypes (MSDMO.@)
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI DMOGetTypes(REFCLSID clsidDMO,
|
||||||
|
unsigned long ulInputTypesRequested,
|
||||||
|
unsigned long* pulInputTypesSupplied,
|
||||||
|
DMO_PARTIAL_MEDIATYPE* pInputTypes,
|
||||||
|
unsigned long ulOutputTypesRequested,
|
||||||
|
unsigned long* pulOutputTypesSupplied,
|
||||||
|
DMO_PARTIAL_MEDIATYPE* pOutputTypes)
|
||||||
|
{
|
||||||
|
HKEY root,hkey;
|
||||||
|
HRESULT ret = S_OK;
|
||||||
|
WCHAR szguid[64];
|
||||||
|
|
||||||
|
TRACE ("(%s,%u,%p,%p,%u,%p,%p),stub!\n", debugstr_guid(clsidDMO),
|
||||||
|
ulInputTypesRequested, pulInputTypesSupplied, pInputTypes,
|
||||||
|
ulOutputTypesRequested, pulOutputTypesSupplied, pOutputTypes);
|
||||||
|
|
||||||
|
if (ERROR_SUCCESS != RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0,
|
||||||
|
KEY_READ, &root))
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
if (ERROR_SUCCESS != RegOpenKeyExW(root,GUIDToString(szguid,clsidDMO) , 0,
|
||||||
|
KEY_READ, &hkey))
|
||||||
|
{
|
||||||
|
RegCloseKey(root);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ulInputTypesRequested > 0)
|
||||||
|
{
|
||||||
|
ret = read_types(hkey, szDMOInputType, (ULONG*)pulInputTypesSupplied, ulInputTypesRequested, pInputTypes );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*pulInputTypesSupplied = 0;
|
||||||
|
|
||||||
|
if (ulOutputTypesRequested > 0)
|
||||||
|
{
|
||||||
|
HRESULT ret2;
|
||||||
|
ret2 = read_types(hkey, szDMOOutputType, (ULONG*)pulOutputTypesSupplied, ulOutputTypesRequested, pOutputTypes );
|
||||||
|
|
||||||
|
if (ret == S_OK)
|
||||||
|
ret = ret2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*pulOutputTypesSupplied = 0;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
200
reactos/dll/directx/msdmo/dmort.c
Normal file
200
reactos/dll/directx/msdmo/dmort.c
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2003 Michael Günnewig
|
||||||
|
*
|
||||||
|
* 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>
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "objbase.h"
|
||||||
|
#include "mediaobj.h"
|
||||||
|
#include "dmort.h"
|
||||||
|
|
||||||
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* MoCreateMediaType (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Allocate a new media type structure
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI MoCreateMediaType(DMO_MEDIA_TYPE** ppmedia, DWORD cbFormat)
|
||||||
|
{
|
||||||
|
HRESULT r;
|
||||||
|
|
||||||
|
TRACE("%p %u\n", ppmedia, cbFormat);
|
||||||
|
|
||||||
|
if (!ppmedia)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
*ppmedia = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE));
|
||||||
|
if (!*ppmedia)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
r = MoInitMediaType(*ppmedia, cbFormat);
|
||||||
|
if (FAILED(r))
|
||||||
|
{
|
||||||
|
CoTaskMemFree(*ppmedia);
|
||||||
|
*ppmedia = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* MoInitMediaType (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Initialize media type structure
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI MoInitMediaType(DMO_MEDIA_TYPE* pmedia, DWORD cbFormat)
|
||||||
|
{
|
||||||
|
TRACE("%p %u\n", pmedia, cbFormat);
|
||||||
|
|
||||||
|
if (!pmedia)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
memset(pmedia, 0, sizeof(DMO_MEDIA_TYPE));
|
||||||
|
|
||||||
|
if (cbFormat > 0)
|
||||||
|
{
|
||||||
|
pmedia->pbFormat = CoTaskMemAlloc(cbFormat);
|
||||||
|
if (!pmedia->pbFormat)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
pmedia->cbFormat = cbFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* MoDeleteMediaType (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Delete a media type structure
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI MoDeleteMediaType(DMO_MEDIA_TYPE* pmedia)
|
||||||
|
{
|
||||||
|
TRACE("%p\n", pmedia);
|
||||||
|
|
||||||
|
if (!pmedia)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
MoFreeMediaType(pmedia);
|
||||||
|
CoTaskMemFree(pmedia);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* MoFreeMediaType (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Free allocated members of a media type structure
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI MoFreeMediaType(DMO_MEDIA_TYPE* pmedia)
|
||||||
|
{
|
||||||
|
TRACE("%p\n", pmedia);
|
||||||
|
|
||||||
|
if (!pmedia)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
if (pmedia->pUnk)
|
||||||
|
{
|
||||||
|
IUnknown_Release(pmedia->pUnk);
|
||||||
|
pmedia->pUnk = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CoTaskMemFree(pmedia->pbFormat);
|
||||||
|
pmedia->pbFormat = NULL;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* MoDuplicateMediaType (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Duplicates a media type structure
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI MoDuplicateMediaType(DMO_MEDIA_TYPE** ppdst,
|
||||||
|
const DMO_MEDIA_TYPE* psrc)
|
||||||
|
{
|
||||||
|
HRESULT r;
|
||||||
|
|
||||||
|
TRACE("%p %p\n", ppdst, psrc);
|
||||||
|
|
||||||
|
if (!ppdst || !psrc)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
*ppdst = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE));
|
||||||
|
if (!*ppdst)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
r = MoCopyMediaType(*ppdst, psrc);
|
||||||
|
if (FAILED(r))
|
||||||
|
{
|
||||||
|
MoFreeMediaType(*ppdst);
|
||||||
|
*ppdst = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* MoCopyMediaType (MSDMO.@)
|
||||||
|
*
|
||||||
|
* Copy a new media type structure
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI MoCopyMediaType(DMO_MEDIA_TYPE* pdst,
|
||||||
|
const DMO_MEDIA_TYPE* psrc)
|
||||||
|
{
|
||||||
|
TRACE("%p %p\n", pdst, psrc);
|
||||||
|
|
||||||
|
if (!pdst || !psrc)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
pdst->majortype = psrc->majortype;
|
||||||
|
pdst->subtype = psrc->subtype;
|
||||||
|
pdst->formattype = psrc->formattype;
|
||||||
|
|
||||||
|
pdst->bFixedSizeSamples = psrc->bFixedSizeSamples;
|
||||||
|
pdst->bTemporalCompression = psrc->bTemporalCompression;
|
||||||
|
pdst->lSampleSize = psrc->lSampleSize;
|
||||||
|
pdst->cbFormat = psrc->cbFormat;
|
||||||
|
|
||||||
|
if (psrc->pbFormat && psrc->cbFormat > 0)
|
||||||
|
{
|
||||||
|
pdst->pbFormat = CoTaskMemAlloc(psrc->cbFormat);
|
||||||
|
if (!pdst->pbFormat)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
memcpy(pdst->pbFormat, psrc->pbFormat, psrc->cbFormat);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pdst->pbFormat = NULL;
|
||||||
|
|
||||||
|
if (psrc->pUnk)
|
||||||
|
{
|
||||||
|
pdst->pUnk = psrc->pUnk;
|
||||||
|
IUnknown_AddRef(pdst->pUnk);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pdst->pUnk = NULL;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
|
@ -1,124 +0,0 @@
|
||||||
/*
|
|
||||||
* MSDMO.DLL - ReactOS DMO Runtime
|
|
||||||
*
|
|
||||||
* Copyright 2008 Dmitry Chapyshev
|
|
||||||
*
|
|
||||||
* 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 <windows.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
typedef struct _DMO_PARTIAL_MEDIATYPE
|
|
||||||
{
|
|
||||||
GUID type;
|
|
||||||
GUID subtype;
|
|
||||||
} DMO_PARTIAL_MEDIATYPE, *PDMO_PARTIAL_MEDIATYPE;
|
|
||||||
|
|
||||||
typedef struct _IEnumDMO IEnumDMO;
|
|
||||||
|
|
||||||
typedef struct _DMOMediaType
|
|
||||||
{
|
|
||||||
GUID majortype;
|
|
||||||
GUID subtype;
|
|
||||||
BOOL bFixedSizeSamples;
|
|
||||||
BOOL bTemporalCompression;
|
|
||||||
ULONG lSampleSize;
|
|
||||||
GUID formattype;
|
|
||||||
IUnknown *pUnk;
|
|
||||||
ULONG cbFormat;
|
|
||||||
BYTE *pbFormat;
|
|
||||||
} DMO_MEDIA_TYPE;
|
|
||||||
|
|
||||||
HRESULT WINAPI DMOEnum(
|
|
||||||
REFGUID guidCategory,
|
|
||||||
DWORD dwFlags,
|
|
||||||
DWORD cInTypes,
|
|
||||||
const DMO_PARTIAL_MEDIATYPE *pInTypes,
|
|
||||||
DWORD cOutTypes,
|
|
||||||
const DMO_PARTIAL_MEDIATYPE *pOutTypes,
|
|
||||||
IEnumDMO **ppEnum)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI DMOGetName(REFCLSID clsidDMO, WCHAR szName[])
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI DMOGetTypes(REFCLSID clsidDMO,
|
|
||||||
ULONG ulInputTypesRequested,
|
|
||||||
ULONG* pulInputTypesSupplied,
|
|
||||||
DMO_PARTIAL_MEDIATYPE* pInputTypes,
|
|
||||||
ULONG ulOutputTypesRequested,
|
|
||||||
ULONG* pulOutputTypesSupplied,
|
|
||||||
DMO_PARTIAL_MEDIATYPE* pOutputTypes)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI DMORegister(
|
|
||||||
LPCWSTR szName,
|
|
||||||
REFCLSID clsidDMO,
|
|
||||||
REFGUID guidCategory,
|
|
||||||
DWORD dwFlags,
|
|
||||||
DWORD cInTypes,
|
|
||||||
const DMO_PARTIAL_MEDIATYPE *pInTypes,
|
|
||||||
DWORD cOutTypes,
|
|
||||||
const DMO_PARTIAL_MEDIATYPE *pOutTypes
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI DMOUnregister(REFCLSID clsidDMO, REFGUID guidCategory)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI MoCopyMediaType(DMO_MEDIA_TYPE* pdst,
|
|
||||||
const DMO_MEDIA_TYPE* psrc)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI MoCreateMediaType(DMO_MEDIA_TYPE** ppmedia, DWORD cbFormat)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI MoDeleteMediaType(DMO_MEDIA_TYPE* pmedia)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI MoDuplicateMediaType(DMO_MEDIA_TYPE** ppdst,
|
|
||||||
const DMO_MEDIA_TYPE* psrc)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI MoFreeMediaType(DMO_MEDIA_TYPE* pmedia)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI MoInitMediaType(DMO_MEDIA_TYPE* pmedia, DWORD cbFormat)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
|
@ -1,13 +1,16 @@
|
||||||
<?xml version="1.0"?>
|
<module name="msdmo" type="win32dll" baseaddress="${BASEADDRESS_MSDMO}" installbase="system32" installname="msdmo.dll" allowwarnings="true" entrypoint="0">
|
||||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
|
||||||
<group>
|
|
||||||
<module name="msdmo" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_MSDMO}" installbase="system32" installname="msdmo.dll">
|
|
||||||
<importlibrary definition="msdmo.spec" />
|
<importlibrary definition="msdmo.spec" />
|
||||||
<include base="msdmo">.</include>
|
<include base="msdmo">.</include>
|
||||||
|
<include base="ReactOS">include/reactos/wine</include>
|
||||||
|
<define name="__WINESRC__" />
|
||||||
|
<file>dmoreg.c</file>
|
||||||
|
<file>dmort.c</file>
|
||||||
|
<file>rsrc.rc</file>
|
||||||
|
<library>wine</library>
|
||||||
|
<library>uuid</library>
|
||||||
|
<library>ole32</library>
|
||||||
|
<library>user32</library>
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>ntdll</library>
|
<library>ntdll</library>
|
||||||
<file>msdmo.c</file>
|
|
||||||
<file>msdmo.rc</file>
|
|
||||||
</module>
|
</module>
|
||||||
</group>
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
#define REACTOS_VERSION_DLL
|
|
||||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS DMO Runtime\0"
|
|
||||||
#define REACTOS_STR_INTERNAL_NAME "msdmo\0"
|
|
||||||
#define REACTOS_STR_ORIGINAL_FILENAME "msdmo.dll\0"
|
|
||||||
|
|
||||||
#include <reactos/reactx.h>
|
|
||||||
|
|
||||||
#include <reactos/version.rc>
|
|
26
reactos/dll/directx/msdmo/rsrc.rc
Normal file
26
reactos/dll/directx/msdmo/rsrc.rc
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2003 Michael Günnewig
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WINE_FILEDESCRIPTION_STR "DMO Runtime"
|
||||||
|
#define WINE_FILENAME_STR "msdmo.dll"
|
||||||
|
#define WINE_FILEVERSION 6,5,1,900
|
||||||
|
#define WINE_FILEVERSION_STR "6.5.1.900"
|
||||||
|
#define WINE_PRODUCTVERSION 6,5,1,900
|
||||||
|
#define WINE_PRODUCTVERSION_STR "6.5"
|
||||||
|
|
||||||
|
#include "wine/wine_common_ver.rc"
|
Loading…
Reference in a new issue