Dmitry Timoshkov : adsldp: Implement IADsADSystemInfo::get_ComputerName().

Alexandre Julliard julliard at winehq.org
Wed Feb 28 15:39:34 CST 2018


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed Feb 28 11:44:49 2018 +0800

adsldp: Implement IADsADSystemInfo::get_ComputerName().

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/adsldp/Makefile.in     |  1 +
 dlls/adsldp/adsldp.c        | 25 +++++++++++++++++++++++--
 dlls/adsldp/tests/sysinfo.c |  1 -
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/dlls/adsldp/Makefile.in b/dlls/adsldp/Makefile.in
index e033d91..c96e264 100644
--- a/dlls/adsldp/Makefile.in
+++ b/dlls/adsldp/Makefile.in
@@ -1,4 +1,5 @@
 MODULE    = adsldp.dll
+IMPORTS   = oleaut32 secur32
 
 C_SRCS = \
 	adsldp.c
diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c
index 15f1d23..4fc0de4 100644
--- a/dlls/adsldp/adsldp.c
+++ b/dlls/adsldp/adsldp.c
@@ -28,6 +28,8 @@
 #include "objbase.h"
 #include "rpcproxy.h"
 #include "iads.h"
+#define SECURITY_WIN32
+#include "security.h"
 
 #include "wine/debug.h"
 
@@ -120,8 +122,27 @@ static HRESULT WINAPI sysinfo_get_UserName(IADsADSystemInfo *iface, BSTR *retval
 
 static HRESULT WINAPI sysinfo_get_ComputerName(IADsADSystemInfo *iface, BSTR *retval)
 {
-    FIXME("%p,%p: stub\n", iface, retval);
-    return E_NOTIMPL;
+    UINT size;
+    WCHAR *name;
+
+    TRACE("%p,%p\n", iface, retval);
+
+    size = 0;
+    GetComputerObjectNameW(NameFullyQualifiedDN, NULL, &size);
+    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+        return HRESULT_FROM_WIN32(GetLastError());
+
+    name = SysAllocStringLen(NULL, size);
+    if (!name) return E_OUTOFMEMORY;
+
+    if (!GetComputerObjectNameW(NameFullyQualifiedDN, name, &size))
+    {
+        SysFreeString(name);
+        return HRESULT_FROM_WIN32(GetLastError());
+    }
+
+    *retval = name;
+    return S_OK;
 }
 
 static HRESULT WINAPI sysinfo_get_SiteName(IADsADSystemInfo *iface, BSTR *retval)
diff --git a/dlls/adsldp/tests/sysinfo.c b/dlls/adsldp/tests/sysinfo.c
index 73435a6..1e3939f 100644
--- a/dlls/adsldp/tests/sysinfo.c
+++ b/dlls/adsldp/tests/sysinfo.c
@@ -79,7 +79,6 @@ static void test_ComputerName(void)
     ok(hr == S_OK, "got %#x\n", hr);
 
     hr = IADsADSystemInfo_get_ComputerName(sysinfo, &bstr);
-todo_wine
     ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_CANT_ACCESS_DOMAIN_INFO), "got %#x\n", hr);
     if (hr == S_OK)
     {




More information about the wine-cvs mailing list