- Timestamp:
- Aug 9, 2011, 10:02:32 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UCommon.pas
r252 r260 277 277 278 278 function LoggedOnUserNameEx(Format: TUserNameFormat): string; 279 var 280 UserName: array[0..250] of Char; 279 const 280 MaxLength = 1000; 281 var 282 UserName: array[0..MaxLength] of Char; 281 283 VersionInfo: TOSVersionInfo; 282 284 Size: DWORD; … … 284 286 VersionInfo := GetVersionInfo; 285 287 if VersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT then begin 286 Size := 250;288 Size := MaxLength; 287 289 GetUserNameEx(Integer(Format), @UserName, @Size); 288 Result := UTF8Encode(UserName); 290 //ShowMessage(SysErrorMessage(GetLastError)); 291 if GetLastError = 0 then Result := UTF8Encode(UserName) 292 else Result := GetUserName; 289 293 end else Result := GetUserName; 290 294 end;
Note:
See TracChangeset
for help on using the changeset viewer.