Ver Mensaje Individual
  #2  
Antiguo 08-09-2015
Nipx4215 Nipx4215 is offline
Miembro
NULL
 
Registrado: jul 2015
Posts: 12
Reputación: 0
Nipx4215 Va por buen camino
No sé si esto podría ayudar, pero me da error al compilar la funcion

Código Delphi [-]
function TMyAppInfo.RunningAsAdmin: boolean;
var
  hToken, hProcess: THandle;
  pTokenInformation: pointer;
  ReturnLength: DWord;
  TokenInformation: TTokenElevation;
begin
  hProcess := GetCurrentProcess;
  try
    if OpenProcessToken(hProcess, TOKEN_QUERY, hToken) then try
      TokenInformation.TokenIsElevated := 0;
      pTokenInformation := @TokenInformation;
      GetTokenInformation(hToken, TokenElevation, pTokenInformation, sizeof(TokenInformation), ReturnLength);
      result := (TokenInformation.TokenIsElevated > 0);
    finally
      CloseHandle(hToken);
    end;
  except
   result := false;
  end;
end;

Última edición por Casimiro Noteví fecha: 09-09-2015 a las 01:20:59.
Responder Con Cita