elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Servicios de Windows
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Servicios de Windows  (Leído 987 veces)
David Vans

Desconectado Desconectado

Mensajes: 193


Ver Perfil
Servicios de Windows
« en: 10 Septiembre 2006, 18:00 pm »

HOla a todos tengo un problemilla necesito saver los servicis de mi pc y uso esto
Código:
Const ERROR_MORE_DATA = 234
Const SERVICE_ACTIVE = &H1
Const SERVICE_INACTIVE = &H2
Const SC_MANAGER_ENUMERATE_SERVICE = &H4
Const SERVICE_WIN32_OWN_PROCESS As Long = &H10
Const SERVICE_WIN32_SHARE_PROCESS As Long = &H20
Const SERVICE_WIN32 As Long = SERVICE_WIN32_OWN_PROCESS + SERVICE_WIN32_SHARE_PROCESS
Public Type SERVICE_STATUS
    dwServiceType As Long
    dwCurrentState As Long
    dwControlsAccepted As Long
    dwWin32ExitCode As Long
    dwServiceSpecificExitCode As Long
    dwCheckPoint As Long
    dwWaitHint As Long
End Type
Public Type ENUM_SERVICE_STATUS
    lpServiceName As Long
    lpDisplayName As Long
    ServiceStatus As SERVICE_STATUS
End Type
Public Declare Function OpenSCManager Lib "advapi32.dll" Alias "OpenSCManagerA" (ByVal lpMachineName As String, ByVal lpDatabaseName As String, ByVal dwDesiredAccess As Long) As Long
Public Declare Function EnumServicesStatus Lib "advapi32.dll" Alias "EnumServicesStatusA" (ByVal hSCManager As Long, ByVal dwServiceType As Long, ByVal dwServiceState As Long, lpServices As Any, ByVal cbBufSize As Long, pcbBytesNeeded As Long, lpServicesReturned As Long, lpResumeHandle As Long) As Long
Public Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hSCObject As Long) As Long
Public Declare Function lstrcpy Lib "kernel32.dll" Alias "lstrcpyA" (szDest As String, szcSource As Long) As Long
Public Function ServicesM() As String
    Dim Serv As String
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Dim hSCM As Long, lpEnumServiceStatus() As ENUM_SERVICE_STATUS, lngServiceStatusInfoBuffer As Long
    Dim strServiceName As String * 250, lngBytesNeeded As Long, lngServicesReturned As Long
    Dim hNextUnreadEntry As Long, lngStructsNeeded As Long, lngResult As Long, i As Long
    'Open connection to Service Control Manager.
    hSCM = OpenSCManager(vbNullString, vbNullString, SC_MANAGER_ENUMERATE_SERVICE)
    If hSCM = 0 Then
        'MsgBox "OpenSCManager failed. LastDllError = " & CStr(Err.LastDllError)
        Exit Function
    End If
    'Get buffer size (bytes) without passing a buffer
    'and make sure starts at 0th entry.
    hNextUnreadEntry = 0
    lngResult = EnumServicesStatus(hSCM, SERVICE_WIN32, SERVICE_ACTIVE Or SERVICE_INACTIVE, ByVal &H0, &H0, lngBytesNeeded, lngServicesReturned, hNextUnreadEntry)
    'We should receive MORE_DATA error.
    If Not Err.LastDllError = ERROR_MORE_DATA Then
        'MsgBox "LastDLLError = " & CStr(Err.LastDllError)
        Exit Function
    End If
    'Calculate the number of structures needed.
    lngStructsNeeded = lngBytesNeeded / Len(lpEnumServiceStatus(0)) + 1
    'Redimension the array according to our calculation.
    ReDim lpEnumServiceStatus(lngStructsNeeded - 1)
    'Get buffer size in bytes.
    lngServiceStatusInfoBuffer = lngStructsNeeded * Len(lpEnumServiceStatus(0))
    'Get services information starting entry 0.
    hNextUnreadEntry = 0
    lngResult = EnumServicesStatus(hSCM, SERVICE_WIN32, SERVICE_ACTIVE Or SERVICE_INACTIVE, lpEnumServiceStatus(0), lngServiceStatusInfoBuffer, lngBytesNeeded, lngServicesReturned, hNextUnreadEntry)
    If lngResult = 0 Then
        'MsgBox "EnumServicesStatus failed. LastDllError = " & CStr(Err.LastDllError)
        Exit Function
    End If
    'Get the strings and display them.
    'Me.AutoRedraw = True
    'Me.Print "All registered services:" + vbCrLf
    For i = 0 To lngServicesReturned - 1
        lngResult = lstrcpy(ByVal strServiceName, ByVal lpEnumServiceStatus(i).lpServiceName)
        Serv = Serv & StripTerminator(strServiceName) + " - "
        lngResult = lstrcpy(ByVal strServiceName, ByVal lpEnumServiceStatus(i).lpDisplayName)
        Serv = Serv & StripTerminator(strServiceName) & "<*"
        'Serv = Serv & StripTerminator(strServiceName) + " - " + StripTerminator(strServiceName)
    Next i
    'Clean up.
    CloseServiceHandle (hSCM)
    ServicesM = Serv
End Function



Esto me Da los servicos de mi maquina ya esten iniciados o no ahora queria sebr si existe alguna forma de saber la informacion de cada servicio o algun comando que me diga el estado del servico estoy mirando Net Services pero no me da informacion del servicio.
me da igual hacerlo desde visual Basic o jecutando algun comando que me devuelva el resultado gracias Gracias por vuestro tiempo


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
iniciar y detener servicios de windows
Windows
XxTheCochixX 3 5,804 Último mensaje 2 Enero 2011, 06:37 am
por XxTheCochixX
Rumores acerca de Windows 8: nuevos servicios al descubierto
Noticias
wolfbcn 2 2,138 Último mensaje 9 Mayo 2011, 17:56 pm
por Randomize
servicios de windows en red.
.NET (C#, VB.NET, ASP)
Zeroql 4 2,756 Último mensaje 20 Agosto 2011, 13:48 pm
por Zeroql
Detener servicios de windows
.NET (C#, VB.NET, ASP)
The_Saint 4 6,173 Último mensaje 30 Abril 2013, 13:06 pm
por Eleкtro
Crear servicios de Windows??
Windows
gregory90 3 3,070 Último mensaje 16 Agosto 2013, 22:46 pm
por d3xf4ult
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines