2 * Copyright 2012 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wine/debug.h"
31 #include "wine/unicode.h"
32 #include "wmiutils_private.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(wmiutils
);
38 IWbemPath IWbemPath_iface
;
44 static inline struct path
*impl_from_IWbemPath( IWbemPath
*iface
)
46 return CONTAINING_RECORD(iface
, struct path
, IWbemPath_iface
);
49 static ULONG WINAPI
path_AddRef(
52 struct path
*path
= impl_from_IWbemPath( iface
);
53 return InterlockedIncrement( &path
->refs
);
56 static ULONG WINAPI
path_Release(
59 struct path
*path
= impl_from_IWbemPath( iface
);
60 LONG refs
= InterlockedDecrement( &path
->refs
);
63 TRACE("destroying %p\n", path
);
64 HeapFree( GetProcessHeap(), 0, path
->text
);
65 HeapFree( GetProcessHeap(), 0, path
);
70 static HRESULT WINAPI
path_QueryInterface(
75 struct path
*path
= impl_from_IWbemPath( iface
);
77 TRACE("%p, %s, %p\n", path
, debugstr_guid( riid
), ppvObject
);
79 if ( IsEqualGUID( riid
, &IID_IWbemPath
) ||
80 IsEqualGUID( riid
, &IID_IUnknown
) )
86 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
89 IWbemPath_AddRef( iface
);
93 static HRESULT WINAPI
path_SetText(
98 struct path
*path
= impl_from_IWbemPath( iface
);
101 TRACE("%p, %u, %s\n", iface
, uMode
, debugstr_w(pszPath
));
103 if (uMode
) FIXME("igoring mode %u\n", uMode
);
105 len
= strlenW( pszPath
);
106 if (!(path
->text
= HeapAlloc( GetProcessHeap(), 0, (len
+ 1) * sizeof(WCHAR
) )))
107 return E_OUTOFMEMORY
;
109 strcpyW( path
->text
, pszPath
);
114 static HRESULT WINAPI
path_GetText(
117 ULONG
*puBufferLength
,
120 struct path
*path
= impl_from_IWbemPath( iface
);
122 TRACE("%p, 0x%x, %p, %p\n", iface
, lFlags
, puBufferLength
, pszText
);
124 if (lFlags
!= WBEMPATH_GET_ORIGINAL
)
126 FIXME("flags 0x%x not supported\n", lFlags
);
127 return WBEM_E_INVALID_PARAMETER
;
129 if (*puBufferLength
< path
->len
+ 1)
131 *puBufferLength
= path
->len
+ 1;
134 if (pszText
) strcpyW( pszText
, path
->text
);
135 *puBufferLength
= path
->len
+ 1;
139 static HRESULT WINAPI
path_GetInfo(
141 ULONG uRequestedInfo
,
142 ULONGLONG
*puResponse
)
144 FIXME("%p, %d, %p\n", iface
, uRequestedInfo
, puResponse
);
148 static HRESULT WINAPI
path_SetServer(
152 FIXME("%p, %s\n", iface
, debugstr_w(Name
));
156 static HRESULT WINAPI
path_GetServer(
158 ULONG
*puNameBufLength
,
161 FIXME("%p, %p, %p\n", iface
, puNameBufLength
, pName
);
165 static HRESULT WINAPI
path_GetNamespaceCount(
169 FIXME("%p, %p\n", iface
, puCount
);
173 static HRESULT WINAPI
path_SetNamespaceAt(
178 FIXME("%p, %u, %s\n", iface
, uIndex
, debugstr_w(pszName
));
182 static HRESULT WINAPI
path_GetNamespaceAt(
185 ULONG
*puNameBufLength
,
188 FIXME("%p, %u, %p, %p\n", iface
, uIndex
, puNameBufLength
, pName
);
192 static HRESULT WINAPI
path_RemoveNamespaceAt(
196 FIXME("%p, %u\n", iface
, uIndex
);
200 static HRESULT WINAPI
path_RemoveAllNamespaces(
203 FIXME("%p\n", iface
);
207 static HRESULT WINAPI
path_GetScopeCount(
211 FIXME("%p, %p\n", iface
, puCount
);
215 static HRESULT WINAPI
path_SetScope(
220 FIXME("%p, %u, %s\n", iface
, uIndex
, debugstr_w(pszClass
));
224 static HRESULT WINAPI
path_SetScopeFromText(
229 FIXME("%p, %u, %s\n", iface
, uIndex
, debugstr_w(pszText
));
233 static HRESULT WINAPI
path_GetScope(
236 ULONG
*puClassNameBufSize
,
238 IWbemPathKeyList
**pKeyList
)
240 FIXME("%p, %u, %p, %p, %p\n", iface
, uIndex
, puClassNameBufSize
, pszClass
, pKeyList
);
244 static HRESULT WINAPI
path_GetScopeAsText(
247 ULONG
*puTextBufSize
,
250 FIXME("%p, %u, %p, %p\n", iface
, uIndex
, puTextBufSize
, pszText
);
254 static HRESULT WINAPI
path_RemoveScope(
258 FIXME("%p, %u\n", iface
, uIndex
);
262 static HRESULT WINAPI
path_RemoveAllScopes(
265 FIXME("%p\n", iface
);
269 static HRESULT WINAPI
path_SetClassName(
273 FIXME("%p, %s\n", iface
, debugstr_w(Name
));
277 static HRESULT WINAPI
path_GetClassName(
279 ULONG
*puBufferLength
,
282 FIXME("%p,%p, %p\n", iface
, puBufferLength
, pszName
);
286 static HRESULT WINAPI
path_GetKeyList(
288 IWbemPathKeyList
**pOut
)
290 FIXME("%p, %p\n", iface
, pOut
);
294 static HRESULT WINAPI
path_CreateClassPart(
299 FIXME("%p, 0x%x, %s\n", iface
, lFlags
, debugstr_w(Name
));
303 static HRESULT WINAPI
path_DeleteClassPart(
307 FIXME("%p, 0x%x\n", iface
, lFlags
);
311 static BOOL WINAPI
path_IsRelative(
316 FIXME("%p, %s, %s\n", iface
, debugstr_w(wszMachine
), debugstr_w(wszNamespace
));
320 static BOOL WINAPI
path_IsRelativeOrChild(
326 FIXME("%p, %s, %s, 0x%x\n", iface
, debugstr_w(wszMachine
), debugstr_w(wszNamespace
), lFlags
);
330 static BOOL WINAPI
path_IsLocal(
334 FIXME("%p, %s\n", iface
, debugstr_w(wszMachine
));
338 static BOOL WINAPI
path_IsSameClassName(
342 FIXME("%p, %s\n", iface
, debugstr_w(wszClass
));
346 static const struct IWbemPathVtbl path_vtbl
=
356 path_GetNamespaceCount
,
359 path_RemoveNamespaceAt
,
360 path_RemoveAllNamespaces
,
363 path_SetScopeFromText
,
367 path_RemoveAllScopes
,
371 path_CreateClassPart
,
372 path_DeleteClassPart
,
374 path_IsRelativeOrChild
,
379 HRESULT
WbemPath_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
383 TRACE("%p, %p\n", pUnkOuter
, ppObj
);
385 if (!(path
= HeapAlloc( GetProcessHeap(), 0, sizeof(*path
) ))) return E_OUTOFMEMORY
;
387 path
->IWbemPath_iface
.lpVtbl
= &path_vtbl
;
390 *ppObj
= &path
->IWbemPath_iface
;
392 TRACE("returning iface %p\n", *ppObj
);