[PATCH 0/1] MR7745: adsldp: Implement sysinfo_get_UserName
This patch implements the sysinfo_get_UserName function, an existing FIXME for adsldp. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7745
From: Daniel Martin <dm(a)xbostechnology.com> --- dlls/adsldp/adsldp.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c index dd459f3aa18..dc4253cac99 100644 --- a/dlls/adsldp/adsldp.c +++ b/dlls/adsldp/adsldp.c @@ -237,8 +237,27 @@ static HRESULT WINAPI sysinfo_Invoke(IADsADSystemInfo *iface, DISPID dispid, REF static HRESULT WINAPI sysinfo_get_UserName(IADsADSystemInfo *iface, BSTR *retval) { - FIXME("%p,%p: stub\n", iface, retval); - return E_NOTIMPL; + ULONG size; + WCHAR *name; + + TRACE("%p,%p\n", iface, retval); + + size = 0; + GetUserNameExW(NameFullyQualifiedDN, NULL, &size); + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + return HRESULT_FROM_WIN32(GetLastError()); + + name = SysAllocStringLen(NULL, size); + if (!name) return E_OUTOFMEMORY; + + if (!GetUserNameExW(NameFullyQualifiedDN, name, &size)) + { + SysFreeString(name); + return HRESULT_FROM_WIN32(GetLastError()); + } + + *retval = name; + return S_OK; } static HRESULT WINAPI sysinfo_get_ComputerName(IADsADSystemInfo *iface, BSTR *retval) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7745
participants (2)
-
Daniel Martin -
Daniel Martin (@danlm)