Re: [Lazarus] real user name

2009-01-14 Thread Graeme Geldenhuys
2009/1/14 Reenen Laurie : > > {$ifdef windows} > username := GetEnvironmentVariable('USERNAME'); > {$endif} Nope, change that to something like: var userNameBuffer: array[0..255] of char; sizeBuffer: DWord; begin SizeBuffer := 256; getUserName(userNameBuffer, sizeBuffer); result := st

Re: [Lazarus] real user name

2009-01-14 Thread Michael Van Canneyt
On Wed, 14 Jan 2009, Reenen Laurie wrote: > Ok, so if I want code in which I want to get the username, which is > crossplatform... how should it look? > > {$ifdef windows} > username := GetEnvironmentVariable('USERNAME'); > {$endif} I'm not sure if this is correct; There is a windows call to

Re: [Lazarus] real user name

2009-01-14 Thread Reenen Laurie
Ok, so if I want code in which I want to get the username, which is crossplatform... how should it look? {$ifdef windows} username := GetEnvironmentVariable('USERNAME'); {$endif} {$ifdef linux} GetUserData(FpGetuid, Data); username := Data.pw_uid; {$endif} How about MacOS? Also, as a matte

Re: [Lazarus] real user name

2009-01-13 Thread Michael Van Canneyt
On Wed, 14 Jan 2009, Reenen Laurie wrote: > Sorry for digging up an old thread... > > I just want to know... Is this code crossplatfrom? > > GetUserData(FpGetuid, Data); > > Result.Name:= Data.pw_name; > > Result.Real_name:= Data.pw_gecos; > > Result.User_id:= Data.pw_uid; > > Result.Group_id:

Re: [Lazarus] real user name

2009-01-13 Thread Reenen Laurie
Sorry for digging up an old thread... I just want to know... Is this code crossplatfrom? GetUserData(FpGetuid, Data); > Result.Name:= Data.pw_name; > Result.Real_name:= Data.pw_gecos; > Result.User_id:= Data.pw_uid; > Result.Group_id:= Data.pw_gid; > Result.home_dir:= Data.pw_dir; > Result.shell:

Re: [Lazarus] real user name

2008-12-04 Thread Andrea Mauri
Marco van de Voort ha scritto: > In our previous episode, Andrea Mauri said: > >> I solved using GetUserData procedure from users unit. >> >> GetUserData(FpGetuid, Data); >> Result.Name:= Data.pw_name; >> Result.Real_name:= Data.pw_gecos; >> Result.User_id:= Data.pw_uid; >> Result.Grou

Re: [Lazarus] real user name

2008-12-03 Thread Marco van de Voort
In our previous episode, Andrea Mauri said: > I solved using GetUserData procedure from users unit. > > GetUserData(FpGetuid, Data); > Result.Name:= Data.pw_name; > Result.Real_name:= Data.pw_gecos; > Result.User_id:= Data.pw_uid; > Result.Group_id:= Data.pw_gid; > Result.home_dir:= Da

Re: [Lazarus] real user name

2008-12-03 Thread Andrea Mauri
Thanks Marco. I solved using GetUserData procedure from users unit. GetUserData(FpGetuid, Data); Result.Name:= Data.pw_name; Result.Real_name:= Data.pw_gecos; Result.User_id:= Data.pw_uid; Result.Group_id:= Data.pw_gid; Result.home_dir:= Data.pw_dir; Result.shell:= Data.pw_shell;

Re: [Lazarus] real user name

2008-12-03 Thread Marco van de Voort
On Tue, Dec 02, 2008 at 10:02:57PM +0100, Andrea Mauri wrote: > there is a way in order to get the real name of a linux/windows user? > In order to get the login name (linux) I used: > Result.Name:= GetEnvironmentVariable('USERNAME'); > if Result.Name = '' then > Result.Name:= GetEnvironmen

Re: [Lazarus] real user name

2008-12-02 Thread Graeme Geldenhuys
On Tue, Dec 2, 2008 at 11:02 PM, Andrea Mauri <[EMAIL PROTECTED]> wrote: > > there is a way in order to get the real name of a linux/windows user? > In order to get the login name (linux) I used: > Result.Name:= GetEnvironmentVariable('USERNAME'); > if Result.Name = '' then >Result.Name:= Get

[Lazarus] real user name

2008-12-02 Thread Andrea Mauri
Hi, there is a way in order to get the real name of a linux/windows user? In order to get the login name (linux) I used: Result.Name:= GetEnvironmentVariable('USERNAME'); if Result.Name = '' then Result.Name:= GetEnvironmentVariable('USER'); I know that in linux I can use libc (getpwuid(fp