Ver Mensaje Individual
  #1  
Antiguo 09-03-2011
diego007 diego007 is offline
Miembro
 
Registrado: nov 2009
Posts: 26
Reputación: 0
diego007 Va por buen camino
Ruta de Servicios de windows

Hola amig@s, buscando en este foro me encontré con un código para ver los servicios del sistema en este direccion http://www.clubdelphi.com/foros/showthread.php?p=109245
el codigo es
Código PHP:
function ServiceGetList(sMachinestring;
                         
dwServiceTypedwServiceStateDWord;
                         
slServicesListTStrings) : boolean;
const
  
// assume that the total number of services is less than 4096.
  //Increase if necessary
  
cnMaxServices 4096;
type
  TSvcA 
= array [0..cnMaxServicesof TEnumServiceStatus;
  
PSvcA = ^TSvcA;
  var
  
jinteger;
  
// service control manager handle
  
schmSC_Handle;
  
// bytes needed for the next buffer, if any
  
nBytesNeeded,
  
// number of services
  
nServices,
  
// pointer to the next unread service entry
  
nResumeHandleDWord;
  
// service status array
  
ssaPSvcA;
begin ServiceGetList }
  
Result := false;

  
// connect to the service control manager
  
schm := OpenSCManager(PChar(sMachine), nilSC_MANAGER_ALL_ACCESS);

  
// if successful...
  
if (schm>0then
  begin
    nResumeHandle 
:= 0;

    New(
ssa);

    
EnumServicesStatus(schmdwServiceTypedwServiceStatessa^[0],
                       
sizeof(ssa^), nBytesNeedednServices,
                       
nResumeHandle);

    
// assume that our initial array was large enough to hold all
    // entries. add code to enumerate if necessary.
    
for := 0 to nServices-do
    
begin
      slServicesList
.Add(StrPas(ssa^[j].lpServiceName));
    
end; { for }
    
Result := true;

    
Dispose(ssa);

    
// close service control manager handle
    
CloseServiceHandle(schm);
  
end; { (schm>0) }
end; { ServiceGetList 
como ver la ruta completa del servicio que muestra este programa? por ejemplo ver las rutas de este tipo:
System32\DRIVERS\xxxxxxxxx.xxx
%SystemRoot%System\xxxxxxxxxx.xx
Responder Con Cita