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>
|
|
|
|
|
2015-04-22 22:06:35 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#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"
|
|
|
|
#include "wine/debug.h"
|
2005-06-02 21:43:47 +02:00
|
|
|
#include "dmo.h"
|
2003-07-21 22:03:50 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
|
|
|
|
|
2020-07-10 18:42:50 +02:00
|
|
|
BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int count, unsigned int size)
|
|
|
|
{
|
|
|
|
unsigned int max_capacity, new_capacity;
|
|
|
|
void *new_elements;
|
|
|
|
|
|
|
|
if (count <= *capacity)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
max_capacity = ~0u / size;
|
|
|
|
if (count > max_capacity)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
new_capacity = max(8, *capacity);
|
|
|
|
while (new_capacity < count && new_capacity <= max_capacity / 2)
|
|
|
|
new_capacity *= 2;
|
|
|
|
if (new_capacity < count)
|
|
|
|
new_capacity = count;
|
|
|
|
|
|
|
|
if (!(new_elements = realloc(*elements, new_capacity * size)))
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate memory.\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*elements = new_elements;
|
|
|
|
*capacity = new_capacity;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
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;
|
2015-04-23 08:58:50 +02:00
|
|
|
GUID category;
|
2003-11-25 01:55:57 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IEnumDMOVtbl edmovt;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2020-07-10 18:42:48 +02:00
|
|
|
static const WCHAR *GUIDToString(WCHAR *string, const GUID *guid)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
2020-07-10 18:42:48 +02:00
|
|
|
swprintf(string, 37, L"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
|
|
|
guid->Data1, guid->Data2, guid->Data3,
|
|
|
|
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
|
|
|
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
|
|
|
return string;
|
2003-07-21 22:03:50 +02:00
|
|
|
}
|
|
|
|
|
2018-05-09 01:55:02 +02:00
|
|
|
static HRESULT string_to_guid(const WCHAR *string, GUID *guid)
|
|
|
|
{
|
|
|
|
WCHAR buffer[39];
|
|
|
|
buffer[0] = '{';
|
2020-07-10 18:42:48 +02:00
|
|
|
wcscpy(buffer + 1, string);
|
2018-05-09 01:55:02 +02:00
|
|
|
buffer[37] = '}';
|
|
|
|
buffer[38] = 0;
|
|
|
|
return CLSIDFromString(buffer, guid);
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2020-07-10 18:42:46 +02:00
|
|
|
return HRESULT_FROM_WIN32(RegSetValueExW(hkey, name, 0, REG_BINARY,
|
|
|
|
(const BYTE *)types, count * sizeof(DMO_PARTIAL_MEDIATYPE)));
|
2007-10-10 17:13:49 +02:00
|
|
|
}
|
|
|
|
|
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;
|
2015-05-03 20:41:00 +02:00
|
|
|
LONG ret;
|
2003-07-21 22:03:50 +02:00
|
|
|
|
2014-12-29 11:25:45 +01:00
|
|
|
TRACE("%s %s %s\n", debugstr_w(szName), debugstr_guid(clsidDMO), debugstr_guid(guidCategory));
|
|
|
|
|
|
|
|
if (IsEqualGUID(guidCategory, &GUID_NULL))
|
|
|
|
return E_INVALIDARG;
|
2003-07-21 22:03:50 +02:00
|
|
|
|
2020-07-10 18:42:48 +02:00
|
|
|
ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, L"DirectShow\\MediaObjects", 0,
|
|
|
|
NULL, 0, KEY_WRITE, NULL, &hrkey, NULL);
|
2015-05-03 20:41:00 +02:00
|
|
|
if (ret)
|
2018-06-28 12:03:48 +02:00
|
|
|
return E_FAIL;
|
2003-07-21 22:03:50 +02:00
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
/* Create clsidDMO key under MediaObjects */
|
2015-05-03 20:41:00 +02:00
|
|
|
ret = RegCreateKeyExW(hrkey, GUIDToString(szguid, clsidDMO), 0, NULL,
|
2003-11-25 01:55:57 +01:00
|
|
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, NULL);
|
2015-05-03 20:41:00 +02:00
|
|
|
if (ret)
|
2003-11-25 01:55:57 +01:00
|
|
|
goto lend;
|
|
|
|
|
|
|
|
/* Set default Name value */
|
2015-05-03 20:41:00 +02:00
|
|
|
ret = RegSetValueExW(hkey, NULL, 0, REG_SZ, (const BYTE*) szName,
|
2020-07-10 18:42:48 +02:00
|
|
|
(wcslen(szName) + 1) * sizeof(WCHAR));
|
2007-10-10 17:13:49 +02:00
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
/* Set InputTypes */
|
2020-07-10 18:42:48 +02:00
|
|
|
hres = write_types(hkey, L"InputTypes", pInTypes, cInTypes);
|
2007-10-10 17:13:49 +02:00
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
/* Set OutputTypes */
|
2020-07-10 18:42:48 +02:00
|
|
|
hres = write_types(hkey, L"OutputTypes", pOutTypes, cOutTypes);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
if (dwFlags & DMO_REGISTERF_IS_KEYED)
|
|
|
|
{
|
|
|
|
/* Create Keyed key */
|
2020-07-10 18:42:48 +02:00
|
|
|
ret = RegCreateKeyExW(hkey, L"Keyed", 0, NULL, 0, KEY_WRITE, NULL, &hckey, NULL);
|
2015-05-03 20:41:00 +02:00
|
|
|
if (ret)
|
2003-11-25 01:55:57 +01:00
|
|
|
goto lend;
|
|
|
|
RegCloseKey(hckey);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Register the category */
|
2020-07-10 18:42:48 +02:00
|
|
|
ret = RegCreateKeyExW(hrkey, L"Categories", 0, NULL, 0, KEY_WRITE, NULL, &hckey, NULL);
|
2015-05-03 20:41:00 +02:00
|
|
|
if (ret)
|
2003-11-25 01:55:57 +01:00
|
|
|
goto lend;
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
2015-05-03 20:41:00 +02:00
|
|
|
ret = RegCreateKeyExW(hckey, GUIDToString(szguid, guidCategory), 0, NULL,
|
2007-10-10 17:13:49 +02:00
|
|
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, NULL);
|
2015-05-03 20:41:00 +02:00
|
|
|
if (ret)
|
2003-11-25 01:55:57 +01:00
|
|
|
goto lend;
|
2015-05-03 20:41:00 +02:00
|
|
|
ret = RegCreateKeyExW(hkey, GUIDToString(szguid, clsidDMO), 0, NULL,
|
2003-11-25 01:55:57 +01:00
|
|
|
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hclskey, NULL);
|
2015-05-03 20:41:00 +02:00
|
|
|
if (ret)
|
2003-11-25 01:55:57 +01:00
|
|
|
goto lend;
|
|
|
|
|
|
|
|
lend:
|
|
|
|
if (hkey)
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
if (hckey)
|
|
|
|
RegCloseKey(hckey);
|
|
|
|
if (hclskey)
|
|
|
|
RegCloseKey(hclskey);
|
|
|
|
if (hrkey)
|
|
|
|
RegCloseKey(hrkey);
|
|
|
|
|
2015-05-03 20:41:00 +02:00
|
|
|
hres = HRESULT_FROM_WIN32(ret);
|
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
|
|
|
}
|
|
|
|
|
2014-12-29 11:25:45 +01:00
|
|
|
static HRESULT unregister_dmo_from_category(const WCHAR *dmoW, const WCHAR *catW, HKEY categories)
|
|
|
|
{
|
|
|
|
HKEY catkey;
|
|
|
|
LONG ret;
|
|
|
|
|
|
|
|
ret = RegOpenKeyExW(categories, catW, 0, KEY_WRITE, &catkey);
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ret = RegDeleteKeyW(catkey, dmoW);
|
|
|
|
RegCloseKey(catkey);
|
|
|
|
}
|
|
|
|
|
|
|
|
return !ret ? S_OK : S_FALSE;
|
|
|
|
}
|
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.
|
|
|
|
*/
|
2014-12-29 11:25:45 +01:00
|
|
|
HRESULT WINAPI DMOUnregister(REFCLSID dmo, REFGUID category)
|
2003-07-21 22:03:50 +02:00
|
|
|
{
|
2014-12-29 11:25:45 +01:00
|
|
|
HKEY rootkey = 0, categorieskey = 0;
|
|
|
|
WCHAR dmoW[64], catW[64];
|
|
|
|
HRESULT hr = S_FALSE;
|
2014-12-28 22:13:56 +01:00
|
|
|
LONG ret;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-12-29 11:25:45 +01:00
|
|
|
TRACE("%s %s\n", debugstr_guid(dmo), debugstr_guid(category));
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2020-07-10 18:42:48 +02:00
|
|
|
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"DirectShow\\MediaObjects", 0, KEY_WRITE, &rootkey))
|
2014-12-31 09:48:00 +01:00
|
|
|
return S_FALSE;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-12-29 11:25:45 +01:00
|
|
|
GUIDToString(dmoW, dmo);
|
|
|
|
RegDeleteKeyW(rootkey, dmoW);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-12-29 11:25:45 +01:00
|
|
|
/* open 'Categories' */
|
2020-07-10 18:42:48 +02:00
|
|
|
ret = RegOpenKeyExW(rootkey, L"Categories", 0, KEY_WRITE|KEY_ENUMERATE_SUB_KEYS, &categorieskey);
|
2014-12-29 11:25:45 +01:00
|
|
|
RegCloseKey(rootkey);
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
hr = HRESULT_FROM_WIN32(ret);
|
2003-11-25 01:55:57 +01:00
|
|
|
goto lend;
|
2014-12-29 11:25:45 +01:00
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-12-29 11:25:45 +01:00
|
|
|
/* remove from all categories */
|
|
|
|
if (IsEqualGUID(category, &GUID_NULL))
|
|
|
|
{
|
2018-08-04 22:45:43 +02:00
|
|
|
DWORD index = 0, len = ARRAY_SIZE(catW);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-12-29 11:25:45 +01:00
|
|
|
while (!RegEnumKeyExW(categorieskey, index++, catW, &len, NULL, NULL, NULL, NULL))
|
|
|
|
hr = unregister_dmo_from_category(dmoW, catW, categorieskey);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GUIDToString(catW, category);
|
|
|
|
hr = unregister_dmo_from_category(dmoW, catW, categorieskey);
|
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
lend:
|
2014-12-29 11:25:45 +01:00
|
|
|
if (categorieskey)
|
|
|
|
RegCloseKey(categorieskey);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-12-29 11:25:45 +01:00
|
|
|
return hr;
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************
|
2007-10-14 14:35:51 +02:00
|
|
|
* DMOGetName (MSDMO.@)
|
2003-11-25 01:55:57 +01:00
|
|
|
*
|
2015-04-22 13:31:42 +02:00
|
|
|
* Get DMO Name from the registry
|
2003-11-25 01:55:57 +01:00
|
|
|
*/
|
2015-04-22 13:31:42 +02:00
|
|
|
HRESULT WINAPI DMOGetName(REFCLSID clsidDMO, WCHAR name[])
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
2015-04-22 13:31:42 +02:00
|
|
|
static const INT max_name_len = 80*sizeof(WCHAR);
|
|
|
|
DWORD count = max_name_len;
|
2003-11-25 01:55:57 +01:00
|
|
|
WCHAR szguid[64];
|
2015-04-22 13:31:42 +02:00
|
|
|
HKEY hrkey, hkey;
|
2014-12-28 22:13:56 +01:00
|
|
|
LONG ret;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2015-04-22 13:31:42 +02:00
|
|
|
TRACE("%s %p\n", debugstr_guid(clsidDMO), name);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2020-07-10 18:42:48 +02:00
|
|
|
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"DirectShow\\MediaObjects", 0, KEY_READ, &hrkey))
|
2015-04-22 13:31:42 +02:00
|
|
|
return E_FAIL;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2014-12-28 22:13:56 +01:00
|
|
|
ret = RegOpenKeyExW(hrkey, GUIDToString(szguid, clsidDMO), 0, KEY_READ, &hkey);
|
2015-04-22 13:31:42 +02:00
|
|
|
RegCloseKey(hrkey);
|
|
|
|
if (ret)
|
|
|
|
return E_FAIL;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2015-04-22 13:31:42 +02:00
|
|
|
ret = RegQueryValueExW(hkey, NULL, NULL, NULL, (LPBYTE)name, &count);
|
|
|
|
RegCloseKey(hkey);
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2015-04-22 13:31:42 +02:00
|
|
|
if (!ret && count > 1)
|
|
|
|
{
|
|
|
|
TRACE("name=%s\n", debugstr_w(name));
|
|
|
|
return S_OK;
|
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2015-04-22 13:31:42 +02:00
|
|
|
name[0] = 0;
|
|
|
|
return S_FALSE;
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
2015-04-23 09:08:18 +02:00
|
|
|
static HRESULT dup_partial_mediatype(const DMO_PARTIAL_MEDIATYPE *types, DWORD count, DMO_PARTIAL_MEDIATYPE **ret)
|
|
|
|
{
|
|
|
|
*ret = NULL;
|
|
|
|
|
|
|
|
if (count == 0)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
*ret = HeapAlloc(GetProcessHeap(), 0, count*sizeof(*types));
|
|
|
|
if (!*ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
memcpy(*ret, types, count*sizeof(*types));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* 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;
|
2015-04-23 09:08:18 +02:00
|
|
|
HRESULT hr;
|
2014-10-15 06:26:08 +02:00
|
|
|
|
|
|
|
*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;
|
2015-04-23 08:58:50 +02:00
|
|
|
lpedmo->category = *guidCategory;
|
2014-10-15 06:26:08 +02:00
|
|
|
lpedmo->dwFlags = dwFlags;
|
2015-04-23 09:08:18 +02:00
|
|
|
lpedmo->cInTypes = cInTypes;
|
|
|
|
lpedmo->cOutTypes = cOutTypes;
|
2018-05-09 01:54:59 +02:00
|
|
|
lpedmo->hkey = NULL;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2015-04-23 09:08:18 +02:00
|
|
|
hr = dup_partial_mediatype(pInTypes, cInTypes, &lpedmo->pInTypes);
|
|
|
|
if (FAILED(hr))
|
|
|
|
goto lerr;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2015-04-23 09:08:18 +02:00
|
|
|
hr = dup_partial_mediatype(pOutTypes, cOutTypes, &lpedmo->pOutTypes);
|
|
|
|
if (FAILED(hr))
|
|
|
|
goto lerr;
|
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))
|
|
|
|
{
|
2020-07-10 18:42:48 +02:00
|
|
|
RegOpenKeyExW(HKEY_CLASSES_ROOT, L"DirectShow\\MediaObjects", 0, KEY_READ, &lpedmo->hkey);
|
2014-10-15 06:26:08 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WCHAR szguid[64];
|
|
|
|
WCHAR szKey[MAX_PATH];
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2020-07-10 18:42:48 +02:00
|
|
|
swprintf(szKey, ARRAY_SIZE(szKey), L"DirectShow\\MediaObjects\\Categories\\%s",
|
|
|
|
GUIDToString(szguid, guidCategory));
|
2018-05-09 01:54:59 +02:00
|
|
|
RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &lpedmo->hkey);
|
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))
|
2015-04-22 22:06:35 +02:00
|
|
|
IEnumDMO_Release(&lpedmo->IEnumDMO_iface);
|
2014-10-15 06:26:08 +02:00
|
|
|
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;
|
2015-04-22 22:06:35 +02:00
|
|
|
IEnumDMO_AddRef(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
|
|
|
{
|
2015-04-22 22:06:35 +02:00
|
|
|
if (This->hkey)
|
|
|
|
RegCloseKey(This->hkey);
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->pInTypes);
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->pOutTypes);
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 18:42:49 +02:00
|
|
|
static BOOL any_types_match(const DMO_PARTIAL_MEDIATYPE *a, unsigned int a_count,
|
|
|
|
const DMO_PARTIAL_MEDIATYPE *b, unsigned int b_count)
|
|
|
|
{
|
|
|
|
unsigned int i, j;
|
|
|
|
|
|
|
|
for (i = 0; i < a_count; ++i)
|
|
|
|
{
|
|
|
|
for (j = 0; j < b_count; ++j)
|
|
|
|
{
|
|
|
|
if (IsMediaTypeEqual(&a[i], &b[j]))
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
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)
|
|
|
|
{
|
2020-07-10 18:42:50 +02:00
|
|
|
DMO_PARTIAL_MEDIATYPE *types = NULL;
|
|
|
|
unsigned int types_size = 0;
|
2003-11-25 01:55:57 +01:00
|
|
|
HKEY hkey;
|
|
|
|
WCHAR szNextKey[MAX_PATH];
|
2020-07-10 18:42:48 +02:00
|
|
|
WCHAR path[MAX_PATH];
|
2003-11-25 01:55:57 +01:00
|
|
|
WCHAR szValue[MAX_PATH];
|
|
|
|
DWORD len;
|
|
|
|
UINT count = 0;
|
|
|
|
HRESULT hres = S_OK;
|
2014-12-28 22:13:56 +01:00
|
|
|
LONG ret;
|
2003-11-25 01:55:57 +01:00
|
|
|
|
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
|
|
|
|
2019-02-24 20:46:34 +01:00
|
|
|
if (!pCLSID)
|
2003-11-25 01:55:57 +01:00
|
|
|
return E_POINTER;
|
|
|
|
|
2018-05-09 01:55:00 +02:00
|
|
|
if (!pcItemsFetched && cItemsToFetch > 1)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
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;
|
2015-04-23 10:13:10 +02:00
|
|
|
ret = RegEnumKeyExW(This->hkey, This->index, szNextKey, &len, NULL, NULL, NULL, NULL);
|
2014-12-28 22:13:56 +01:00
|
|
|
if (ret != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
hres = HRESULT_FROM_WIN32(ret);
|
2003-11-25 01:55:57 +01:00
|
|
|
break;
|
2014-12-28 22:13:56 +01:00
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2020-07-10 18:42:47 +02:00
|
|
|
if (string_to_guid(szNextKey, &pCLSID[count]) != S_OK)
|
2018-05-09 01:55:02 +02:00
|
|
|
continue;
|
|
|
|
|
2003-11-25 01:55:57 +01:00
|
|
|
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
|
|
|
{
|
2020-07-10 18:42:48 +02:00
|
|
|
swprintf(path, ARRAY_SIZE(path), L"DirectShow\\MediaObjects\\%s\\Keyed", szNextKey);
|
|
|
|
ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, path, 0, KEY_READ, &hkey);
|
2014-12-28 22:13:56 +01:00
|
|
|
if (ERROR_SUCCESS == ret)
|
2007-10-26 17:21:21 +02:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2020-07-10 18:42:48 +02:00
|
|
|
swprintf(path, ARRAY_SIZE(path), L"DirectShow\\MediaObjects\\%s", szNextKey);
|
|
|
|
ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, path, 0, KEY_READ, &hkey);
|
|
|
|
TRACE("Testing %s.\n", debugstr_w(path));
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
if (This->pInTypes)
|
|
|
|
{
|
2020-09-30 23:31:18 +02:00
|
|
|
DWORD size, i;
|
2007-10-10 17:13:49 +02:00
|
|
|
|
2020-09-30 23:31:18 +02:00
|
|
|
for (;;)
|
2020-07-10 18:42:50 +02:00
|
|
|
{
|
2020-09-30 23:31:18 +02:00
|
|
|
size = types_size;
|
|
|
|
ret = RegQueryValueExW(hkey, L"InputTypes", NULL, NULL, (BYTE *)types, &size);
|
|
|
|
if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA)
|
|
|
|
break;
|
|
|
|
if (size <= types_size)
|
|
|
|
break;
|
2020-07-10 18:42:50 +02:00
|
|
|
if (!array_reserve((void **)&types, &types_size, size, 1))
|
|
|
|
{
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
free(types);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ret)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-07-10 18:42:50 +02:00
|
|
|
for (i = 0; i < size / sizeof(DMO_PARTIAL_MEDIATYPE); ++i)
|
2020-05-07 16:31:16 +02:00
|
|
|
TRACE("intype %d: type %s, subtype %s\n", i, debugstr_guid(&types[i].type),
|
|
|
|
debugstr_guid(&types[i].subtype));
|
2015-04-23 10:13:10 +02:00
|
|
|
|
2020-07-10 18:42:50 +02:00
|
|
|
if (!any_types_match(types, size / sizeof(DMO_PARTIAL_MEDIATYPE), This->pInTypes, This->cInTypes))
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (This->pOutTypes)
|
|
|
|
{
|
2020-07-10 18:42:50 +02:00
|
|
|
DWORD size = types_size, i;
|
2007-10-10 17:13:49 +02:00
|
|
|
|
2020-09-30 23:31:18 +02:00
|
|
|
for (;;)
|
2020-07-10 18:42:50 +02:00
|
|
|
{
|
2020-09-30 23:31:18 +02:00
|
|
|
size = types_size;
|
|
|
|
ret = RegQueryValueExW(hkey, L"OutputTypes", NULL, NULL, (BYTE *)types, &size);
|
|
|
|
if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA)
|
|
|
|
break;
|
|
|
|
if (size <= types_size)
|
|
|
|
break;
|
2020-07-10 18:42:50 +02:00
|
|
|
if (!array_reserve((void **)&types, &types_size, size, 1))
|
|
|
|
{
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
free(types);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ret)
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-07-10 18:42:50 +02:00
|
|
|
for (i = 0; i < size / sizeof(DMO_PARTIAL_MEDIATYPE); ++i)
|
2020-05-07 16:31:16 +02:00
|
|
|
TRACE("outtype %d: type %s, subtype %s\n", i, debugstr_guid(&types[i].type),
|
|
|
|
debugstr_guid(&types[i].subtype));
|
2015-04-23 10:13:10 +02:00
|
|
|
|
2020-07-10 18:42:50 +02:00
|
|
|
if (!any_types_match(types, size / sizeof(DMO_PARTIAL_MEDIATYPE), This->pOutTypes, This->cOutTypes))
|
2003-11-25 01:55:57 +01:00
|
|
|
{
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-09 01:55:01 +02:00
|
|
|
/* Media object wasn't filtered so add it to return list */
|
|
|
|
len = MAX_PATH * sizeof(WCHAR);
|
2014-12-28 22:13:56 +01:00
|
|
|
ret = RegQueryValueExW(hkey, NULL, NULL, NULL, (LPBYTE)szValue, &len);
|
2019-02-24 20:46:34 +01:00
|
|
|
if (Names)
|
2018-05-09 01:55:01 +02:00
|
|
|
{
|
2019-02-24 20:46:34 +01:00
|
|
|
Names[count] = NULL;
|
|
|
|
if (ret == ERROR_SUCCESS)
|
|
|
|
{
|
2020-07-10 18:42:48 +02:00
|
|
|
Names[count] = CoTaskMemAlloc((wcslen(szValue) + 1) * sizeof(WCHAR));
|
2019-02-24 20:46:34 +01:00
|
|
|
if (Names[count])
|
2020-07-10 18:42:48 +02:00
|
|
|
wcscpy(Names[count], szValue);
|
2019-02-24 20:46:34 +01:00
|
|
|
}
|
2018-05-09 01:55:01 +02:00
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
|
|
|
|
TRACE("found match %s %s\n", debugstr_w(szValue), debugstr_w(szNextKey));
|
|
|
|
RegCloseKey(hkey);
|
2018-05-09 01:55:01 +02:00
|
|
|
count++;
|
2003-11-25 01:55:57 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 18:42:50 +02:00
|
|
|
free(types);
|
|
|
|
|
2018-05-09 01:55:00 +02:00
|
|
|
if (pcItemsFetched) *pcItemsFetched = count;
|
|
|
|
if (count < cItemsToFetch)
|
2003-11-25 01:55:57 +01:00
|
|
|
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);
|
2015-04-23 08:58:50 +02:00
|
|
|
return IEnumDMO_Constructor(&This->category, This->dwFlags, This->cInTypes, This->pInTypes,
|
2014-10-15 06:38:55 +02:00
|
|
|
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(
|
2015-04-23 08:58:50 +02:00
|
|
|
REFGUID category,
|
|
|
|
DWORD flags,
|
2003-11-25 01:55:57 +01:00
|
|
|
DWORD cInTypes,
|
|
|
|
const DMO_PARTIAL_MEDIATYPE *pInTypes,
|
|
|
|
DWORD cOutTypes,
|
|
|
|
const DMO_PARTIAL_MEDIATYPE *pOutTypes,
|
|
|
|
IEnumDMO **ppEnum)
|
|
|
|
{
|
2015-04-23 08:58:50 +02:00
|
|
|
TRACE("%s 0x%08x %d %p %d %p %p\n", debugstr_guid(category), flags, cInTypes, pInTypes,
|
|
|
|
cOutTypes, pOutTypes, ppEnum);
|
|
|
|
|
|
|
|
if (TRACE_ON(msdmo))
|
|
|
|
{
|
|
|
|
DWORD i;
|
|
|
|
if (cInTypes)
|
|
|
|
{
|
|
|
|
for (i = 0; i < cInTypes; i++)
|
|
|
|
TRACE("intype %d - type %s, subtype %s\n", i, debugstr_guid(&pInTypes[i].type),
|
|
|
|
debugstr_guid(&pInTypes[i].subtype));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cOutTypes) {
|
|
|
|
for (i = 0; i < cOutTypes; i++)
|
|
|
|
TRACE("outtype %d - type %s, subtype %s\n", i, debugstr_guid(&pOutTypes[i].type),
|
|
|
|
debugstr_guid(&pOutTypes[i].subtype));
|
|
|
|
}
|
|
|
|
}
|
2003-11-25 01:55:57 +01:00
|
|
|
|
2015-04-23 08:58:50 +02:00
|
|
|
return IEnumDMO_Constructor(category, flags, cInTypes,
|
2014-10-15 06:26:08 +02:00
|
|
|
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-14 14:35:51 +02:00
|
|
|
/***************************************************************
|
|
|
|
* DMOGetTypes (MSDMO.@)
|
|
|
|
*/
|
2020-07-13 16:38:02 +02:00
|
|
|
HRESULT WINAPI DMOGetTypes(REFCLSID clsid, ULONG input_count, ULONG *ret_input_count, DMO_PARTIAL_MEDIATYPE *input,
|
|
|
|
ULONG output_count, ULONG *ret_output_count, DMO_PARTIAL_MEDIATYPE *output)
|
2007-10-03 21:51:10 +02:00
|
|
|
{
|
2020-07-13 16:38:02 +02:00
|
|
|
WCHAR guidstr[64];
|
|
|
|
HKEY root, key;
|
|
|
|
LSTATUS ret;
|
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
TRACE("clsid %s, input_count %u, ret_input_count %p, input %p, output_count %u, ret_output_count %p, output %p.\n",
|
|
|
|
debugstr_guid(clsid), input_count, ret_input_count, input, output_count, ret_output_count, output);
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"DirectShow\\MediaObjects", 0, KEY_READ, &root))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(root, GUIDToString(guidstr, clsid), 0, KEY_READ, &key))
|
|
|
|
{
|
|
|
|
RegCloseKey(root);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ret_input_count = 0;
|
2020-07-13 16:38:03 +02:00
|
|
|
size = input_count * sizeof(DMO_PARTIAL_MEDIATYPE);
|
|
|
|
ret = RegQueryValueExW(key, L"InputTypes", NULL, NULL, (BYTE *)input, &size);
|
|
|
|
if (!ret || ret == ERROR_MORE_DATA)
|
|
|
|
*ret_input_count = min(input_count, size / sizeof(DMO_PARTIAL_MEDIATYPE));
|
2020-07-13 16:38:02 +02:00
|
|
|
|
|
|
|
*ret_output_count = 0;
|
2020-07-13 16:38:03 +02:00
|
|
|
size = output_count * sizeof(DMO_PARTIAL_MEDIATYPE);
|
|
|
|
ret = RegQueryValueExW(key, L"OutputTypes", NULL, NULL, (BYTE *)output, &size);
|
|
|
|
if (!ret || ret == ERROR_MORE_DATA)
|
|
|
|
*ret_output_count = min(output_count, size / sizeof(DMO_PARTIAL_MEDIATYPE));
|
2020-07-13 16:38:02 +02:00
|
|
|
|
2020-07-13 16:38:04 +02:00
|
|
|
RegCloseKey(key);
|
|
|
|
RegCloseKey(root);
|
2020-07-13 16:38:02 +02:00
|
|
|
return S_OK;
|
2003-07-21 22:03:50 +02:00
|
|
|
}
|