ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Windows
    Platform/서비스 2010. 1. 24. 11:52
    Advapi32.dll(%SystemRoot%\System32\Advapi32.dll)


    SCM(Service Control Manager)
    RPC 서버
    SCM에게 상태를 보고(SetServiceStatus)

    HKLM\SYSTEM\CurrentControlSet\Services

    서비스 설정
    서비스 설치와 제거

    CreateService()
    ChangeServiceConfig2()

    서비스 제어
    서비스 애플릿
    새로운 서비스를 설치하거나 제거하는 기능은 포함되어 있지 않다.

    StartService()
    ControlService()

    서비스
    보통 IPC를 통하여 사용자 프로그램과 연동

    서비스 스레드를 시작(StartServiceCtrlDispatcher)
    서비스 스레드
    디스패처 핸들러를 등록(RegisterServiceCtrlHandler[Ex])
    디스패처 핸들러
    SERVICE_CONTROL_STOP
    SERVICE_CONTROL_PAUSE
    SERVICE_CONTROL_CONTINUE
    SERVICE_CONTROL_SESSIONCHANGE
    SERVICE_CONTROL_INTERROGATE


    OpenSCManager() // 서비스 매니저의 핸들을 얻는다.
    SERVICES_ACTIVE_DATABASE

    SC_MANAGER_CONNECT
    SC_MANAGER_CREATE_SERVICE
    SC_MANAGER_ALL_ACCESS
    GENERIC_READ
    CreateService()
    SERVICE_ALL_ACCESS

    SERVICE_WIN32_OWN_PROCESS
    SERVICE_KERNEL_DRIVER

    SERVICE_DEMAND_START

    SERVICE_ERROR_IGNORE
    SERVICE_ERROR_NORMAL
    OpenService() // 원하는 서비스의 핸들을 얻는다.
    SERVICE_ALL_ACCESS
    SERVICE_INTERROGATE // Enables calling of the ControlService function to ask the service to report its status immediately.
    SERVICE_USER_DEFINED_CONTROL // Enables calling of the ControlService function to specify a user-defined control code.
    GENERIC_EXECUTE
    CloseServiceHandle();
    DeleteService()
    ChangeServiceConfig2()
    SERVICE_CONFIG_DESCRIPTION
    SERVICE_CONFIG_FAILURE_ACTIONS
    StartService()
    QueryServiceStatus()
    ControlService()
    SERVICE_CONTROL_STOP
    SERVICE_CONTROL_PAUSE
    SERVICE_CONTROL_CONTINUE
    SERVICE_CONTROL_INTERROGATE
    SetServiceStatus()
    SERVICE_START_PENDING
    SERVICE_RUNNING
    SERVICE_PAUSE_PENDING
    SERVICE_PAUSED
    SERVICE_CONTINUE_PENDING
    SERVICE_STOP_PENDING
    SERVICE_STOPPED
    StartServiceCtrlDispatcher()
    RegisterServiceCtrlHandler[Ex]()
    XYNTService 서비스 프로그램
        설치/제거
            XYNTService -i
            XYNTService -u

    XYNTService.ini
        [Settings]
            ServiceName
            CheckProcessSeconds // 생성된 프로세스 감시 주기

        [Process{n}]
            CommandLine
            WorkingDir // default: c:\winnt\system32
             (PauseStart)
             (PauseEnd)
            Restart

            XYNTService -b {n}

    XYNTService.log


    참조 사이트:


Designed by Tistory.