v2: fixed a typo ('==' vs. '!=').
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- 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 e033d91a7e..c96e264666 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 15f1d23acd..4fc0de41eb 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 73435a6129..1e3939f0db 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) {