Hans Leidekker : wmiutils: Implement IWbemPath::SetText and IWbemPath:: GetText.

Alexandre Julliard julliard at winehq.org
Fri Dec 21 11:05:21 CST 2012


Module: wine
Branch: master
Commit: c092d825000bb2b9e887a621ce7bf4908b434b25
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c092d825000bb2b9e887a621ce7bf4908b434b25

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Fri Dec 21 13:58:58 2012 +0100

wmiutils: Implement IWbemPath::SetText and IWbemPath::GetText.

---

 dlls/wmiutils/path.c |   39 +++++++++++++++++++++++++++++++++++----
 include/wmiutils.idl |   18 ++++++++++++++++++
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/dlls/wmiutils/path.c b/dlls/wmiutils/path.c
index d67849b..b8c0f3e 100644
--- a/dlls/wmiutils/path.c
+++ b/dlls/wmiutils/path.c
@@ -24,6 +24,7 @@
 #include "windef.h"
 #include "winbase.h"
 #include "ole2.h"
+#include "wbemcli.h"
 #include "wmiutils.h"
 
 #include "wine/debug.h"
@@ -36,6 +37,8 @@ struct path
 {
     IWbemPath IWbemPath_iface;
     LONG refs;
+    WCHAR *text;
+    int len;
 };
 
 static inline struct path *impl_from_IWbemPath( IWbemPath *iface )
@@ -58,6 +61,7 @@ static ULONG WINAPI path_Release(
     if (!refs)
     {
         TRACE("destroying %p\n", path);
+        HeapFree( GetProcessHeap(), 0, path->text );
         HeapFree( GetProcessHeap(), 0, path );
     }
     return refs;
@@ -91,8 +95,20 @@ static HRESULT WINAPI path_SetText(
     ULONG uMode,
     LPCWSTR pszPath)
 {
-    FIXME("%p, %u, %s\n", iface, uMode, debugstr_w(pszPath));
-    return E_NOTIMPL;
+    struct path *path = impl_from_IWbemPath( iface );
+    int len;
+
+    TRACE("%p, %u, %s\n", iface, uMode, debugstr_w(pszPath));
+
+    if (uMode) FIXME("igoring mode %u\n", uMode);
+
+    len = strlenW( pszPath );
+    if (!(path->text = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) )))
+        return E_OUTOFMEMORY;
+
+    strcpyW( path->text, pszPath );
+    path->len = len;
+    return S_OK;
 }
 
 static HRESULT WINAPI path_GetText(
@@ -101,8 +117,23 @@ static HRESULT WINAPI path_GetText(
     ULONG *puBufferLength,
     LPWSTR pszText)
 {
-    FIXME("%p, 0x%x, %p, %p\n", iface, lFlags, puBufferLength, pszText);
-    return E_NOTIMPL;
+    struct path *path = impl_from_IWbemPath( iface );
+
+    TRACE("%p, 0x%x, %p, %p\n", iface, lFlags, puBufferLength, pszText);
+
+    if (lFlags != WBEMPATH_GET_ORIGINAL)
+    {
+        FIXME("flags 0x%x not supported\n", lFlags);
+        return WBEM_E_INVALID_PARAMETER;
+    }
+    if (*puBufferLength < path->len + 1)
+    {
+        *puBufferLength = path->len + 1;
+        return S_OK;
+    }
+    if (pszText) strcpyW( pszText, path->text );
+    *puBufferLength = path->len + 1;
+    return S_OK;
 }
 
 static HRESULT WINAPI path_GetInfo(
diff --git a/include/wmiutils.idl b/include/wmiutils.idl
index 81834ec..82f64d1 100644
--- a/include/wmiutils.idl
+++ b/include/wmiutils.idl
@@ -21,6 +21,24 @@ import "oaidl.idl";
 interface IWbemPath;
 interface IWbemPathKeyList;
 
+typedef [v1_enum] enum tag_WBEM_PATH_CREATE_FLAG
+{
+    WBEMPATH_CREATE_ACCEPT_RELATIVE     = 0x1,
+    WBEMPATH_CREATE_ACCEPT_ABSOLUTE     = 0x2,
+    WBEMPATH_CREATE_ACCEPT_ALL          = 0x4,
+    WBEMPATH_TREAT_SINGLE_IDENT_AS_NS   = 0x8
+} tag_WBEM_PATH_CREATE_FLAG;
+
+typedef [v1_enum] enum tag_WBEM_GET_TEXT_FLAGS
+{
+    WBEMPATH_COMPRESSED                     = 0x1,
+    WBEMPATH_GET_RELATIVE_ONLY              = 0x2,
+    WBEMPATH_GET_SERVER_TOO                 = 0x4,
+    WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY  = 0x8,
+    WBEMPATH_GET_NAMESPACE_ONLY             = 0x10,
+    WBEMPATH_GET_ORIGINAL                   = 0x20
+} tag_WBEM_GET_TEXT_FLAGS;
+
 [
     local,
     object,




More information about the wine-cvs mailing list