function GetWindowsUserName: String;
const
MAX_LENGTH = 256;
var
UserNameLength: DWord;
begin
UserNameLength := MAX_LENGTH - 1;
SetLength(Result, MAX_LENGTH);
if GetUserName(PChar(Result), UserNameLength) then
SetLength(Result, UserNameLength - 1)
else
Result := ';
end;