[2/3] wmiutils: Add a stub implementation of IWbemPath.
Hans Leidekker
hans at codeweavers.com
Fri Dec 21 06:58:09 CST 2012
---
dlls/wmiutils/Makefile.in | 1 +
dlls/wmiutils/main.c | 7 +
dlls/wmiutils/path.c | 363 ++++++++++++++++++++++++++++++++++++++
dlls/wmiutils/statuscode.c | 2 -
dlls/wmiutils/wmiutils_private.h | 1 +
include/Makefile.in | 1 +
include/wmiutils.idl | 196 ++++++++++++++++++++
7 files changed, 569 insertions(+), 2 deletions(-)
create mode 100644 dlls/wmiutils/path.c
create mode 100644 include/wmiutils.idl
diff --git a/dlls/wmiutils/Makefile.in b/dlls/wmiutils/Makefile.in
index c6ef892..39e21b0 100644
--- a/dlls/wmiutils/Makefile.in
+++ b/dlls/wmiutils/Makefile.in
@@ -3,6 +3,7 @@ IMPORTS = oleaut32 ole32 advapi32
C_SRCS = \
main.c \
+ path.c \
statuscode.c
IDL_R_SRCS = wmiutils_classes.idl
diff --git a/dlls/wmiutils/main.c b/dlls/wmiutils/main.c
index edc7c71..f249f30 100644
--- a/dlls/wmiutils/main.c
+++ b/dlls/wmiutils/main.c
@@ -24,8 +24,10 @@
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
+#include "initguid.h"
#include "objbase.h"
#include "wbemcli.h"
+#include "wmiutils.h"
#include "rpcproxy.h"
#include "wine/debug.h"
@@ -113,6 +115,7 @@ static const struct IClassFactoryVtbl wmiutils_cf_vtbl =
};
static wmiutils_cf status_code_cf = { { &wmiutils_cf_vtbl }, WbemStatusCodeText_create };
+static wmiutils_cf path_cf = { { &wmiutils_cf_vtbl }, WbemPath_create };
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID lpv )
{
@@ -140,6 +143,10 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
{
cf = &status_code_cf.IClassFactory_iface;
}
+ else if (IsEqualGUID( rclsid, &CLSID_WbemDefPath ))
+ {
+ cf = &path_cf.IClassFactory_iface;
+ }
if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
return IClassFactory_QueryInterface( cf, iid, ppv );
}
diff --git a/dlls/wmiutils/path.c b/dlls/wmiutils/path.c
new file mode 100644
index 0000000..d67849b
--- /dev/null
+++ b/dlls/wmiutils/path.c
@@ -0,0 +1,363 @@
+/*
+ * Copyright 2012 Hans Leidekker for CodeWeavers
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include "config.h"
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "ole2.h"
+#include "wmiutils.h"
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+#include "wmiutils_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wmiutils);
+
+struct path
+{
+ IWbemPath IWbemPath_iface;
+ LONG refs;
+};
+
+static inline struct path *impl_from_IWbemPath( IWbemPath *iface )
+{
+ return CONTAINING_RECORD(iface, struct path, IWbemPath_iface);
+}
+
+static ULONG WINAPI path_AddRef(
+ IWbemPath *iface )
+{
+ struct path *path = impl_from_IWbemPath( iface );
+ return InterlockedIncrement( &path->refs );
+}
+
+static ULONG WINAPI path_Release(
+ IWbemPath *iface )
+{
+ struct path *path = impl_from_IWbemPath( iface );
+ LONG refs = InterlockedDecrement( &path->refs );
+ if (!refs)
+ {
+ TRACE("destroying %p\n", path);
+ HeapFree( GetProcessHeap(), 0, path );
+ }
+ return refs;
+}
+
+static HRESULT WINAPI path_QueryInterface(
+ IWbemPath *iface,
+ REFIID riid,
+ void **ppvObject )
+{
+ struct path *path = impl_from_IWbemPath( iface );
+
+ TRACE("%p, %s, %p\n", path, debugstr_guid( riid ), ppvObject );
+
+ if ( IsEqualGUID( riid, &IID_IWbemPath ) ||
+ IsEqualGUID( riid, &IID_IUnknown ) )
+ {
+ *ppvObject = iface;
+ }
+ else
+ {
+ FIXME("interface %s not implemented\n", debugstr_guid(riid));
+ return E_NOINTERFACE;
+ }
+ IWbemPath_AddRef( iface );
+ return S_OK;
+}
+
+static HRESULT WINAPI path_SetText(
+ IWbemPath *iface,
+ ULONG uMode,
+ LPCWSTR pszPath)
+{
+ FIXME("%p, %u, %s\n", iface, uMode, debugstr_w(pszPath));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetText(
+ IWbemPath *iface,
+ LONG lFlags,
+ ULONG *puBufferLength,
+ LPWSTR pszText)
+{
+ FIXME("%p, 0x%x, %p, %p\n", iface, lFlags, puBufferLength, pszText);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetInfo(
+ IWbemPath *iface,
+ ULONG uRequestedInfo,
+ ULONGLONG *puResponse)
+{
+ FIXME("%p, %d, %p\n", iface, uRequestedInfo, puResponse);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_SetServer(
+ IWbemPath *iface,
+ LPCWSTR Name)
+{
+ FIXME("%p, %s\n", iface, debugstr_w(Name));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetServer(
+ IWbemPath *iface,
+ ULONG *puNameBufLength,
+ LPWSTR pName)
+{
+ FIXME("%p, %p, %p\n", iface, puNameBufLength, pName);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetNamespaceCount(
+ IWbemPath *iface,
+ ULONG *puCount)
+{
+ FIXME("%p, %p\n", iface, puCount);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_SetNamespaceAt(
+ IWbemPath *iface,
+ ULONG uIndex,
+ LPCWSTR pszName)
+{
+ FIXME("%p, %u, %s\n", iface, uIndex, debugstr_w(pszName));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetNamespaceAt(
+ IWbemPath *iface,
+ ULONG uIndex,
+ ULONG *puNameBufLength,
+ LPWSTR pName)
+{
+ FIXME("%p, %u, %p, %p\n", iface, uIndex, puNameBufLength, pName);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_RemoveNamespaceAt(
+ IWbemPath *iface,
+ ULONG uIndex)
+{
+ FIXME("%p, %u\n", iface, uIndex);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_RemoveAllNamespaces(
+ IWbemPath *iface)
+{
+ FIXME("%p\n", iface);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetScopeCount(
+ IWbemPath *iface,
+ ULONG *puCount)
+{
+ FIXME("%p, %p\n", iface, puCount);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_SetScope(
+ IWbemPath *iface,
+ ULONG uIndex,
+ LPWSTR pszClass)
+{
+ FIXME("%p, %u, %s\n", iface, uIndex, debugstr_w(pszClass));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_SetScopeFromText(
+ IWbemPath *iface,
+ ULONG uIndex,
+ LPWSTR pszText)
+{
+ FIXME("%p, %u, %s\n", iface, uIndex, debugstr_w(pszText));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetScope(
+ IWbemPath *iface,
+ ULONG uIndex,
+ ULONG *puClassNameBufSize,
+ LPWSTR pszClass,
+ IWbemPathKeyList **pKeyList)
+{
+ FIXME("%p, %u, %p, %p, %p\n", iface, uIndex, puClassNameBufSize, pszClass, pKeyList);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetScopeAsText(
+ IWbemPath *iface,
+ ULONG uIndex,
+ ULONG *puTextBufSize,
+ LPWSTR pszText)
+{
+ FIXME("%p, %u, %p, %p\n", iface, uIndex, puTextBufSize, pszText);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_RemoveScope(
+ IWbemPath *iface,
+ ULONG uIndex)
+{
+ FIXME("%p, %u\n", iface, uIndex);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_RemoveAllScopes(
+ IWbemPath *iface)
+{
+ FIXME("%p\n", iface);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_SetClassName(
+ IWbemPath *iface,
+ LPCWSTR Name)
+{
+ FIXME("%p, %s\n", iface, debugstr_w(Name));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetClassName(
+ IWbemPath *iface,
+ ULONG *puBufferLength,
+ LPWSTR pszName)
+{
+ FIXME("%p,%p, %p\n", iface, puBufferLength, pszName);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_GetKeyList(
+ IWbemPath *iface,
+ IWbemPathKeyList **pOut)
+{
+ FIXME("%p, %p\n", iface, pOut);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_CreateClassPart(
+ IWbemPath *iface,
+ LONG lFlags,
+ LPCWSTR Name)
+{
+ FIXME("%p, 0x%x, %s\n", iface, lFlags, debugstr_w(Name));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI path_DeleteClassPart(
+ IWbemPath *iface,
+ LONG lFlags)
+{
+ FIXME("%p, 0x%x\n", iface, lFlags);
+ return E_NOTIMPL;
+}
+
+static BOOL WINAPI path_IsRelative(
+ IWbemPath *iface,
+ LPWSTR wszMachine,
+ LPWSTR wszNamespace)
+{
+ FIXME("%p, %s, %s\n", iface, debugstr_w(wszMachine), debugstr_w(wszNamespace));
+ return E_NOTIMPL;
+}
+
+static BOOL WINAPI path_IsRelativeOrChild(
+ IWbemPath *iface,
+ LPWSTR wszMachine,
+ LPWSTR wszNamespace,
+ LONG lFlags)
+{
+ FIXME("%p, %s, %s, 0x%x\n", iface, debugstr_w(wszMachine), debugstr_w(wszNamespace), lFlags);
+ return E_NOTIMPL;
+}
+
+static BOOL WINAPI path_IsLocal(
+ IWbemPath *iface,
+ LPCWSTR wszMachine)
+{
+ FIXME("%p, %s\n", iface, debugstr_w(wszMachine));
+ return E_NOTIMPL;
+}
+
+static BOOL WINAPI path_IsSameClassName(
+ IWbemPath *iface,
+ LPCWSTR wszClass)
+{
+ FIXME("%p, %s\n", iface, debugstr_w(wszClass));
+ return E_NOTIMPL;
+}
+
+static const struct IWbemPathVtbl path_vtbl =
+{
+ path_QueryInterface,
+ path_AddRef,
+ path_Release,
+ path_SetText,
+ path_GetText,
+ path_GetInfo,
+ path_SetServer,
+ path_GetServer,
+ path_GetNamespaceCount,
+ path_SetNamespaceAt,
+ path_GetNamespaceAt,
+ path_RemoveNamespaceAt,
+ path_RemoveAllNamespaces,
+ path_GetScopeCount,
+ path_SetScope,
+ path_SetScopeFromText,
+ path_GetScope,
+ path_GetScopeAsText,
+ path_RemoveScope,
+ path_RemoveAllScopes,
+ path_SetClassName,
+ path_GetClassName,
+ path_GetKeyList,
+ path_CreateClassPart,
+ path_DeleteClassPart,
+ path_IsRelative,
+ path_IsRelativeOrChild,
+ path_IsLocal,
+ path_IsSameClassName
+};
+
+HRESULT WbemPath_create( IUnknown *pUnkOuter, LPVOID *ppObj )
+{
+ struct path *path;
+
+ TRACE("%p, %p\n", pUnkOuter, ppObj);
+
+ if (!(path = HeapAlloc( GetProcessHeap(), 0, sizeof(*path) ))) return E_OUTOFMEMORY;
+
+ path->IWbemPath_iface.lpVtbl = &path_vtbl;
+ path->refs = 1;
+
+ *ppObj = &path->IWbemPath_iface;
+
+ TRACE("returning iface %p\n", *ppObj);
+ return S_OK;
+}
diff --git a/dlls/wmiutils/statuscode.c b/dlls/wmiutils/statuscode.c
index 6a060db..2d8a3f8 100644
--- a/dlls/wmiutils/statuscode.c
+++ b/dlls/wmiutils/statuscode.c
@@ -24,8 +24,6 @@
#include "windef.h"
#include "winbase.h"
-#include "winuser.h"
-#include "initguid.h"
#include "ole2.h"
#include "wbemcli.h"
diff --git a/dlls/wmiutils/wmiutils_private.h b/dlls/wmiutils/wmiutils_private.h
index 58b4764..fdcd48f 100644
--- a/dlls/wmiutils/wmiutils_private.h
+++ b/dlls/wmiutils/wmiutils_private.h
@@ -16,4 +16,5 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+HRESULT WbemPath_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT WbemStatusCodeText_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
diff --git a/include/Makefile.in b/include/Makefile.in
index c2ca25a..ace89bb 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -112,6 +112,7 @@ PUBLIC_IDL_H_SRCS = \
wine/itss.idl \
wine/svcctl.idl \
winsxs.idl \
+ wmiutils.idl \
wmsbuffer.idl \
wmsdkidl.idl \
wpcapi.idl \
diff --git a/include/wmiutils.idl b/include/wmiutils.idl
new file mode 100644
index 0000000..81834ec
--- /dev/null
+++ b/include/wmiutils.idl
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2012 Hans Leidekker for CodeWeavers
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+import "oaidl.idl";
+
+interface IWbemPath;
+interface IWbemPathKeyList;
+
+[
+ local,
+ object,
+ uuid(9ae62877-7544-4bb0-aa26-a13824659ed6)
+]
+interface IWbemPathKeyList : IUnknown
+{
+ HRESULT GetCount(
+ [out] ULONG *puKeyCount);
+
+ HRESULT SetKey(
+ [in,string] LPCWSTR wszName,
+ [in] ULONG uFlags,
+ [in] ULONG uCimType,
+ [in] LPVOID pKeyVal);
+
+ HRESULT SetKey2(
+ [in,string] LPCWSTR wszName,
+ [in] ULONG uFlags,
+ [in] ULONG uCimType,
+ [in] VARIANT *pKeyVal);
+
+ HRESULT GetKey(
+ [in] ULONG uKeyIx,
+ [in] ULONG uFlags,
+ [in,out] ULONG *puNameBufSize,
+ [in,out] LPWSTR pszKeyName,
+ [in,out] ULONG *puKeyValBufSize,
+ [in,out] LPVOID pKeyVal,
+ [out] ULONG *puApparentCimType);
+
+ HRESULT GetKey2(
+ [in] ULONG uKeyIx,
+ [in] ULONG uFlags,
+ [in,out] ULONG *puNameBufSize,
+ [in,out] LPWSTR pszKeyName,
+ [in,out] VARIANT *pKeyValue,
+ [out] ULONG *puApparentCimType);
+
+ HRESULT RemoveKey(
+ [in,string] LPCWSTR wszName,
+ [in] ULONG uFlags);
+
+ HRESULT RemoveAllKeys(
+ [in] ULONG uFlags);
+
+ HRESULT MakeSingleton([in] boolean bSet);
+
+ HRESULT GetInfo(
+ [in] ULONG uRequestedInfo,
+ [out] ULONGLONG *puResponse);
+
+ HRESULT GetText(
+ [in] long lFlags,
+ [in,out] ULONG *puBuffLength,
+ [in,out,string] LPWSTR pszText);
+};
+
+cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
+cpp_quote("#undef GetClassName")
+cpp_quote("#endif")
+
+[
+ local,
+ object,
+ uuid(3bc15af2-736c-477e-9e51-238af8667dcc)
+]
+interface IWbemPath : IUnknown
+{
+ HRESULT SetText(
+ [in] ULONG uMode,
+ [in] LPCWSTR pszPath);
+
+ HRESULT GetText(
+ [in] long lFlags,
+ [in,out] ULONG *puBuffLength,
+ [in,out,string] LPWSTR pszText);
+
+ HRESULT GetInfo(
+ [in] ULONG uRequestedInfo,
+ [out] ULONGLONG *puResponse);
+
+ HRESULT SetServer(
+ [in,string] LPCWSTR Name);
+
+ HRESULT GetServer(
+ [in,out] ULONG *puNameBufLength,
+ [in,out,string] LPWSTR pName);
+
+ HRESULT GetNamespaceCount(
+ [out] ULONG *puCount);
+
+ HRESULT SetNamespaceAt(
+ [in] ULONG uIndex,
+ [in,string] LPCWSTR pszName);
+
+ HRESULT GetNamespaceAt(
+ [in] ULONG uIndex,
+ [in,out] ULONG *puNameBufLength,
+ [in,out,string] LPWSTR pName);
+
+ HRESULT RemoveNamespaceAt(
+ [in] ULONG uIndex);
+
+ HRESULT RemoveAllNamespaces();
+
+ HRESULT GetScopeCount(
+ [out] ULONG *puCount);
+
+ HRESULT SetScope(
+ [in] ULONG uIndex,
+ [in] LPWSTR pszClass);
+
+ HRESULT SetScopeFromText(
+ [in] ULONG uIndex,
+ [in] LPWSTR pszText);
+
+ HRESULT GetScope(
+ [in] ULONG uIndex,
+ [in,out] ULONG *puClassNameBufSize,
+ [in,out] LPWSTR pszClass,
+ [out] IWbemPathKeyList **pKeyList);
+
+ HRESULT GetScopeAsText(
+ [in] ULONG uIndex,
+ [in,out] ULONG *puTextBufSize,
+ [in,out] LPWSTR pszText);
+
+ HRESULT RemoveScope(
+ [in] ULONG uIndex);
+
+ HRESULT RemoveAllScopes();
+
+ HRESULT SetClassName(
+ [in,string] LPCWSTR Name);
+
+ HRESULT GetClassName(
+ [in,out] ULONG *puBuffLength,
+ [in,out,string] LPWSTR pszName);
+
+ HRESULT GetKeyList(
+ [out] IWbemPathKeyList **pOut);
+
+ HRESULT CreateClassPart(
+ [in] long lFlags,
+ [in,string] LPCWSTR Name);
+
+ HRESULT DeleteClassPart(
+ [in] long lFlags);
+
+ BOOL IsRelative(
+ [in,string] LPWSTR wszMachine,
+ [in,string] LPWSTR wszNamespace);
+
+ BOOL IsRelativeOrChild(
+ [in,string] LPWSTR wszMachine,
+ [in,string] LPWSTR wszNamespace,
+ [in] long lFlags);
+
+ BOOL IsLocal(
+ [in,string] LPCWSTR wszMachine);
+
+ BOOL IsSameClassName(
+ [in,string] LPCWSTR wszClass);
+};
+
+[
+ uuid(cf4cc405-e2c5-4ddd-b3ce-5e7582d8c9fa)
+]
+coclass WbemDefPath
+{
+ interface IWbemPath;
+};
--
1.7.10.4
More information about the wine-patches
mailing list