Dmitry Timoshkov : secur32: Slightly simplify the GetUserNameExW implementation.
Alexandre Julliard
julliard at winehq.org
Mon Jan 13 12:46:33 CST 2014
Module: wine
Branch: master
Commit: bc59d7e8303a45d7356f3972d1d8e9478552fde8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bc59d7e8303a45d7356f3972d1d8e9478552fde8
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Mon Jan 13 19:07:31 2014 +0900
secur32: Slightly simplify the GetUserNameExW implementation.
---
dlls/secur32/secur32.c | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/dlls/secur32/secur32.c b/dlls/secur32/secur32.c
index acb09cf..867fa2c 100644
--- a/dlls/secur32/secur32.c
+++ b/dlls/secur32/secur32.c
@@ -1096,16 +1096,16 @@ BOOLEAN WINAPI GetUserNameExA(
BOOLEAN WINAPI GetUserNameExW(
EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize)
{
- BOOLEAN status;
- WCHAR samname[UNLEN + 1 + MAX_COMPUTERNAME_LENGTH + 1];
- LPWSTR out;
- DWORD len;
TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize);
switch (NameFormat)
{
case NameSamCompatible:
{
+ WCHAR samname[UNLEN + 1 + MAX_COMPUTERNAME_LENGTH + 1];
+ LPWSTR out;
+ DWORD len;
+
/* This assumes the current user is always a local account */
len = MAX_COMPUTERNAME_LENGTH + 1;
if (GetComputerNameW(samname, &len))
@@ -1115,25 +1115,20 @@ BOOLEAN WINAPI GetUserNameExW(
len = UNLEN + 1;
if (GetUserNameW(out, &len))
{
- status = (lstrlenW(samname) < *nSize);
- if (status)
+ if (lstrlenW(samname) < *nSize)
{
lstrcpyW(lpNameBuffer, samname);
*nSize = lstrlenW(samname);
+ return TRUE;
}
- else
- {
- SetLastError(ERROR_MORE_DATA);
- *nSize = lstrlenW(samname) + 1;
- }
+
+ SetLastError(ERROR_MORE_DATA);
+ *nSize = lstrlenW(samname) + 1;
}
- else
- status = FALSE;
}
- else
- status = FALSE;
+ return FALSE;
}
- break;
+
case NameUnknown:
case NameFullyQualifiedDN:
case NameDisplay:
@@ -1144,14 +1139,12 @@ BOOLEAN WINAPI GetUserNameExW(
case NameServicePrincipal:
case NameDnsDomain:
SetLastError(ERROR_NONE_MAPPED);
- status = FALSE;
- break;
+ return FALSE;
+
default:
SetLastError(ERROR_INVALID_PARAMETER);
- status = FALSE;
+ return FALSE;
}
-
- return status;
}
BOOLEAN WINAPI TranslateNameA(
More information about the wine-cvs
mailing list