* uinfo.cc (internal_getlogin): Reorganize slightly to minimize work in default

condition.
This commit is contained in:
Christopher Faylor
2001-10-09 23:28:24 +00:00
parent 132a3b30b9
commit d3fee5eccb
5 changed files with 24 additions and 14 deletions

View File

@@ -83,14 +83,15 @@ internal_getlogin (cygheap_user &user)
/* HOMEDRIVE and HOMEPATH are wrong most of the time, too,
after changing user context! */
sys_mbstowcs (wuser, user.name (), UNLEN + 1);
wlogsrv[0] = '\0';
if (user.logsrv ())
if (NetUserGetInfo (NULL, wuser, 3, (LPBYTE *) &ui) && user.logsrv ())
{
strcat (strcpy (buf, "\\\\"), user.logsrv ());
sys_mbstowcs (wlogsrv, buf, INTERNET_MAX_HOST_NAME_LENGTH + 3);
ui = NULL;
if (NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *) &ui))
ui = NULL;
}
if (!NetUserGetInfo (NULL, wuser, 3, (LPBYTE *)&ui)
|| (wlogsrv[0] && !NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui)))
if (ui)
{
sys_wcstombs (buf, ui->usri3_home_dir, MAX_PATH);
if (!buf[0])