2003-07-21 22:03:50 +02:00
|
|
|
/*
|
2008-10-18 19:20:10 +02:00
|
|
|
* Copyright (C) 2003 Michael Günnewig
|
2003-11-25 01:55:57 +01:00
|
|
|
* Copyright (C) 2003 CodeWeavers Inc. (Ulrich Czekalla)
|
2003-07-21 22:03:50 +02:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-07-21 22:03:50 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
2003-07-21 22:03:50 +02:00
|
|
|
#include "winbase.h"
|
2003-11-25 01:55:57 +01:00
|
|
|
#include "winuser.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winreg.h"
|
2003-07-21 22:03:50 +02:00
|
|
|
#include "objbase.h"
|
2003-11-25 01:55:57 +01:00
|
|
|
#include "wine/unicode.h"
|
2003-07-21 22:03:50 +02:00
|
|
|
#include "wine/debug.h"
|
2005-06-02 21:43:47 +02:00
|
|
|
#include "initguid.h"
|
|
|
|
#include "dmo.h"
|
2003-07-21 22:03:50 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
|
|
|
|
|
2007-10-10 17:13:49 +02:00
|
|
|
#define MSDMO_MAJOR_VERSION 6
|
2003-07-21 22:03:50 +02:00
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
static const WCHAR szDMORootKey[] =
|
2003-07-21 22:03:50 +02:00
|
|
|
{
|
2003-11-25 01:55:57 +01:00
|
|
|
'D','i','r','e','c','t','S','h','o','w','\\',
|
|
|
|
'M','e','d','i','a','O','b','j','e','c','t','s',0
|
|
|
|
};
|
2003-07-21 22:03:50 +02:00
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2007-10-03 21:51:10 +02:00
|
|
|
static const WCHAR szToGuidFmt[] =
|
|
|
|
{
|
|
|
|
'{','%','s','}',0
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2010-11-29 00:54:16 +01:00
|
|
|
IEnumDMO IEnumDMO_iface;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-11-25 01:55:57 +01:00
|
|
|
DWORD index;
|
|
|
|
const GUID* guidCategory;
|
|
|
|
DWORD dwFlags;
|
|
|
|
DWORD cInTypes;
|
|
|
|
DMO_PARTIAL_MEDIATYPE *pInTypes;
|
|
|
|
DWORD cOutTypes;
|
|
|
|
DMO_PARTIAL_MEDIATYPE *pOutTypes;
|
|
|
|
HKEY hkey;
|
|
|
|
} IEnumDMOImpl;
|
|
|
|
|
2010-11-29 00:54:16 +01:00
|
|
|
static inline IEnumDMOImpl *impl_from_IEnumDMO(IEnumDMO *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IEnumDMOImpl, IEnumDMO_iface);
|
|
|
|
}
|
|
|
|
|
2007-10-10 17:13:49 +02:00
|
|
|
static HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO_PARTIAL_MEDIATYPE* types);
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IEnumDMOVtbl edmovt;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
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;
|
2003-07-21 22:03:50 +02:00
|
|
|
}
|
|
|
|
|
2007-05-28 19:11:33 +02:00
|
|
|
static BOOL IsMediaTypeEqual(const DMO_PARTIAL_MEDIATYPE* mt1, const DMO_PARTIAL_MEDIATYPE* mt2)
|
2003-07-21 22:03:50 +02:00
|
|
|
{
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
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));
|
2003-07-21 22:03:50 +02:00
|
|
|
}
|
|
|
|
|
2007-10-10 17:13:49 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
/***************************************************************
|
2007-10-14 14:35:51 +02:00
|
|
|
* DMORegister (MSDMO.@)
|
2003-11-25 01:55:57 +01:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
)
|
2003-07-21 22:03:50 +02:00
|
|
|
{
|
2003-11-25 01:55:57 +01:00
|
|
|
WCHAR szguid[64];
|
|
|
|
HRESULT hres;
|
|
|
|
HKEY hrkey = 0;
|
|
|
|
HKEY hkey = 0;
|
|
|
|
HKEY hckey = 0;
|
|
|
|
HKEY hclskey = 0;
|
2003-07-21 22:03:50 +02:00
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
TRACE("%s\n", debugstr_w(szName));
|
2003-07-21 22:03:50 +02:00
|
|
|
|
2007-10-10 17:13:49 +02:00
|
|
|
hres = RegCreateKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, NULL,
|
|
|
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hrkey, NULL);
|
2003-11-25 01:55:57 +01:00
|
|
|
if (ERROR_SUCCESS != hres)
|
|
|
|
goto lend;
|
2003-07-21 22:03:50 +02:00
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
/* 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 */
|
2004-11-30 22:38:57 +01:00
|
|
|
hres = RegSetValueExW(hkey, NULL, 0, REG_SZ, (const BYTE*) szName,
|
2007-10-10 17:13:49 +02:00
|
|
|
(strlenW(szName) + 1) * sizeof(WCHAR));
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
/* Set InputTypes */
|
2007-10-10 17:13:49 +02:00
|
|
|
hres = write_types(hkey, szDMOInputType, pInTypes, cInTypes);
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
/* Set OutputTypes */
|
2007-10-10 17:13:49 +02:00
|
|
|
hres = write_types(hkey, szDMOOutputType, pOutTypes, cOutTypes);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
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 */
|
2007-10-10 17:13:49 +02:00
|
|
|
hres = RegCreateKeyExW(hrkey, szDMOCategories, 0, NULL,
|
|
|
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hckey, NULL);
|
2003-11-25 01:55:57 +01:00
|
|
|
if (ERROR_SUCCESS != hres)
|
|
|
|
goto lend;
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
2007-10-10 17:13:49 +02:00
|
|
|
hres = RegCreateKeyExW(hckey, GUIDToString(szguid, guidCategory), 0, NULL,
|
|
|
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, NULL);
|
2003-11-25 01:55:57 +01:00
|
|
|
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);
|
|
|
|
|
2006-10-05 22:06:24 +02:00
|
|
|
TRACE(" hresult=0x%08x\n", hres);
|
2003-11-25 01:55:57 +01:00
|
|
|
return hres;
|
2003-07-21 22:03:50 +02:00
|
|
|
}
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
/***************************************************************
|
2007-10-14 14:35:51 +02:00
|
|
|
* DMOUnregister (MSDMO.@)
|
2003-11-25 01:55:57 +01:00
|
|
|
*
|
|
|
|
* Unregister a DirectX Media Object.
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DMOUnregister(REFCLSID clsidDMO, REFGUID guidCategory)
|
2003-07-21 22:03:50 +02:00
|
|
|
{
|
2003-11-25 01:55:57 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************
|
2007-10-14 14:35:51 +02:00
|
|
|
* DMOGetName (MSDMO.@)
|
2003-11-25 01:55:57 +01:00
|
|
|
*
|
|
|
|
* Get DMP Name from the registry
|
|
|
|
*/
|
2008-04-07 23:39:33 +02:00
|
|
|
HRESULT WINAPI DMOGetName(REFCLSID clsidDMO, WCHAR szName[])
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
WCHAR szguid[64];
|
|
|
|
HRESULT hres;
|
|
|
|
HKEY hrkey = 0;
|
|
|
|
HKEY hkey = 0;
|
2008-04-10 00:07:51 +02:00
|
|
|
static const INT max_name_len = 80;
|
2003-11-25 01:55:57 +01:00
|
|
|
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;
|
|
|
|
|
2008-04-10 00:07:51 +02:00
|
|
|
count = max_name_len * sizeof(WCHAR);
|
2003-11-25 01:55:57 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
2010-11-29 12:25:53 +01:00
|
|
|
* IEnumDMOImpl_Destructor
|
2003-11-25 01:55:57 +01:00
|
|
|
*/
|
2010-11-29 12:25:53 +01:00
|
|
|
static BOOL IEnumDMOImpl_Destructor(IEnumDMOImpl* This)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
TRACE("%p\n", This);
|
|
|
|
|
|
|
|
if (This->hkey)
|
|
|
|
RegCloseKey(This->hkey);
|
|
|
|
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This->pInTypes);
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->pOutTypes);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IEnumDMO_Constructor
|
|
|
|
*/
|
2014-10-15 06:26:08 +02:00
|
|
|
static HRESULT IEnumDMO_Constructor(
|
2003-11-25 01:55:57 +01:00
|
|
|
REFGUID guidCategory,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD cInTypes,
|
|
|
|
const DMO_PARTIAL_MEDIATYPE *pInTypes,
|
|
|
|
DWORD cOutTypes,
|
2014-10-15 06:26:08 +02:00
|
|
|
const DMO_PARTIAL_MEDIATYPE *pOutTypes,
|
|
|
|
IEnumDMO **obj)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
IEnumDMOImpl* lpedmo;
|
2014-10-15 06:26:08 +02:00
|
|
|
HRESULT hr = S_OK;
|
|
|
|
UINT size;
|
|
|
|
|
|
|
|
*obj = NULL;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2005-03-24 22:01:35 +01:00
|
|
|
lpedmo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumDMOImpl));
|
2014-10-15 06:26:08 +02:00
|
|
|
if (!lpedmo)
|
|
|
|
return E_OUTOFMEMORY;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:26:08 +02:00
|
|
|
lpedmo->IEnumDMO_iface.lpVtbl = &edmovt;
|
|
|
|
lpedmo->ref = 1;
|
|
|
|
lpedmo->index = -1;
|
|
|
|
lpedmo->guidCategory = guidCategory;
|
|
|
|
lpedmo->dwFlags = dwFlags;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:26:08 +02:00
|
|
|
if (cInTypes > 0)
|
|
|
|
{
|
|
|
|
size = cInTypes * sizeof(DMO_PARTIAL_MEDIATYPE);
|
|
|
|
lpedmo->pInTypes = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
if (!lpedmo->pInTypes)
|
2007-10-10 17:13:49 +02:00
|
|
|
{
|
2014-10-15 06:26:08 +02:00
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
goto lerr;
|
2007-10-10 17:13:49 +02:00
|
|
|
}
|
2014-10-15 06:26:08 +02:00
|
|
|
memcpy(lpedmo->pInTypes, pInTypes, size);
|
|
|
|
lpedmo->cInTypes = cInTypes;
|
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:26:08 +02:00
|
|
|
if (cOutTypes > 0)
|
|
|
|
{
|
|
|
|
size = cOutTypes * sizeof(DMO_PARTIAL_MEDIATYPE);
|
|
|
|
lpedmo->pOutTypes = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
if (!lpedmo->pOutTypes)
|
2007-10-10 17:13:49 +02:00
|
|
|
{
|
2014-10-15 06:26:08 +02:00
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
goto lerr;
|
2007-10-10 17:13:49 +02:00
|
|
|
}
|
2014-10-15 06:26:08 +02:00
|
|
|
memcpy(lpedmo->pOutTypes, pOutTypes, size);
|
|
|
|
lpedmo->cOutTypes = cOutTypes;
|
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:26:08 +02:00
|
|
|
/* If not filtering by category enum from media objects root */
|
|
|
|
if (IsEqualGUID(guidCategory, &GUID_NULL))
|
|
|
|
{
|
|
|
|
if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_READ, &lpedmo->hkey))
|
|
|
|
hr = E_FAIL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WCHAR szguid[64];
|
|
|
|
WCHAR szKey[MAX_PATH];
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:26:08 +02:00
|
|
|
wsprintfW(szKey, szCat3Fmt, szDMORootKey, szDMOCategories,
|
|
|
|
GUIDToString(szguid, guidCategory));
|
|
|
|
if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &lpedmo->hkey))
|
|
|
|
hr = E_FAIL;
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
2014-10-15 06:26:08 +02:00
|
|
|
lerr:
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:26:08 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
IEnumDMOImpl_Destructor(lpedmo);
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpedmo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TRACE("returning %p\n", lpedmo);
|
|
|
|
*obj = &lpedmo->IEnumDMO_iface;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IEnumDMO_fnAddRef
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI IEnumDMO_fnAddRef(IEnumDMO * iface)
|
|
|
|
{
|
2010-11-29 00:54:16 +01:00
|
|
|
IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
|
2014-10-15 06:38:55 +02:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
|
|
|
TRACE("(%p)->(%d)\n", This, refCount);
|
|
|
|
return refCount;
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* EnumDMO_QueryInterface
|
|
|
|
*/
|
2014-10-15 06:38:55 +02:00
|
|
|
static HRESULT WINAPI IEnumDMO_fnQueryInterface(IEnumDMO* iface, REFIID riid, void **ppvObj)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
2014-10-15 06:38:55 +02:00
|
|
|
IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObj);
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
*ppvObj = NULL;
|
|
|
|
|
2014-10-15 06:26:08 +02:00
|
|
|
if (IsEqualIID(riid, &IID_IEnumDMO) ||
|
|
|
|
IsEqualIID(riid, &IID_IUnknown))
|
|
|
|
{
|
|
|
|
*ppvObj = iface;
|
2014-10-15 06:38:55 +02:00
|
|
|
IEnumDMO_fnAddRef(iface);
|
2014-10-15 06:26:08 +02:00
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:38:55 +02:00
|
|
|
return *ppvObj ? S_OK : E_NOINTERFACE;
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IEnumDMO_fnRelease
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI IEnumDMO_fnRelease(IEnumDMO * iface)
|
|
|
|
{
|
2010-11-29 00:54:16 +01:00
|
|
|
IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:38:55 +02:00
|
|
|
TRACE("(%p)->(%d)\n", This, refCount);
|
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
if (!refCount)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
2010-11-29 12:25:53 +01:00
|
|
|
IEnumDMOImpl_Destructor(This);
|
2003-11-25 01:55:57 +01:00
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
}
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* 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];
|
2007-10-03 21:51:10 +02:00
|
|
|
WCHAR szGuidKey[64];
|
2003-11-25 01:55:57 +01:00
|
|
|
WCHAR szKey[MAX_PATH];
|
|
|
|
WCHAR szValue[MAX_PATH];
|
|
|
|
DWORD len;
|
|
|
|
UINT count = 0;
|
|
|
|
HRESULT hres = S_OK;
|
|
|
|
|
2010-11-29 00:54:16 +01:00
|
|
|
IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:38:55 +02:00
|
|
|
TRACE("(%p)->(%d %p %p %p)\n", This, cItemsToFetch, pCLSID, Names, pcItemsFetched);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
if (!pCLSID || !Names || !pcItemsFetched)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2004-09-08 03:23:57 +02:00
|
|
|
while (count < cItemsToFetch)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
This->index++;
|
|
|
|
|
2007-10-26 17:21:21 +02:00
|
|
|
len = MAX_PATH;
|
2003-11-25 01:55:57 +01:00
|
|
|
hres = RegEnumKeyExW(This->hkey, This->index, szNextKey, &len, NULL, NULL, NULL, &ft);
|
|
|
|
if (hres != ERROR_SUCCESS)
|
|
|
|
break;
|
|
|
|
|
|
|
|
TRACE("found %s\n", debugstr_w(szNextKey));
|
|
|
|
|
2007-10-26 17:21:21 +02:00
|
|
|
if (!(This->dwFlags & DMO_ENUMF_INCLUDE_KEYED))
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
wsprintfW(szKey, szCat3Fmt, szDMORootKey, szNextKey, szDMOKeyed);
|
|
|
|
hres = RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &hkey);
|
2007-10-26 17:21:21 +02:00
|
|
|
if (ERROR_SUCCESS == hres)
|
|
|
|
{
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
/* Skip Keyed entries */
|
2003-11-25 01:55:57 +01:00
|
|
|
continue;
|
2007-10-26 17:21:21 +02:00
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
wsprintfW(szKey, szCat2Fmt, szDMORootKey, szNextKey);
|
|
|
|
hres = RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &hkey);
|
|
|
|
|
|
|
|
if (This->pInTypes)
|
|
|
|
{
|
2004-09-08 03:23:57 +02:00
|
|
|
UINT i, j;
|
2003-11-25 01:55:57 +01:00
|
|
|
DWORD cInTypes;
|
|
|
|
DMO_PARTIAL_MEDIATYPE* pInTypes;
|
|
|
|
|
2007-10-10 17:13:49 +02:00
|
|
|
hres = read_types(hkey, szDMOInputType, &cInTypes,
|
|
|
|
sizeof(szValue)/sizeof(DMO_PARTIAL_MEDIATYPE),
|
|
|
|
(DMO_PARTIAL_MEDIATYPE*)szValue);
|
|
|
|
|
|
|
|
if (ERROR_SUCCESS != hres)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2004-09-08 03:23:57 +02:00
|
|
|
UINT i, j;
|
2003-11-25 01:55:57 +01:00
|
|
|
DWORD cOutTypes;
|
|
|
|
DMO_PARTIAL_MEDIATYPE* pOutTypes;
|
|
|
|
|
2007-10-10 17:13:49 +02:00
|
|
|
hres = read_types(hkey, szDMOOutputType, &cOutTypes,
|
|
|
|
sizeof(szValue)/sizeof(DMO_PARTIAL_MEDIATYPE),
|
|
|
|
(DMO_PARTIAL_MEDIATYPE*)szValue);
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
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)
|
|
|
|
{
|
2014-05-02 19:27:00 +02:00
|
|
|
Names[count] = HeapAlloc(GetProcessHeap(), 0, (strlenW(szValue) + 1) * sizeof(WCHAR));
|
2003-11-25 01:55:57 +01:00
|
|
|
if (Names[count])
|
2014-05-02 19:27:00 +02:00
|
|
|
strcpyW(Names[count], szValue);
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
2007-10-03 21:51:10 +02:00
|
|
|
wsprintfW(szGuidKey,szToGuidFmt,szNextKey);
|
|
|
|
CLSIDFromString(szGuidKey, &pCLSID[count]);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
TRACE("found match %s %s\n", debugstr_w(szValue), debugstr_w(szNextKey));
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pcItemsFetched = count;
|
|
|
|
if (*pcItemsFetched < cItemsToFetch)
|
|
|
|
hres = S_FALSE;
|
|
|
|
|
2007-10-03 21:51:10 +02:00
|
|
|
TRACE("<-- %i found\n",count);
|
2003-11-25 01:55:57 +01:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IEnumDMO_fnSkip
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IEnumDMO_fnSkip(IEnumDMO * iface, DWORD cItemsToSkip)
|
|
|
|
{
|
2010-11-29 00:54:16 +01:00
|
|
|
IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:38:55 +02:00
|
|
|
TRACE("(%p)->(%d)\n", This, cItemsToSkip);
|
2003-11-25 01:55:57 +01:00
|
|
|
This->index += cItemsToSkip;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IEnumDMO_fnReset
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IEnumDMO_fnReset(IEnumDMO * iface)
|
|
|
|
{
|
2010-11-29 00:54:16 +01:00
|
|
|
IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-10-15 06:38:55 +02:00
|
|
|
TRACE("(%p)\n", This);
|
2003-11-25 01:55:57 +01:00
|
|
|
This->index = -1;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* IEnumDMO_fnClone
|
|
|
|
*/
|
2014-10-15 06:38:55 +02:00
|
|
|
static HRESULT WINAPI IEnumDMO_fnClone(IEnumDMO *iface, IEnumDMO **ppEnum)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
2010-11-29 00:54:16 +01:00
|
|
|
IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
|
2014-10-15 06:38:55 +02:00
|
|
|
TRACE("(%p)->(%p)\n", This, ppEnum);
|
|
|
|
return IEnumDMO_Constructor(This->guidCategory, This->dwFlags, This->cInTypes, This->pInTypes,
|
|
|
|
This->cOutTypes, This->pOutTypes, ppEnum);
|
2003-07-21 22:03:50 +02:00
|
|
|
}
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
/***************************************************************
|
2007-10-14 14:35:51 +02:00
|
|
|
* DMOEnum (MSDMO.@)
|
2003-11-25 01:55:57 +01:00
|
|
|
*
|
|
|
|
* 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)
|
|
|
|
{
|
2006-10-05 22:06:24 +02:00
|
|
|
TRACE("guidCategory=%p dwFlags=0x%08x cInTypes=%d cOutTypes=%d\n",
|
2003-11-25 01:55:57 +01:00
|
|
|
guidCategory, dwFlags, cInTypes, cOutTypes);
|
|
|
|
|
2014-10-15 06:26:08 +02:00
|
|
|
return IEnumDMO_Constructor(guidCategory, dwFlags, cInTypes,
|
|
|
|
pInTypes, cOutTypes, pOutTypes, ppEnum);
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IEnumDMOVtbl edmovt =
|
2003-07-21 22:03:50 +02:00
|
|
|
{
|
2003-11-25 01:55:57 +01:00
|
|
|
IEnumDMO_fnQueryInterface,
|
|
|
|
IEnumDMO_fnAddRef,
|
|
|
|
IEnumDMO_fnRelease,
|
|
|
|
IEnumDMO_fnNext,
|
|
|
|
IEnumDMO_fnSkip,
|
|
|
|
IEnumDMO_fnReset,
|
|
|
|
IEnumDMO_fnClone,
|
|
|
|
};
|
2003-07-21 22:03:50 +02:00
|
|
|
|
|
|
|
|
2007-10-10 17:13:49 +02:00
|
|
|
HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO_PARTIAL_MEDIATYPE* types )
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
2007-10-03 21:51:10 +02:00
|
|
|
HRESULT ret = S_OK;
|
2007-10-10 17:13:49 +02:00
|
|
|
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
|
2007-10-03 21:51:10 +02:00
|
|
|
{
|
2007-10-10 17:13:49 +02:00
|
|
|
HKEY hkey;
|
|
|
|
WCHAR szGuidKey[64];
|
|
|
|
|
|
|
|
*supplied = 0;
|
|
|
|
if (ERROR_SUCCESS == RegOpenKeyExW(root, key, 0, KEY_READ, &hkey))
|
2007-10-03 21:51:10 +02:00
|
|
|
{
|
2007-10-10 17:13:49 +02:00
|
|
|
int index = 0;
|
|
|
|
WCHAR szNextKey[MAX_PATH];
|
|
|
|
DWORD len;
|
|
|
|
LONG rc = ERROR_SUCCESS;
|
2007-10-03 21:51:10 +02:00
|
|
|
|
2007-10-10 17:13:49 +02:00
|
|
|
while (rc == ERROR_SUCCESS)
|
2007-10-03 21:51:10 +02:00
|
|
|
{
|
2008-10-12 19:50:20 +02:00
|
|
|
len = MAX_PATH;
|
2007-10-10 17:13:49 +02:00
|
|
|
rc = RegEnumKeyExW(hkey, index, szNextKey, &len, NULL, NULL, NULL, NULL);
|
|
|
|
if (rc == ERROR_SUCCESS)
|
2007-10-03 21:51:10 +02:00
|
|
|
{
|
2007-10-10 17:13:49 +02:00
|
|
|
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)
|
2007-10-03 21:51:10 +02:00
|
|
|
{
|
2008-10-12 19:50:20 +02:00
|
|
|
len = MAX_PATH;
|
2007-10-10 17:13:49 +02:00
|
|
|
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++;
|
2007-10-03 21:51:10 +02:00
|
|
|
}
|
2007-10-10 17:13:49 +02:00
|
|
|
index++;
|
2007-10-03 21:51:10 +02:00
|
|
|
}
|
|
|
|
}
|
2007-10-10 17:13:49 +02:00
|
|
|
RegCloseKey(hkey);
|
2007-10-03 21:51:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-10-14 14:35:51 +02:00
|
|
|
/***************************************************************
|
|
|
|
* DMOGetTypes (MSDMO.@)
|
|
|
|
*/
|
2007-10-03 21:51:10 +02:00
|
|
|
HRESULT WINAPI DMOGetTypes(REFCLSID clsidDMO,
|
|
|
|
ULONG ulInputTypesRequested,
|
|
|
|
ULONG* pulInputTypesSupplied,
|
|
|
|
DMO_PARTIAL_MEDIATYPE* pInputTypes,
|
|
|
|
ULONG ulOutputTypesRequested,
|
|
|
|
ULONG* pulOutputTypesSupplied,
|
|
|
|
DMO_PARTIAL_MEDIATYPE* pOutputTypes)
|
|
|
|
{
|
|
|
|
HKEY root,hkey;
|
|
|
|
HRESULT ret = S_OK;
|
|
|
|
WCHAR szguid[64];
|
|
|
|
|
2012-09-12 12:18:06 +02:00
|
|
|
TRACE ("(%s,%u,%p,%p,%u,%p,%p)\n", debugstr_guid(clsidDMO), ulInputTypesRequested,
|
|
|
|
pulInputTypesSupplied, pInputTypes, ulOutputTypesRequested, pulOutputTypesSupplied,
|
|
|
|
pOutputTypes);
|
2007-10-03 21:51:10 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2007-10-10 17:13:49 +02:00
|
|
|
ret = read_types(hkey, szDMOInputType, pulInputTypesSupplied, ulInputTypesRequested, pInputTypes );
|
2007-10-03 21:51:10 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
*pulInputTypesSupplied = 0;
|
|
|
|
|
|
|
|
if (ulOutputTypesRequested > 0)
|
|
|
|
{
|
|
|
|
HRESULT ret2;
|
2007-10-10 17:13:49 +02:00
|
|
|
ret2 = read_types(hkey, szDMOOutputType, pulOutputTypesSupplied, ulOutputTypesRequested, pOutputTypes );
|
2007-10-03 21:51:10 +02:00
|
|
|
|
|
|
|
if (ret == S_OK)
|
|
|
|
ret = ret2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*pulOutputTypesSupplied = 0;
|
|
|
|
|
|
|
|
return ret;
|
2003-07-21 22:03:50 +02:00
|
|
|
}
|