ReactOS  0.4.14-dev-342-gdc047f9
parsedisplayname.c File Reference
#include "devenum_private.h"
#include "wine/debug.h"
Include dependency graph for parsedisplayname.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (devenum)
 
static HRESULT WINAPI DEVENUM_IParseDisplayName_QueryInterface (IParseDisplayName *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI DEVENUM_IParseDisplayName_AddRef (IParseDisplayName *iface)
 
static ULONG WINAPI DEVENUM_IParseDisplayName_Release (IParseDisplayName *iface)
 
static HRESULT WINAPI DEVENUM_IParseDisplayName_ParseDisplayName (IParseDisplayName *iface, IBindCtx *pbc, LPOLESTR name, ULONG *eaten, IMoniker **ret)
 

Variables

static const IParseDisplayNameVtbl IParseDisplayName_Vtbl
 
IParseDisplayName DEVENUM_ParseDisplayName = { &IParseDisplayName_Vtbl }
 

Function Documentation

◆ DEVENUM_IParseDisplayName_AddRef()

static ULONG WINAPI DEVENUM_IParseDisplayName_AddRef ( IParseDisplayName iface)
static

Definition at line 51 of file parsedisplayname.c.

52 {
53  TRACE("\n");
54 
56 
57  return 2; /* non-heap based object */
58 }
static void DEVENUM_LockModule(void)
#define TRACE(s)
Definition: solgame.cpp:4

◆ DEVENUM_IParseDisplayName_ParseDisplayName()

static HRESULT WINAPI DEVENUM_IParseDisplayName_ParseDisplayName ( IParseDisplayName iface,
IBindCtx pbc,
LPOLESTR  name,
ULONG eaten,
IMoniker **  ret 
)
static

Definition at line 78 of file parsedisplayname.c.

80 {
82  enum device_type type;
83  MediaCatMoniker *mon;
84  CLSID class;
85 
86  TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(name), eaten, ret);
87 
88  *ret = NULL;
89  if (eaten)
90  *eaten = lstrlenW(name);
91 
92  name = wcschr(name, ':') + 1;
93 
94  if (!wcsncmp(name, swW, 3))
95  {
97  name += 3;
98  }
99  else if (!wcsncmp(name, cmW, 3))
100  {
101  type = DEVICE_CODEC;
102  name += 3;
103  }
104  else if (!wcsncmp(name, dmoW, 4))
105  {
106  type = DEVICE_DMO;
107  name += 4;
108  }
109  else
110  {
111  FIXME("unhandled device type %s\n", debugstr_w(name));
112  return MK_E_SYNTAX;
113  }
114 
115  if (!(mon = DEVENUM_IMediaCatMoniker_Construct()))
116  return E_OUTOFMEMORY;
117 
118  if (type == DEVICE_DMO)
119  {
121  if (FAILED(CLSIDFromString(buffer, &mon->clsid)))
122  {
123  IMoniker_Release(&mon->IMoniker_iface);
124  return MK_E_SYNTAX;
125  }
126 
128  if (FAILED(CLSIDFromString(buffer, &mon->class)))
129  {
130  IMoniker_Release(&mon->IMoniker_iface);
131  return MK_E_SYNTAX;
132  }
133  }
134  else
135  {
137  if (CLSIDFromString(buffer, &class) == S_OK)
138  {
139  mon->has_class = TRUE;
140  mon->class = class;
141  name += CHARS_IN_GUID;
142  }
143 
144  if (!(mon->name = CoTaskMemAlloc((lstrlenW(name) + 1) * sizeof(WCHAR))))
145  {
146  IMoniker_Release(&mon->IMoniker_iface);
147  return E_OUTOFMEMORY;
148  }
149  lstrcpyW(mon->name, name);
150  }
151 
152  mon->type = type;
153 
154  *ret = &mon->IMoniker_iface;
155 
156  return S_OK;
157 }
static const WCHAR dmoW[]
#define TRUE
Definition: types.h:120
MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void) DECLSPEC_HIDDEN
Definition: mediacatenum.c:786
enum device_type type
device_type
#define CHARS_IN_GUID
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
static const WCHAR swW[]
#define lstrlenW
Definition: compat.h:415
#define lstrcpynW
Definition: compat.h:405
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR cmW[]
#define TRACE(s)
Definition: solgame.cpp:4
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
int ret
IMoniker IMoniker_iface
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:414
Definition: name.c:36
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
#define MK_E_SYNTAX
Definition: winerror.h:2785
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

◆ DEVENUM_IParseDisplayName_QueryInterface()

static HRESULT WINAPI DEVENUM_IParseDisplayName_QueryInterface ( IParseDisplayName iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 30 of file parsedisplayname.c.

32 {
33  TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
34 
35  if (!ppv)
36  return E_POINTER;
37 
38  if (IsEqualGUID(riid, &IID_IUnknown) ||
40  {
41  *ppv = iface;
42  IParseDisplayName_AddRef(iface);
43  return S_OK;
44  }
45 
46  FIXME("- no interface IID: %s\n", debugstr_guid(riid));
47  *ppv = NULL;
48  return E_NOINTERFACE;
49 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IParseDisplayName
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define E_POINTER
Definition: winerror.h:2365

◆ DEVENUM_IParseDisplayName_Release()

static ULONG WINAPI DEVENUM_IParseDisplayName_Release ( IParseDisplayName iface)
static

Definition at line 60 of file parsedisplayname.c.

61 {
62  TRACE("\n");
63 
65 
66  return 1; /* non-heap based object */
67 }
static void DEVENUM_UnlockModule(void)
#define TRACE(s)
Definition: solgame.cpp:4

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( devenum  )

Variable Documentation

◆ DEVENUM_ParseDisplayName

IParseDisplayName DEVENUM_ParseDisplayName = { &IParseDisplayName_Vtbl }

Definition at line 171 of file parsedisplayname.c.

◆ IParseDisplayName_Vtbl

const IParseDisplayNameVtbl IParseDisplayName_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI DEVENUM_IParseDisplayName_ParseDisplayName(IParseDisplayName *iface, IBindCtx *pbc, LPOLESTR name, ULONG *eaten, IMoniker **ret)
static ULONG WINAPI DEVENUM_IParseDisplayName_Release(IParseDisplayName *iface)
static ULONG WINAPI DEVENUM_IParseDisplayName_AddRef(IParseDisplayName *iface)
static HRESULT WINAPI DEVENUM_IParseDisplayName_QueryInterface(IParseDisplayName *iface, REFIID riid, void **ppv)

Definition at line 162 of file parsedisplayname.c.