Get Environment Variables by Vector ScOpE13th Nov 2006 11:06
|
---|
Summary Hi some code to retrive Environment Variables via Kernal32.dll like COMPUTERNAME,USERNAME Directorys and such. Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com call the function GetEnv(name$) with the likes of USERPROFILE ALLUSERSPROFILE APPDATA CommonProgramFiles HOMEDRIVE HOMESHARE LOGONSERVER NUMBER_OF_PROCESSORS OS Path PROCESSOR_ARCHITECTURE PROCESSOR_IDENTIFIER PROCESSOR_LEVEL PROCESSOR_REVISION ProgramFiles PROMPT SESSIONNAME SystemDrive SystemRoot function GetEnv(name$) lbuf$ = space$(255) + chr$(0) name$ = name$ + chr$(0) load dll "kernel32.dll",1 result=call dll(1,"GetEnvironmentVariableA",name$,lbuf$,256) if result=0 returnresult$ = "Environment Variable Not Found" else returnresult$ = left$(lbuf$,result) endif if DLL EXIST(1)=1 delete dll 1 endif endfunction returnresult$ |