ReactOS 0.4.17-dev-1071-gb2116d0
parsedisplayname.c
Go to the documentation of this file.
1/*
2 * IParseDisplayName implementation for DEVENUM.dll
3 *
4 * Copyright (C) 2002 Robert Shearman
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 * NOTES ON THIS FILE:
21 * - Implements IParseDisplayName interface which creates a moniker
22 * from a string in a special format
23 */
24#include "devenum_private.h"
25
26#include "wine/debug.h"
27
29
31{
32 TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
33
34 if (!ppv)
35 return E_POINTER;
36
39 {
40 *ppv = iface;
41 IParseDisplayName_AddRef(iface);
42 return S_OK;
43 }
44
45 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
46 *ppv = NULL;
47 return E_NOINTERFACE;
48}
49
51{
52 TRACE("\n");
53
54 return 2; /* non-heap based object */
55}
56
58{
59 TRACE("\n");
60
61 return 1; /* non-heap based object */
62}
63
65 IBindCtx *pbc, LPOLESTR name, ULONG *eaten, IMoniker **ret)
66{
67 struct moniker *moniker;
69 enum device_type type;
70 GUID class, clsid;
71
72 TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(name), eaten, ret);
73
74 *ret = NULL;
75 if (eaten)
76 *eaten = wcslen(name);
77
78 name = wcschr(name, ':') + 1;
79
80 if (!wcsncmp(name, L"sw:", 3))
81 {
83 name += 3;
84 }
85 else if (!wcsncmp(name, L"cm:", 3))
86 {
88 name += 3;
89 }
90 else if (!wcsncmp(name, L"dmo:", 4))
91 {
93 name += 4;
94 }
95 else
96 {
97 FIXME("unhandled device type %s\n", debugstr_w(name));
98 return MK_E_SYNTAX;
99 }
100
101 if (type == DEVICE_DMO)
102 {
105 return MK_E_SYNTAX;
106
108 if (FAILED(CLSIDFromString(buffer, &class)))
109 return MK_E_SYNTAX;
110
112 }
113 else
114 {
116 if (CLSIDFromString(buffer, &class) == S_OK)
117 {
119 if (type == DEVICE_FILTER)
121 else
123 }
124 else
125 {
126 if (type == DEVICE_FILTER)
128 else
130 }
131 }
132
133 if (!moniker)
134 return E_OUTOFMEMORY;
135
137 return S_OK;
138}
139
140/**********************************************************************
141 * IParseDisplayName_Vtbl
142 */
143static const IParseDisplayNameVtbl IParseDisplayName_Vtbl =
144{
149};
150
151/* The one instance of this class */
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
#define CHARS_IN_GUID
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
struct moniker * filter_moniker_create(const GUID *class, const WCHAR *name)
Definition: mediacatenum.c:796
struct moniker * codec_moniker_create(const GUID *class, const WCHAR *name)
Definition: mediacatenum.c:815
struct moniker * dmo_moniker_create(const GUID class, const GUID clsid)
Definition: mediacatenum.c:834
device_type
@ DEVICE_FILTER
@ DEVICE_DMO
@ DEVICE_CODEC
#define NULL
Definition: types.h:112
HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
Definition: combase.c:1470
#define wcschr
Definition: compat.h:17
#define MAX_PATH
Definition: compat.h:34
#define lstrcpynW
Definition: compat.h:738
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:523
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
const CLSID * clsid
Definition: msctf.cpp:50
const GUID IID_IParseDisplayName
static HRESULT WINAPI devenum_parser_ParseDisplayName(IParseDisplayName *iface, IBindCtx *pbc, LPOLESTR name, ULONG *eaten, IMoniker **ret)
static const IParseDisplayNameVtbl IParseDisplayName_Vtbl
static ULONG WINAPI devenum_parser_AddRef(IParseDisplayName *iface)
IParseDisplayName devenum_parser
static HRESULT WINAPI devenum_parser_QueryInterface(IParseDisplayName *iface, REFIID riid, void **ppv)
static ULONG WINAPI devenum_parser_Release(IParseDisplayName *iface)
short WCHAR
Definition: pedump.c:58
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define TRACE(s)
Definition: solgame.cpp:4
IMoniker IMoniker_iface
Definition: name.c:39
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479
#define MK_E_SYNTAX
Definition: winerror.h:3896
#define E_POINTER
Definition: winerror.h:3480