get computername and user

! inside the global Map
Module('WINAPI')
   GetComputerName(*CSTRING,*ULONG),SIGNED,RAW,PASCAL,NAME('GetComputerNameA')
   WNetGetUser(ULONG,*CSTRING,*ULONG),LONG,RAW,PASCAL,NAME('WNetGetUserA')
END

! data
WIN:Computername CSTRING(32)
WIN:Computerlen  ULONG
WIN:User         CSTRING(32)
WIN:Userlen      ULONG
WIN:Net          ULONG

! code
  WIN:Computerlen = 32
  WIN:Userlen     = 32
  ret# = GetComputerName(WIN:ComputerName,WIN:Computerlen)  ! get the computername
  ret# = WNetGetUser(WIN:Net,WIN:User,WIN:Userlen)          ! get the current user

Schreibe einen Kommentar