function TMainFormLogic.GetCurrentUserLoginName :
string;
const
cnMaxUserNameLen = 254;
var
sUserName :
string;
dwUserNameLen : DWord;
begin
dwUserNameLen := cnMaxUserNameLen-1;
SetLength(sUserName, cnMaxUserNameLen);
GetUserName(PChar(sUserName), dwUserNameLen);
SetLength(sUserName, dwUserNameLen - 1);
Result := sUserName;
end;
function TMainFormLogic.GetCurrentUserData:
string;
var
outUserInfo : TADSIUserInfo;
ADCallResult : Boolean;
CurrentUserName :
string;
CurrentDomainName :
string;
s :
string;
begin
Result := '
';
try
Result := GetCurrentUserLoginName;
CurrentUserName := ActiveDirectoryClient.GetCurrentUserName;
CurrentDomainName := ActiveDirectoryClient.GetCurrentDomainName(CurrentUserName);
ADCallResult := ActiveDirectoryClient.GetUserInfo(CurrentDomainName,
CurrentUserName,
outUserInfo);
if ADCallResult
then
begin
s := Copy(outUserInfo.UserName, 1, length(outUserInfo.UserName)) + '
/ ' +
Copy(outUserInfo.Description, 1, length(outUserInfo.Description)) ;
Result := s;
end;
except
On e:
Exception do
log.SendException(cCategory, '
Fehler bei ActiveDirectory Aufruf: ' + e.
Message, e);
end;
end;