ReactOS 0.4.17-dev-966-gf06eace
mediacatenum.c File Reference
#include "devenum_private.h"
#include "wine/debug.h"
Include dependency graph for mediacatenum.c:

Go to the source code of this file.

Classes

struct  EnumMonikerImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (devenum)
 
BOOL array_reserve (void **elements, unsigned int *capacity, unsigned int count, unsigned int size)
 
static struct moniker * impl_from_IPropertyBag (IPropertyBag *iface)
 
static HRESULT WINAPI property_bag_QueryInterface (IPropertyBag *iface, REFIID iid, void **out)
 
static ULONG WINAPI property_bag_AddRef (IPropertyBag *iface)
 
static ULONG WINAPI property_bag_Release (IPropertyBag *iface)
 
static HRESULT WINAPI property_bag_Read (IPropertyBag *iface, const WCHAR *name, VARIANT *var, IErrorLog *errorlog)
 
static HRESULT WINAPI property_bag_Write (IPropertyBag *iface, const WCHAR *name, VARIANT *var)
 
static struct moniker * impl_from_IMoniker (IMoniker *iface)
 
static HRESULT WINAPI moniker_QueryInterface (IMoniker *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI moniker_AddRef (IMoniker *iface)
 
static ULONG WINAPI moniker_Release (IMoniker *iface)
 
static HRESULT WINAPI moniker_GetClassID (IMoniker *iface, CLSID *pClassID)
 
static HRESULT WINAPI moniker_IsDirty (IMoniker *iface)
 
static HRESULT WINAPI moniker_Load (IMoniker *iface, IStream *pStm)
 
static HRESULT WINAPI moniker_Save (IMoniker *iface, IStream *pStm, BOOL fClearDirty)
 
static HRESULT WINAPI moniker_GetSizeMax (IMoniker *iface, ULARGE_INTEGER *pcbSize)
 
static HRESULT WINAPI moniker_BindToObject (IMoniker *iface, IBindCtx *bind_ctx, IMoniker *left, REFIID iid, void **out)
 
static HRESULT WINAPI moniker_BindToStorage (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, void **out)
 
static HRESULT WINAPI moniker_Reduce (IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
 
static HRESULT WINAPI moniker_ComposeWith (IMoniker *iface, IMoniker *pmkRight, BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite)
 
static HRESULT WINAPI moniker_Enum (IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker)
 
static HRESULT WINAPI moniker_IsEqual (IMoniker *iface, IMoniker *pmkOtherMoniker)
 
static HRESULT WINAPI moniker_Hash (IMoniker *iface, DWORD *pdwHash)
 
static HRESULT WINAPI moniker_IsRunning (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
 
static HRESULT WINAPI moniker_GetTimeOfLastChange (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime)
 
static HRESULT WINAPI moniker_Inverse (IMoniker *iface, IMoniker **ppmk)
 
static HRESULT WINAPI moniker_CommonPrefixWith (IMoniker *iface, IMoniker *pmkOtherMoniker, IMoniker **ppmkPrefix)
 
static HRESULT WINAPI moniker_RelativePathTo (IMoniker *iface, IMoniker *pmkOther, IMoniker **ppmkRelPath)
 
static HRESULT WINAPI moniker_GetDisplayName (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
 
static HRESULT WINAPI moniker_ParseDisplayName (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
 
static HRESULT WINAPI moniker_IsSystemMoniker (IMoniker *iface, DWORD *pdwMksys)
 
struct moniker * filter_moniker_create (const GUID *class, const WCHAR *name)
 
struct moniker * codec_moniker_create (const GUID *class, const WCHAR *name)
 
struct moniker * dmo_moniker_create (const GUID class, const GUID clsid)
 
static EnumMonikerImpl * impl_from_IEnumMoniker (IEnumMoniker *iface)
 
static HRESULT WINAPI enum_moniker_QueryInterface (IEnumMoniker *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI enum_moniker_AddRef (IEnumMoniker *iface)
 
static ULONG WINAPI enum_moniker_Release (IEnumMoniker *iface)
 
static struct moniker * get_dmo_moniker (EnumMonikerImpl *enum_moniker)
 
static HRESULT WINAPI enum_moniker_Next (IEnumMoniker *iface, ULONG celt, IMoniker **rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI enum_moniker_Skip (IEnumMoniker *iface, ULONG celt)
 
static HRESULT WINAPI enum_moniker_Reset (IEnumMoniker *iface)
 
static HRESULT WINAPI enum_moniker_Clone (IEnumMoniker *iface, IEnumMoniker **ppenum)
 
HRESULT enum_moniker_create (REFCLSID class, IEnumMoniker **out)
 

Variables

static const IPropertyBagVtbl IPropertyBag_Vtbl
 
static const IMonikerVtbl IMoniker_Vtbl
 
static const IEnumMonikerVtbl IEnumMoniker_Vtbl
 

Function Documentation

◆ array_reserve()

BOOL array_reserve ( void **  elements,
unsigned int *  capacity,
unsigned int  count,
unsigned int  size 
)

Definition at line 31 of file mediacatenum.c.

32{
33 unsigned int max_capacity, new_capacity;
34 void *new_elements;
35
36 if (count <= *capacity)
37 return TRUE;
38
39 max_capacity = ~0u / size;
40 if (count > max_capacity)
41 return FALSE;
42
43 new_capacity = max(8, *capacity);
44 while (new_capacity < count && new_capacity <= max_capacity / 2)
45 new_capacity *= 2;
46 if (new_capacity < count)
47 new_capacity = count;
48
49 if (!(new_elements = realloc(*elements, new_capacity * size)))
50 {
51 ERR("Failed to allocate memory.\n");
52 return FALSE;
53 }
54
55 *elements = new_elements;
56 *capacity = new_capacity;
57 return TRUE;
58}
#define ERR(fmt,...)
Definition: precomp.h:57
#define realloc
Definition: debug_ros.c:6
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define max(a, b)
Definition: svc.c:63

◆ codec_moniker_create()

struct moniker * codec_moniker_create ( const GUID *  class,
const WCHAR *  name 
)

Definition at line 815 of file mediacatenum.c.

816{
817 struct moniker *object;
818
819 if (!(object = calloc(1, sizeof(*object))))
820 return NULL;
821
822 object->IMoniker_iface.lpVtbl = &IMoniker_Vtbl;
823 object->IPropertyBag_iface.lpVtbl = &IPropertyBag_Vtbl;
824 object->ref = 1;
825 object->type = DEVICE_CODEC;
826 if (class)
827 object->class = *class;
828 object->has_class = !!class;
829 object->name = wcsdup(name);
830
831 return object;
832}
@ DEVICE_CODEC
#define NULL
Definition: types.h:112
static wchar_t * wcsdup(const wchar_t *str)
Definition: string.h:94
static const IPropertyBagVtbl IPropertyBag_Vtbl
Definition: mediacatenum.c:384
static const IMonikerVtbl IMoniker_Vtbl
Definition: mediacatenum.c:769
#define calloc
Definition: rosglue.h:14
Definition: name.c:39

Referenced by devenum_parser_ParseDisplayName(), and enum_moniker_Next().

◆ dmo_moniker_create()

struct moniker * dmo_moniker_create ( const GUID  class,
const GUID  clsid 
)

Definition at line 834 of file mediacatenum.c.

835{
836 struct moniker *object;
837
838 if (!(object = calloc(1, sizeof(*object))))
839 return NULL;
840
841 object->IMoniker_iface.lpVtbl = &IMoniker_Vtbl;
842 object->IPropertyBag_iface.lpVtbl = &IPropertyBag_Vtbl;
843 object->ref = 1;
844 object->type = DEVICE_DMO;
845 object->class = class;
846 object->clsid = clsid;
847
848 return object;
849}
@ DEVICE_DMO
const CLSID * clsid
Definition: msctf.cpp:50

Referenced by devenum_parser_ParseDisplayName(), and get_dmo_moniker().

◆ enum_moniker_AddRef()

static ULONG WINAPI enum_moniker_AddRef ( IEnumMoniker *  iface)
static

Definition at line 876 of file mediacatenum.c.

877{
878 EnumMonikerImpl *enumerator = impl_from_IEnumMoniker(iface);
879 ULONG refcount = InterlockedIncrement(&enumerator->ref);
880
881 TRACE("%p increasing refcount to %lu.\n", enumerator, refcount);
882
883 return refcount;
884}
#define InterlockedIncrement
Definition: armddk.h:53
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
Definition: mediacatenum.c:851
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t ULONG
Definition: typedefs.h:59

◆ enum_moniker_Clone()

static HRESULT WINAPI enum_moniker_Clone ( IEnumMoniker *  iface,
IEnumMoniker **  ppenum 
)
static

Definition at line 1033 of file mediacatenum.c.

1034{
1035 FIXME("(%p)->(%p): stub\n", iface, ppenum);
1036
1037 return E_NOTIMPL;
1038}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ enum_moniker_create()

HRESULT enum_moniker_create ( REFCLSID  class,
IEnumMoniker **  out 
)

Definition at line 1054 of file mediacatenum.c.

1055{
1057 WCHAR buffer[78];
1058
1059 if (!(object = calloc(1, sizeof(*object))))
1060 return E_OUTOFMEMORY;
1061
1062 object->IEnumMoniker_iface.lpVtbl = &IEnumMoniker_Vtbl;
1063 object->ref = 1;
1064 object->class = *class;
1065
1066 wcscpy(buffer, L"CLSID\\");
1068 wcscat(buffer, L"\\Instance");
1070 object->sw_key = NULL;
1071
1072 wcscpy(buffer, L"Software\\Microsoft\\ActiveMovie\\devenum\\");
1075 object->cm_key = NULL;
1076
1077 if (IsEqualGUID(class, &CLSID_LegacyAmFilterCategory))
1078 {
1079 if (FAILED(DMOEnum(&DMOCATEGORY_AUDIO_DECODER, 0, 0, NULL, 0, NULL, &object->dmo_enum)))
1080 object->dmo_enum = NULL;
1081 if (FAILED(DMOEnum(&DMOCATEGORY_VIDEO_DECODER, 0, 0, NULL, 0, NULL, &object->dmo_enum2)))
1082 object->dmo_enum2 = NULL;
1083 }
1084 else
1085 {
1086 if (FAILED(DMOEnum(class, 0, 0, NULL, 0, NULL, &object->dmo_enum)))
1087 object->dmo_enum = NULL;
1088 }
1089
1090 *out = &object->IEnumMoniker_iface;
1091
1092 return S_OK;
1093}
#define CHARS_IN_GUID
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
HRESULT WINAPI DMOEnum(REFGUID category, DWORD flags, DWORD cInTypes, const DMO_PARTIAL_MEDIATYPE *pInTypes, DWORD cOutTypes, const DMO_PARTIAL_MEDIATYPE *pOutTypes, IEnumDMO **ppEnum)
Definition: dmoreg.c:674
#define L(x)
Definition: resources.c:13
GLuint buffer
Definition: glext.h:5915
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
static const IEnumMonikerVtbl IEnumMoniker_Vtbl
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1022
short WCHAR
Definition: pedump.c:58
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
wcscat
wcscpy
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by devenum_factory_CreateClassEnumerator().

◆ enum_moniker_Next()

static HRESULT WINAPI enum_moniker_Next ( IEnumMoniker *  iface,
ULONG  celt,
IMoniker **  rgelt,
ULONG *  pceltFetched 
)
static

Definition at line 927 of file mediacatenum.c.

929{
931 WCHAR buffer[MAX_PATH + 1];
932 struct moniker *moniker;
933 LONG res;
934 ULONG fetched = 0;
935 HKEY hkey;
936
937 TRACE("enumerator %p, count %lu, monikers %p, ret_count %p.\n", This, celt, rgelt, pceltFetched);
938
939 while (fetched < celt)
940 {
941 /* FIXME: try PNP devices first */
942
943 /* try DMOs */
945 ;
946 /* try DirectShow filters */
947 else if (!(res = RegEnumKeyW(This->sw_key, This->sw_index, buffer, ARRAY_SIZE(buffer))))
948 {
949 This->sw_index++;
950 if ((res = RegOpenKeyExW(This->sw_key, buffer, 0, KEY_QUERY_VALUE, &hkey)))
951 break;
952
954 }
955 /* then try codecs */
956 else if (!(res = RegEnumKeyW(This->cm_key, This->cm_index, buffer, ARRAY_SIZE(buffer))))
957 {
958 This->cm_index++;
959
960 if ((res = RegOpenKeyExW(This->cm_key, buffer, 0, KEY_QUERY_VALUE, &hkey)))
961 break;
962
964 }
965 else
966 break;
967
968 if (!moniker)
969 return E_OUTOFMEMORY;
970
971 rgelt[fetched++] = &moniker->IMoniker_iface;
972 }
973
974 TRACE("Returning %lu monikers.\n", fetched);
975
976 if (pceltFetched)
977 *pceltFetched = fetched;
978
979 if (fetched != celt)
980 return S_FALSE;
981 else
982 return S_OK;
983}
#define ARRAY_SIZE(A)
Definition: main.h:20
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2393
#define MAX_PATH
Definition: compat.h:34
GLuint res
Definition: glext.h:9613
struct moniker * filter_moniker_create(const GUID *class, const WCHAR *name)
Definition: mediacatenum.c:796
static struct moniker * get_dmo_moniker(EnumMonikerImpl *enum_moniker)
Definition: mediacatenum.c:907
struct moniker * codec_moniker_create(const GUID *class, const WCHAR *name)
Definition: mediacatenum.c:815
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
long LONG
Definition: pedump.c:60
IMoniker IMoniker_iface
#define S_FALSE
Definition: winerror.h:3451

◆ enum_moniker_QueryInterface()

static HRESULT WINAPI enum_moniker_QueryInterface ( IEnumMoniker *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 856 of file mediacatenum.c.

857{
858 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
859
860 if (!ppv)
861 return E_POINTER;
862
865 {
866 *ppv = iface;
867 IEnumMoniker_AddRef(iface);
868 return S_OK;
869 }
870
871 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
872 *ppv = NULL;
873 return E_NOINTERFACE;
874}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IEnumMoniker
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480

◆ enum_moniker_Release()

static ULONG WINAPI enum_moniker_Release ( IEnumMoniker *  iface)
static

Definition at line 886 of file mediacatenum.c.

887{
889 ULONG refcount = InterlockedDecrement(&This->ref);
890
891 TRACE("%p decreasing refcount to %lu.\n", This, refcount);
892
893 if (!refcount)
894 {
895 if (This->dmo_enum)
896 IEnumDMO_Release(This->dmo_enum);
897 if (This->dmo_enum2)
898 IEnumDMO_Release(This->dmo_enum2);
899 RegCloseKey(This->sw_key);
900 RegCloseKey(This->cm_key);
901 free(This);
902 return 0;
903 }
904 return refcount;
905}
#define InterlockedDecrement
Definition: armddk.h:52
#define RegCloseKey(hKey)
Definition: registry.h:49
#define free
Definition: debug_ros.c:5

◆ enum_moniker_Reset()

static HRESULT WINAPI enum_moniker_Reset ( IEnumMoniker *  iface)
static

Definition at line 1017 of file mediacatenum.c.

1018{
1020
1021 TRACE("(%p)->()\n", iface);
1022
1023 if (This->dmo_enum)
1024 IEnumDMO_Reset(This->dmo_enum);
1025 if (This->dmo_enum2)
1026 IEnumDMO_Reset(This->dmo_enum2);
1027 This->sw_index = 0;
1028 This->cm_index = 0;
1029
1030 return S_OK;
1031}

◆ enum_moniker_Skip()

static HRESULT WINAPI enum_moniker_Skip ( IEnumMoniker *  iface,
ULONG  celt 
)
static

Definition at line 985 of file mediacatenum.c.

986{
988
989 TRACE("enumerator %p, count %lu.\n", This, celt);
990
991 while (celt--)
992 {
993 /* FIXME: try PNP devices first */
994
995 /* try DMOs */
996 if (This->dmo_enum && IEnumDMO_Skip(This->dmo_enum, 1) == S_OK)
997 ;
998 else if (This->dmo_enum2 && IEnumDMO_Skip(This->dmo_enum2, 1) == S_OK)
999 ;
1000 /* try DirectShow filters */
1001 else if (RegEnumKeyW(This->sw_key, This->sw_index, NULL, 0) != ERROR_NO_MORE_ITEMS)
1002 {
1003 This->sw_index++;
1004 }
1005 /* then try codecs */
1006 else if (RegEnumKeyW(This->cm_key, This->cm_index, NULL, 0) != ERROR_NO_MORE_ITEMS)
1007 {
1008 This->cm_index++;
1009 }
1010 else
1011 return S_FALSE;
1012 }
1013
1014 return S_OK;
1015}
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105

◆ filter_moniker_create()

struct moniker * filter_moniker_create ( const GUID *  class,
const WCHAR *  name 
)

Definition at line 796 of file mediacatenum.c.

797{
798 struct moniker *object;
799
800 if (!(object = calloc(1, sizeof(*object))))
801 return NULL;
802
803 object->IMoniker_iface.lpVtbl = &IMoniker_Vtbl;
804 object->IPropertyBag_iface.lpVtbl = &IPropertyBag_Vtbl;
805 object->ref = 1;
806 object->type = DEVICE_FILTER;
807 if (class)
808 object->class = *class;
809 object->has_class = !!class;
810 object->name = wcsdup(name);
811
812 return object;
813}
@ DEVICE_FILTER

Referenced by devenum_parser_ParseDisplayName(), and enum_moniker_Next().

◆ get_dmo_moniker()

static struct moniker * get_dmo_moniker ( EnumMonikerImpl *  enum_moniker)
static

Definition at line 907 of file mediacatenum.c.

908{
909 GUID clsid;
910
911 if (IsEqualGUID(&enum_moniker->class, &CLSID_LegacyAmFilterCategory))
912 {
913 if (enum_moniker->dmo_enum && IEnumDMO_Next(enum_moniker->dmo_enum, 1, &clsid, NULL, NULL) == S_OK)
914 return dmo_moniker_create(DMOCATEGORY_AUDIO_DECODER, clsid);
915 if (enum_moniker->dmo_enum2 && IEnumDMO_Next(enum_moniker->dmo_enum2, 1, &clsid, NULL, NULL) == S_OK)
916 return dmo_moniker_create(DMOCATEGORY_VIDEO_DECODER, clsid);
917 }
918 else
919 {
920 if (enum_moniker->dmo_enum && IEnumDMO_Next(enum_moniker->dmo_enum, 1, &clsid, NULL, NULL) == S_OK)
921 return dmo_moniker_create(enum_moniker->class, clsid);
922 }
923
924 return NULL;
925}
struct moniker * dmo_moniker_create(const GUID class, const GUID clsid)
Definition: mediacatenum.c:834

Referenced by enum_moniker_Next().

◆ impl_from_IEnumMoniker()

static EnumMonikerImpl * impl_from_IEnumMoniker ( IEnumMoniker *  iface)
inlinestatic

Definition at line 851 of file mediacatenum.c.

852{
853 return CONTAINING_RECORD(iface, EnumMonikerImpl, IEnumMoniker_iface);
854}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by enum_moniker_AddRef(), enum_moniker_Next(), enum_moniker_Release(), enum_moniker_Reset(), and enum_moniker_Skip().

◆ impl_from_IMoniker()

static struct moniker * impl_from_IMoniker ( IMoniker *  iface)
inlinestatic

◆ impl_from_IPropertyBag()

static struct moniker * impl_from_IPropertyBag ( IPropertyBag *  iface)
inlinestatic

Definition at line 72 of file mediacatenum.c.

73{
74 return CONTAINING_RECORD(iface, struct moniker, IPropertyBag_iface);
75}

Referenced by property_bag_AddRef(), property_bag_QueryInterface(), property_bag_Read(), property_bag_Release(), and property_bag_Write().

◆ moniker_AddRef()

static ULONG WINAPI moniker_AddRef ( IMoniker *  iface)
static

Definition at line 420 of file mediacatenum.c.

421{
422 struct moniker *moniker = impl_from_IMoniker(iface);
424
425 TRACE("%p increasing refcount to %lu.\n", moniker, refcount);
426
427 return refcount;
428}
static struct moniker * impl_from_IMoniker(IMoniker *iface)
Definition: mediacatenum.c:393

◆ moniker_BindToObject()

static HRESULT WINAPI moniker_BindToObject ( IMoniker *  iface,
IBindCtx *  bind_ctx,
IMoniker *  left,
REFIID  iid,
void **  out 
)
static

Definition at line 489 of file mediacatenum.c.

491{
492 struct moniker *moniker = impl_from_IMoniker(iface);
493 IPersistPropertyBag *persist_bag;
494 IUnknown *unk;
495 CLSID clsid;
496 VARIANT var;
497 HRESULT hr;
498
499 TRACE("moniker %p, bind_ctx %p, left %p, iid %s, out %p.\n",
500 moniker, bind_ctx, left, debugstr_guid(iid), out);
501
502 if (!out)
503 return E_POINTER;
504
505 *out = NULL;
506
507 if (moniker->type == DEVICE_DMO)
508 {
509 IDMOWrapperFilter *wrapper;
510
511 if (FAILED(hr = CoCreateInstance(&CLSID_DMOWrapperFilter, NULL,
512 CLSCTX_INPROC_SERVER, &IID_IDMOWrapperFilter, (void **)&wrapper)))
513 return hr;
514
515 if (SUCCEEDED(hr = IDMOWrapperFilter_Init(wrapper, &moniker->clsid, &moniker->class)))
516 {
517 hr = IDMOWrapperFilter_QueryInterface(wrapper, iid, out);
518 }
519 IDMOWrapperFilter_Release(wrapper);
520 return hr;
521 }
522
524 V_VT(&var) = VT_BSTR;
525 if (FAILED(hr = IPropertyBag_Read(&moniker->IPropertyBag_iface, L"CLSID", &var, NULL)))
526 return hr;
527
530 if (FAILED(hr))
531 return hr;
532
533 if (FAILED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_ALL, &IID_IUnknown, (void **)&unk)))
534 return hr;
535
536 if (SUCCEEDED(IUnknown_QueryInterface(unk, &IID_IPersistPropertyBag, (void **)&persist_bag)))
537 {
538 hr = IPersistPropertyBag_Load(persist_bag, &moniker->IPropertyBag_iface, NULL);
539 IPersistPropertyBag_Release(persist_bag);
540 }
541
542 if (SUCCEEDED(hr))
543 hr = IUnknown_QueryInterface(unk, iid, out);
544
545 IUnknown_Release(unk);
546
547 return hr;
548}
HRESULT hr
Definition: delayimp.cpp:582
HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
Definition: combase.c:1470
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
@ VT_BSTR
Definition: compat.h:2303
GLint left
Definition: glext.h:7726
#define SUCCEEDED(hr)
Definition: intsafe.h:50
const char * var
Definition: shader.c:5879
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
const GUID IID_IPersistPropertyBag
Definition: proxy.cpp:11
CLSID class
IPropertyBag IPropertyBag_iface
CLSID clsid
enum device_type type
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:626
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:547

◆ moniker_BindToStorage()

static HRESULT WINAPI moniker_BindToStorage ( IMoniker *  iface,
IBindCtx *  pbc,
IMoniker *  pmkToLeft,
REFIID  riid,
void **  out 
)
static

Definition at line 550 of file mediacatenum.c.

552{
553 struct moniker *moniker = impl_from_IMoniker(iface);
554
555 TRACE("moniker %p, left %p, iid %s, out %p.\n", moniker, pmkToLeft, debugstr_guid(riid), out);
556
557 *out = NULL;
558
559 if (pmkToLeft)
560 return MK_E_NOSTORAGE;
561
562 if (pbc != NULL)
563 {
564 static DWORD reported;
565 if (!reported)
566 {
567 FIXME("ignoring IBindCtx %p\n", pbc);
568 reported++;
569 }
570 }
571
573 {
575 IPropertyBag_AddRef(&moniker->IPropertyBag_iface);
576 return S_OK;
577 }
578
579 return MK_E_NOSTORAGE;
580}
unsigned long DWORD
Definition: ntddk_ex.h:95
const GUID IID_IPropertyBag
#define MK_E_NOSTORAGE
Definition: winerror.h:3908

◆ moniker_CommonPrefixWith()

static HRESULT WINAPI moniker_CommonPrefixWith ( IMoniker *  iface,
IMoniker *  pmkOtherMoniker,
IMoniker **  ppmkPrefix 
)
static

Definition at line 689 of file mediacatenum.c.

691{
692 TRACE("(%p)->(%p, %p)\n", iface, pmkOtherMoniker, ppmkPrefix);
693
694 *ppmkPrefix = NULL;
695
696 return MK_E_NOPREFIX;
697}
#define MK_E_NOPREFIX
Definition: winerror.h:3909

◆ moniker_ComposeWith()

static HRESULT WINAPI moniker_ComposeWith ( IMoniker *  iface,
IMoniker *  pmkRight,
BOOL  fOnlyIfNotGeneric,
IMoniker **  ppmkComposite 
)
static

Definition at line 597 of file mediacatenum.c.

599{
600 FIXME("(%p)->(%p, %s, %p): stub\n", iface, pmkRight, fOnlyIfNotGeneric ? "true" : "false", ppmkComposite);
601
602 /* FIXME: use CreateGenericComposite? */
603 *ppmkComposite = NULL;
604
605 return E_NOTIMPL;
606}

◆ moniker_Enum()

static HRESULT WINAPI moniker_Enum ( IMoniker *  iface,
BOOL  fForward,
IEnumMoniker **  ppenumMoniker 
)
static

Definition at line 608 of file mediacatenum.c.

610{
611 FIXME("(%p)->(%s, %p): stub\n", iface, fForward ? "true" : "false", ppenumMoniker);
612
613 *ppenumMoniker = NULL;
614
615 return S_OK;
616}

◆ moniker_GetClassID()

static HRESULT WINAPI moniker_GetClassID ( IMoniker *  iface,
CLSID *  pClassID 
)
static

Definition at line 445 of file mediacatenum.c.

446{
447 struct moniker *This = impl_from_IMoniker(iface);
448
449 TRACE("(%p)->(%p)\n", This, pClassID);
450
451 if (pClassID == NULL)
452 return E_INVALIDARG;
453
454 *pClassID = CLSID_CDeviceMoniker;
455
456 return S_OK;
457}
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ moniker_GetDisplayName()

static HRESULT WINAPI moniker_GetDisplayName ( IMoniker *  iface,
IBindCtx *  pbc,
IMoniker *  pmkToLeft,
LPOLESTR *  ppszDisplayName 
)
static

Definition at line 709 of file mediacatenum.c.

711{
712 struct moniker *This = impl_from_IMoniker(iface);
713 WCHAR *buffer;
714
715 TRACE("(%p)->(%p, %p, %p)\n", iface, pbc, pmkToLeft, ppszDisplayName);
716
717 *ppszDisplayName = NULL;
718
719 if (This->type == DEVICE_DMO)
720 {
721 buffer = CoTaskMemAlloc((12 + 2 * CHARS_IN_GUID + 1) * sizeof(WCHAR));
722 if (!buffer) return E_OUTOFMEMORY;
723
724 wcscpy(buffer, L"@device:dmo:");
727 }
728 else
729 {
730 buffer = CoTaskMemAlloc((11 + (This->has_class ? CHARS_IN_GUID : 0)
731 + wcslen(This->name) + 1) * sizeof(WCHAR));
732 if (!buffer) return E_OUTOFMEMORY;
733
734 if (This->type == DEVICE_FILTER)
735 wcscpy(buffer, L"@device:sw:");
736 else if (This->type == DEVICE_CODEC)
737 wcscpy(buffer, L"@device:cm:");
738
739 if (This->has_class)
740 {
742 wcscat(buffer, L"\\");
743 }
744 wcscat(buffer, This->name);
745 }
746
747 *ppszDisplayName = buffer;
748 return S_OK;
749}
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381

◆ moniker_GetSizeMax()

static HRESULT WINAPI moniker_GetSizeMax ( IMoniker *  iface,
ULARGE_INTEGER *  pcbSize 
)
static

Definition at line 480 of file mediacatenum.c.

481{
482 FIXME("(%p)->(%p): stub\n", iface, pcbSize);
483
484 ZeroMemory(pcbSize, sizeof(*pcbSize));
485
486 return S_OK;
487}
#define ZeroMemory
Definition: minwinbase.h:31

◆ moniker_GetTimeOfLastChange()

static HRESULT WINAPI moniker_GetTimeOfLastChange ( IMoniker *  iface,
IBindCtx *  pbc,
IMoniker *  pmkToLeft,
FILETIME *  pFileTime 
)
static

Definition at line 669 of file mediacatenum.c.

671{
672 TRACE("(%p)->(%p, %p, %p)\n", iface, pbc, pmkToLeft, pFileTime);
673
674 pFileTime->dwLowDateTime = 0xFFFFFFFF;
675 pFileTime->dwHighDateTime = 0x7FFFFFFF;
676
677 return MK_E_UNAVAILABLE;
678}
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
#define MK_E_UNAVAILABLE
Definition: winerror.h:3894

◆ moniker_Hash()

static HRESULT WINAPI moniker_Hash ( IMoniker *  iface,
DWORD *  pdwHash 
)
static

Definition at line 652 of file mediacatenum.c.

653{
654 TRACE("(%p)->(%p)\n", iface, pdwHash);
655
656 *pdwHash = 0;
657
658 return S_OK;
659}

◆ moniker_Inverse()

static HRESULT WINAPI moniker_Inverse ( IMoniker *  iface,
IMoniker **  ppmk 
)
static

Definition at line 680 of file mediacatenum.c.

681{
682 TRACE("(%p)->(%p)\n", iface, ppmk);
683
684 *ppmk = NULL;
685
686 return MK_E_NOINVERSE;
687}
#define MK_E_NOINVERSE
Definition: winerror.h:3907

◆ moniker_IsDirty()

static HRESULT WINAPI moniker_IsDirty ( IMoniker *  iface)
static

Definition at line 459 of file mediacatenum.c.

460{
461 FIXME("(%p)->(): stub\n", iface);
462
463 return S_FALSE;
464}

◆ moniker_IsEqual()

static HRESULT WINAPI moniker_IsEqual ( IMoniker *  iface,
IMoniker *  pmkOtherMoniker 
)
static

Definition at line 618 of file mediacatenum.c.

619{
620 CLSID clsid;
621 LPOLESTR this_name, other_name;
622 IBindCtx *bind;
623 HRESULT res;
624
625 TRACE("(%p)->(%p)\n", iface, pmkOtherMoniker);
626
627 if (!pmkOtherMoniker)
628 return E_INVALIDARG;
629
630 IMoniker_GetClassID(pmkOtherMoniker, &clsid);
631 if (!IsEqualCLSID(&clsid, &CLSID_CDeviceMoniker))
632 return S_FALSE;
633
634 res = CreateBindCtx(0, &bind);
635 if (FAILED(res))
636 return res;
637
638 res = S_FALSE;
639 if (SUCCEEDED(IMoniker_GetDisplayName(iface, bind, NULL, &this_name)) &&
640 SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker, bind, NULL, &other_name)))
641 {
642 int result = wcsicmp(this_name, other_name);
643 CoTaskMemFree(this_name);
644 CoTaskMemFree(other_name);
645 if (!result)
646 res = S_OK;
647 }
648 IBindCtx_Release(bind);
649 return res;
650}
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define wcsicmp
Definition: compat.h:15
GLuint64EXT * result
Definition: glext.h:11304
HRESULT WINAPI CreateBindCtx(DWORD reserved, IBindCtx **bind_context)
Definition: bindctx.c:491
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36

◆ moniker_IsRunning()

static HRESULT WINAPI moniker_IsRunning ( IMoniker *  iface,
IBindCtx *  pbc,
IMoniker *  pmkToLeft,
IMoniker *  pmkNewlyRunning 
)
static

Definition at line 661 of file mediacatenum.c.

663{
664 FIXME("(%p)->(%p, %p, %p): stub\n", iface, pbc, pmkToLeft, pmkNewlyRunning);
665
666 return S_FALSE;
667}

◆ moniker_IsSystemMoniker()

static HRESULT WINAPI moniker_IsSystemMoniker ( IMoniker *  iface,
DWORD *  pdwMksys 
)
static

Definition at line 762 of file mediacatenum.c.

763{
764 TRACE("(%p)->(%p)\n", iface, pdwMksys);
765
766 return S_FALSE;
767}

◆ moniker_Load()

static HRESULT WINAPI moniker_Load ( IMoniker *  iface,
IStream *  pStm 
)
static

Definition at line 466 of file mediacatenum.c.

467{
468 FIXME("(%p)->(%p): stub\n", iface, pStm);
469
470 return E_NOTIMPL;
471}

◆ moniker_ParseDisplayName()

static HRESULT WINAPI moniker_ParseDisplayName ( IMoniker *  iface,
IBindCtx *  pbc,
IMoniker *  pmkToLeft,
LPOLESTR  pszDisplayName,
ULONG *  pchEaten,
IMoniker **  ppmkOut 
)
static

Definition at line 751 of file mediacatenum.c.

753{
754 FIXME("(%p)->(%p, %p, %s, %p, %p)\n", iface, pbc, pmkToLeft, debugstr_w(pszDisplayName), pchEaten, ppmkOut);
755
756 *pchEaten = 0;
757 *ppmkOut = NULL;
758
759 return MK_E_SYNTAX;
760}
#define debugstr_w
Definition: kernel32.h:32
#define MK_E_SYNTAX
Definition: winerror.h:3896

◆ moniker_QueryInterface()

static HRESULT WINAPI moniker_QueryInterface ( IMoniker *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 398 of file mediacatenum.c.

399{
400 TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
401
402 if (!ppv)
403 return E_POINTER;
404
408 IsEqualGUID(riid, &IID_IMoniker))
409 {
410 *ppv = iface;
411 IMoniker_AddRef(iface);
412 return S_OK;
413 }
414
415 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
416 *ppv = NULL;
417 return E_NOINTERFACE;
418}
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistStream
Definition: proxy.cpp:13

◆ moniker_Reduce()

static HRESULT WINAPI moniker_Reduce ( IMoniker *  iface,
IBindCtx *  pbc,
DWORD  dwReduceHowFar,
IMoniker **  ppmkToLeft,
IMoniker **  ppmkReduced 
)
static

Definition at line 582 of file mediacatenum.c.

584{
585 struct moniker *moniker = impl_from_IMoniker(iface);
586
587 TRACE("moniker %p, bind_ctx %p, how_far %#lx, left %p, reduced %p.\n",
588 moniker, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
589
590 if (ppmkToLeft)
591 *ppmkToLeft = NULL;
592 *ppmkReduced = iface;
593
595}
#define MK_S_REDUCED_TO_SELF
Definition: winerror.h:3892

◆ moniker_RelativePathTo()

static HRESULT WINAPI moniker_RelativePathTo ( IMoniker *  iface,
IMoniker *  pmkOther,
IMoniker **  ppmkRelPath 
)
static

Definition at line 699 of file mediacatenum.c.

701{
702 TRACE("(%p)->(%p, %p)\n", iface, pmkOther, ppmkRelPath);
703
704 *ppmkRelPath = pmkOther;
705
706 return MK_S_HIM;
707}
#define MK_S_HIM
Definition: winerror.h:3897

◆ moniker_Release()

static ULONG WINAPI moniker_Release ( IMoniker *  iface)
static

Definition at line 430 of file mediacatenum.c.

431{
432 struct moniker *This = impl_from_IMoniker(iface);
433 ULONG refcount = InterlockedDecrement(&This->ref);
434
435 TRACE("%p decreasing refcount to %lu.\n", This, refcount);
436
437 if (!refcount)
438 {
439 free(This->name);
440 free(This);
441 }
442 return refcount;
443}

◆ moniker_Save()

static HRESULT WINAPI moniker_Save ( IMoniker *  iface,
IStream *  pStm,
BOOL  fClearDirty 
)
static

Definition at line 473 of file mediacatenum.c.

474{
475 FIXME("(%p)->(%p, %s): stub\n", iface, pStm, fClearDirty ? "true" : "false");
476
477 return STG_E_CANTSAVE;
478}
#define STG_E_CANTSAVE
Definition: winerror.h:3687

◆ property_bag_AddRef()

static ULONG WINAPI property_bag_AddRef ( IPropertyBag *  iface)
static

Definition at line 98 of file mediacatenum.c.

99{
100 struct moniker *moniker = impl_from_IPropertyBag(iface);
101 return IMoniker_AddRef(&moniker->IMoniker_iface);
102}
static struct moniker * impl_from_IPropertyBag(IPropertyBag *iface)
Definition: mediacatenum.c:72

◆ property_bag_QueryInterface()

static HRESULT WINAPI property_bag_QueryInterface ( IPropertyBag *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 77 of file mediacatenum.c.

78{
79 struct moniker *moniker = impl_from_IPropertyBag(iface);
80
81 TRACE("moniker %p, iid %s, out %p.\n", moniker, debugstr_guid(iid), out);
82
83 if (!out)
84 return E_POINTER;
85
87 {
88 *out = iface;
89 IPropertyBag_AddRef(iface);
90 return S_OK;
91 }
92
93 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
94 *out = NULL;
95 return E_NOINTERFACE;
96}
#define WARN(fmt,...)
Definition: precomp.h:61

◆ property_bag_Read()

static HRESULT WINAPI property_bag_Read ( IPropertyBag *  iface,
const WCHAR *  name,
VARIANT *  var,
IErrorLog *  errorlog 
)
static

Definition at line 110 of file mediacatenum.c.

112{
113 struct moniker *moniker = impl_from_IPropertyBag(iface);
114 WCHAR dmo_name[80];
115 DWORD size, type;
116 HKEY parent, key;
117 WCHAR path[78];
118 void *data;
119 HRESULT hr;
120 LONG ret;
121
122 TRACE("moniker %p, name %s, var %p, errorlog %p.\n", moniker, debugstr_w(name), var, errorlog);
123
124 if (!name || !var)
125 return E_POINTER;
126
127 switch (moniker->type)
128 {
129 case DEVICE_DMO:
130 if (!wcscmp(name, L"FriendlyName"))
131 {
132 if (SUCCEEDED(hr = DMOGetName(&moniker->clsid, dmo_name)))
133 {
134 V_VT(var) = VT_BSTR;
135 V_BSTR(var) = SysAllocString(dmo_name);
136 }
137 return hr;
138 }
139 if (!wcscmp(name, L"FilterData"))
140 {
141 DMO_PARTIAL_MEDIATYPE *types = NULL, *new_array;
142 ULONG count = 1, input_count, output_count, i;
143 REGFILTERPINS2 reg_pins[2] = {{0}};
144 REGFILTER2 reg_filter = {0};
145 REGPINTYPES *reg_types;
146 HRESULT hr;
147
148 do
149 {
150 count *= 2;
151 if (!(new_array = realloc(types, 2 * count * sizeof(*types))))
152 {
153 free(types);
154 return E_OUTOFMEMORY;
155 }
156 types = new_array;
157
158 if (FAILED(hr = DMOGetTypes(&moniker->clsid, count, &input_count, types,
159 count, &output_count, types + count)))
160 {
161 free(types);
162 return hr;
163 }
164 } while (input_count == count || output_count == count);
165
166 if (!(reg_types = malloc(2 * count * sizeof(*reg_types))))
167 {
168 free(types);
169 return hr;
170 }
171
172 for (i = 0; i < input_count; ++i)
173 {
174 reg_types[i].clsMajorType = &types[i].type;
175 reg_types[i].clsMinorType = &types[i].subtype;
176 }
177 for (i = 0; i < output_count; ++i)
178 {
179 reg_types[count + i].clsMajorType = &types[count + i].type;
180 reg_types[count + i].clsMinorType = &types[count + i].subtype;
181 }
182 reg_pins[0].cInstances = 1;
183 reg_pins[0].nMediaTypes = input_count;
184 reg_pins[0].lpMediaType = reg_types;
185 reg_pins[1].dwFlags = REG_PINFLAG_B_OUTPUT;
186 reg_pins[1].cInstances = 1;
187 reg_pins[1].nMediaTypes = output_count;
188 reg_pins[1].lpMediaType = reg_types + count;
189 reg_filter.dwVersion = 2;
190 reg_filter.dwMerit = MERIT_NORMAL + 0x800;
191 reg_filter.cPins2 = 2;
192 reg_filter.rgPins2 = reg_pins;
193
194 hr = create_filter_data(var, &reg_filter);
195 free(reg_types);
196 free(types);
197 return hr;
198 }
200
201 case DEVICE_FILTER:
202 wcscpy(path, L"CLSID\\");
203 if (moniker->has_class)
204 {
206 wcscat(path, L"\\Instance");
207 }
208#ifdef __REACTOS__
210#else
212#endif
213 return HRESULT_FROM_WIN32(ret);
214 break;
215
216 case DEVICE_CODEC:
217 wcscpy(path, L"Software\\Microsoft\\ActiveMovie\\devenum\\");
218 if (moniker->has_class)
220#ifdef __REACTOS__
222#else
224#endif
225 return HRESULT_FROM_WIN32(ret);
226 break;
227
229 }
230
233 if (ret)
234 return HRESULT_FROM_WIN32(ret);
235
236 if ((ret = RegQueryValueExW(key, name, NULL, NULL, NULL, &size)))
237 {
239 return HRESULT_FROM_WIN32(ret);
240 }
241
242 data = malloc(size);
243 if ((ret = RegQueryValueExW(key, name, NULL, &type, data, &size)))
244 {
246 free(data);
247 return HRESULT_FROM_WIN32(ret);
248 }
250
251 switch (type)
252 {
253 case REG_SZ:
254 if (V_VT(var) == VT_EMPTY)
255 V_VT(var) = VT_BSTR;
256 if (V_VT(var) != VT_BSTR)
257 {
258 WARN("Invalid type %s.\n", debugstr_vt(V_VT(var)));
259 return E_INVALIDARG;
260 }
261 V_BSTR(var) = SysAllocStringLen(data, size / sizeof(WCHAR) - 1);
262 free(data);
263 return S_OK;
264 case REG_DWORD:
265 if (V_VT(var) == VT_EMPTY)
266 V_VT(var) = VT_I4;
267 if (V_VT(var) != VT_I4)
268 {
269 WARN("Invalid type %s.\n", debugstr_vt(V_VT(var)));
270 return E_INVALIDARG;
271 }
272 V_I4(var) = *(DWORD *)data;
273 free(data);
274 return S_OK;
275 case REG_BINARY:
276 {
277 SAFEARRAYBOUND bound = {.cElements = size};
278 void *array_data;
279
280 if (V_VT(var) == VT_EMPTY)
281 V_VT(var) = VT_ARRAY | VT_UI1;
282 if (V_VT(var) != (VT_ARRAY | VT_UI1))
283 {
284 WARN("Invalid type %s.\n", debugstr_vt(V_VT(var)));
285 return E_INVALIDARG;
286 }
287
288 if (!(V_ARRAY(var) = SafeArrayCreate(VT_UI1, 1, &bound)))
289 {
290 free(data);
291 return E_OUTOFMEMORY;
292 }
293
294 SafeArrayAccessData(V_ARRAY(var), &array_data);
295 memcpy(array_data, data, size);
297 free(data);
298 return S_OK;
299 }
300 default:
301 FIXME("Unhandled type %#lx.\n", type);
302 free(data);
303 return E_NOTIMPL;
304 }
305}
#define REG_SZ
Definition: layer.c:22
REGPINTYPES
Definition: axextend.idl:194
@ REG_PINFLAG_B_OUTPUT
Definition: axextend.idl:221
HRESULT create_filter_data(VARIANT *var, REGFILTER2 *rgf)
#define malloc
Definition: debug_ros.c:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
@ VT_ARRAY
Definition: compat.h:2341
@ VT_I4
Definition: compat.h:2298
@ VT_EMPTY
Definition: compat.h:2295
@ VT_UI1
Definition: compat.h:2311
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
SAFEARRAY *WINAPI SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound)
Definition: safearray.c:600
HRESULT WINAPI DMOGetName(REFCLSID clsidDMO, WCHAR name[80])
Definition: dmoreg.c:282
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)
Definition: dmoreg.c:722
return ret
Definition: mutex.c:147
r parent
Definition: btrfs.c:3010
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define REG_BINARY
Definition: nt_native.h:1499
#define KEY_READ
Definition: nt_native.h:1026
#define DEFAULT_UNREACHABLE
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:240
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:341
#define V_ARRAY(A)
Definition: oleauto.h:222
#define V_I4(A)
Definition: oleauto.h:247
#define REG_DWORD
Definition: sdbapi.c:615
DWORD dwVersion
Definition: axextend.idl:238
DWORD dwMerit
Definition: axextend.idl:239
const REGFILTERPINS2 * rgPins2
Definition: axextend.idl:253
ULONG cPins2
Definition: axextend.idl:252
const REGPINTYPES * lpMediaType
Definition: axextend.idl:230
Definition: copy.c:22
WCHAR * name
BOOL has_class
Definition: cmds.c:130
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_NOT_FOUND
Definition: winerror.h:1014

◆ property_bag_Release()

static ULONG WINAPI property_bag_Release ( IPropertyBag *  iface)
static

Definition at line 104 of file mediacatenum.c.

105{
106 struct moniker *moniker = impl_from_IPropertyBag(iface);
107 return IMoniker_Release(&moniker->IMoniker_iface);
108}

◆ property_bag_Write()

static HRESULT WINAPI property_bag_Write ( IPropertyBag *  iface,
const WCHAR *  name,
VARIANT *  var 
)
static

Definition at line 307 of file mediacatenum.c.

308{
309 struct moniker *moniker = impl_from_IPropertyBag(iface);
310 HKEY parent, key;
311 WCHAR path[78];
312 LONG ret;
313
314 TRACE("moniker %p, name %s, var %s.\n", moniker, debugstr_w(name), debugstr_variant(var));
315
316 switch (moniker->type)
317 {
318 case DEVICE_DMO:
319 return E_ACCESSDENIED;
320
321 case DEVICE_FILTER:
322 wcscpy(path, L"CLSID\\");
323 if (moniker->has_class)
324 {
326 wcscat(path, L"\\Instance");
327 }
328#ifdef __REACTOS__ /* ReactOS denies zero access opens */
330#else
332#endif
333 return HRESULT_FROM_WIN32(ret);
334 break;
335
336 case DEVICE_CODEC:
337 wcscpy(path, L"Software\\Microsoft\\ActiveMovie\\devenum\\");
338 if (moniker->has_class)
340#ifdef __REACTOS__ /* ReactOS denies zero access opens */
342#else
344#endif
345 return HRESULT_FROM_WIN32(ret);
346 break;
347
349 }
352 if (ret)
353 return HRESULT_FROM_WIN32(ret);
354
355 switch (V_VT(var))
356 {
357 case VT_BSTR:
359 (wcslen(V_BSTR(var)) + 1) * sizeof(WCHAR));
360 break;
361 case VT_I4:
362 ret = RegSetValueExW(key, name, 0, REG_DWORD, (BYTE *)&V_I4(var), sizeof(DWORD));
363 break;
364 case VT_ARRAY | VT_UI1:
365 {
366 LONG lbound, ubound;
367 void *array_data;
368 SafeArrayGetLBound(V_ARRAY(var), 1, &lbound);
369 SafeArrayGetUBound(V_ARRAY(var), 1, &ubound);
370 SafeArrayAccessData(V_ARRAY(var), &array_data);
371 ret = RegSetValueExW(key, name, 0, REG_BINARY, array_data, ubound - lbound + 1);
373 break;
374 }
375 default:
376 WARN("Unhandled type %s.\n", debugstr_vt(V_VT(var)));
377 return E_INVALIDARG;
378 }
379
381 return S_OK;
382}
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1066
static const char * debugstr_variant(const VARIANT *var)
Definition: dom.c:505
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1021
#define KEY_WRITE
Definition: nt_native.h:1034
#define E_ACCESSDENIED
Definition: winerror.h:4116
unsigned char BYTE
Definition: xxhash.c:193

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( devenum  )

Variable Documentation

◆ IEnumMoniker_Vtbl

const IEnumMonikerVtbl IEnumMoniker_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI enum_moniker_AddRef(IEnumMoniker *iface)
Definition: mediacatenum.c:876
static HRESULT WINAPI enum_moniker_Reset(IEnumMoniker *iface)
static HRESULT WINAPI enum_moniker_QueryInterface(IEnumMoniker *iface, REFIID riid, void **ppv)
Definition: mediacatenum.c:856
static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMoniker **rgelt, ULONG *pceltFetched)
Definition: mediacatenum.c:927
static HRESULT WINAPI enum_moniker_Clone(IEnumMoniker *iface, IEnumMoniker **ppenum)
static ULONG WINAPI enum_moniker_Release(IEnumMoniker *iface)
Definition: mediacatenum.c:886
static HRESULT WINAPI enum_moniker_Skip(IEnumMoniker *iface, ULONG celt)
Definition: mediacatenum.c:985

Definition at line 1043 of file mediacatenum.c.

Referenced by enum_moniker_create().

◆ IMoniker_Vtbl

const IMonikerVtbl IMoniker_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI moniker_Hash(IMoniker *iface, DWORD *pdwHash)
Definition: mediacatenum.c:652
static HRESULT WINAPI moniker_BindToObject(IMoniker *iface, IBindCtx *bind_ctx, IMoniker *left, REFIID iid, void **out)
Definition: mediacatenum.c:489
static HRESULT WINAPI moniker_Enum(IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker)
Definition: mediacatenum.c:608
static HRESULT WINAPI moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
Definition: mediacatenum.c:661
static HRESULT WINAPI moniker_Load(IMoniker *iface, IStream *pStm)
Definition: mediacatenum.c:466
static HRESULT WINAPI moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight, BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite)
Definition: mediacatenum.c:597
static HRESULT WINAPI moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime)
Definition: mediacatenum.c:669
static HRESULT WINAPI moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
Definition: mediacatenum.c:582
static ULONG WINAPI moniker_Release(IMoniker *iface)
Definition: mediacatenum.c:430
static HRESULT WINAPI moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther, IMoniker **ppmkRelPath)
Definition: mediacatenum.c:699
static HRESULT WINAPI moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
Definition: mediacatenum.c:751
static HRESULT WINAPI moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, void **out)
Definition: mediacatenum.c:550
static HRESULT WINAPI moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
Definition: mediacatenum.c:480
static HRESULT WINAPI moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
Definition: mediacatenum.c:618
static HRESULT WINAPI moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
Definition: mediacatenum.c:398
static HRESULT WINAPI moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
Definition: mediacatenum.c:762
static HRESULT WINAPI moniker_IsDirty(IMoniker *iface)
Definition: mediacatenum.c:459
static HRESULT WINAPI moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOtherMoniker, IMoniker **ppmkPrefix)
Definition: mediacatenum.c:689
static ULONG WINAPI moniker_AddRef(IMoniker *iface)
Definition: mediacatenum.c:420
static HRESULT WINAPI moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
Definition: mediacatenum.c:445
static HRESULT WINAPI moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
Definition: mediacatenum.c:680
static HRESULT WINAPI moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
Definition: mediacatenum.c:709
static HRESULT WINAPI moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
Definition: mediacatenum.c:473

Definition at line 769 of file mediacatenum.c.

Referenced by codec_moniker_create(), dmo_moniker_create(), and filter_moniker_create().

◆ IPropertyBag_Vtbl

const IPropertyBagVtbl IPropertyBag_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, const WCHAR *name, VARIANT *var, IErrorLog *errorlog)
Definition: mediacatenum.c:110
static ULONG WINAPI property_bag_Release(IPropertyBag *iface)
Definition: mediacatenum.c:104
static ULONG WINAPI property_bag_AddRef(IPropertyBag *iface)
Definition: mediacatenum.c:98
static HRESULT WINAPI property_bag_QueryInterface(IPropertyBag *iface, REFIID iid, void **out)
Definition: mediacatenum.c:77
static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, const WCHAR *name, VARIANT *var)
Definition: mediacatenum.c:307

Definition at line 384 of file mediacatenum.c.

Referenced by codec_moniker_create(), dmo_moniker_create(), and filter_moniker_create().