User mode installing??
Posted: Sun Mar 19, 2006 1:26 am
When in user mode, where can you install programs to? Whats the official API call to find this location (if it exists!)...
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
ProcedureDLL IsUserAnAdmin()
; Changed in 1.2 because don't work with Impersonate : This version Works great
ret = openSCmanager_(#Null,#Null,#SC_MANAGER_ALL_ACCESS)
If ret
closeServiceHandle_(ret)
EndIf
If ret>0 : ret =1 : EndIf
ProcedureReturn ret
EndProcedureCode: Select all
ProcedureDLL.s GetSpecialFolderLocation(Valeur.l)
If SHGetSpecialFolderLocation_(0, Valeur, @Dossier_ID) = 0
SpecialFolderLocation.s = Space(#MAX_PATH)
SHGetPathFromIDList_(Dossier_ID, @SpecialFolderLocation)
If SpecialFolderLocation
If Right(SpecialFolderLocation, 1) <> "\"
SpecialFolderLocation + "\"
EndIf
EndIf
EndIf
ProcedureReturn SpecialFolderLocation.s
EndProcedure Thanks, I will use this.For admin right :
etc...
I figured this one out by looking at what happens to 'google earth'. But thanks all the same.For install directory use 38 as value :
etc...
Code: Select all
Debug IsUserAnAdmin_() ; 1=Yes, 0=NoWouldn't it be better to get the program files directory, then use some windows API function to see whether you can write there rather than checking whether a user is an admin or not?DoubleDutch wrote:Thanks, I will use this. :) At present I'm just using a hack that tries to create a file where it shouldn't. An error means its user mode. ;)For admin right :
etc...