科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网软件频道高手进阶:给WINDOWS服务加上描述之二

高手进阶:给WINDOWS服务加上描述之二

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

   public enum ServiceState:int { SERVICE_STOPPED = 0x1, SERVICE_START_PENDING = 0x2, SERVICE_STOP_PENDING = 0x3

作者:中国IT实验室 来源:中国IT实验室 2007年9月11日

关键字: 服务 Windows 编程

  • 评论
  • 分享微博
  • 分享邮件
  

  public enum ServiceState:int
  {
   SERVICE_STOPPED = 0x1,
   SERVICE_START_PENDING = 0x2,
   SERVICE_STOP_PENDING = 0x3,
   SERVICE_RUNNING = 0x4,
   SERVICE_CONTINUE_PENDING = 0x5,
   SERVICE_PAUSE_PENDING = 0x6,
   SERVICE_PAUSED = 0x7,
  }

  public enum ServiceControlAccepted:int
  {
   SERVICE_ACCEPT_STOP = 0x1,
   SERVICE_ACCEPT_PAUSE_CONTINUE = 0x2,
   SERVICE_ACCEPT_SHUTDOWN = 0x4,
   SERVICE_ACCEPT_PARAMCHANGE = 0x8,
   SERVICE_ACCEPT_NETBINDCHANGE = 0x10,
   SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 0x20,
   SERVICE_ACCEPT_POWEREVENT = 0x40,
   SERVICE_ACCEPT_SESSIONCHANGE = 0x80
  }

  public enum ServiceControlManagerType:int
  {
   SC_MANAGER_CONNECT = 0x1,
   SC_MANAGER_CREATE_SERVICE = 0x2,
   SC_MANAGER_ENUMERATE_SERVICE = 0x4,
   SC_MANAGER_LOCK = 0x8,
   SC_MANAGER_QUERY_LOCK_STATUS = 0x10,
   SC_MANAGER_MODIFY_BOOT_CONFIG = 0x20,
   SC_MANAGER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED + SC_MANAGER_CONNECT + SC_MANAGER_CREATE_SERVICE + SC_MANAGER_ENUMERATE_SERVICE + SC_MANAGER_LOCK + SC_MANAGER_QUERY_LOCK_STATUS + SC_MANAGER_MODIFY_BOOT_CONFIG
  }

  public enum ACCESS_TYPE:int
  {
   SERVICE_QUERY_CONFIG = 0x1,
   SERVICE_CHANGE_CONFIG = 0x2,
   SERVICE_QUERY_STATUS = 0x4,
   SERVICE_ENUMERATE_DEPENDENTS = 0x8,
   SERVICE_START = 0x10,
   SERVICE_STOP = 0x20,
   SERVICE_PAUSE_CONTINUE = 0x40,
   SERVICE_INTERROGATE = 0x80,
   SERVICE_USER_DEFINED_CONTROL = 0x100,
   SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED + SERVICE_QUERY_CONFIG + SERVICE_CHANGE_CONFIG + SERVICE_QUERY_STATUS + SERVICE_ENUMERATE_DEPENDENTS + SERVICE_START + SERVICE_STOP + SERVICE_PAUSE_CONTINUE + SERVICE_INTERROGATE + SERVICE_USER_DEFINED_CONTROL
  }

  [StructLayout(LayoutKind.Sequential)]
   public struct SERVICE_STATUS
  {
   public int dwServiceType;
   public int dwCurrentState;
   public int dwControlsAccepted;
   public int dwWin32ExitCode;
   public int dwServiceSpecificExitCode;
   public int dwCheckPoint;
   public int dwWaitHint;
  }
 
  [StructLayout(LayoutKind.Sequential)]
   public struct QUERY_SERVICE_CONFIG
  {
   public int dwServiceType;
   public int dwStartType;
   public int dwErrorControl;
   public string lpBinaryPathName;
   public string lpLoadOrderGroup;
   public int dwTagId;
   public string lpDependencies;
   public string lpServiceStartName;
   public string lpDisplayName;
  }

  public enum SC_ACTION_TYPE:int
  {
   SC_ACTION_NONE = 0,
   SC_ACTION_RESTART = 1,
   SC_ACTION_REBOOT = 2,
   SC_ACTION_RUN_COMMAND = 3,
  }

  [StructLayout(LayoutKind.Sequential)]
   public struct SC_ACTION
  {
   public SC_ACTION_TYPE SCActionType;
   public int Delay;
  }

  public enum InfoLevel:int
  {
   SERVICE_CONFIG_DESCRIPTION = 1,
   SERVICE_CONFIG_FAILURE_ACTIONS = 2
  }

  [StructLayout(LayoutKind.Sequential)]
   public struct SERVICE_DESCRIPTION
  {
   public string lpDescription;
  }

  [StructLayout(LayoutKind.Sequential)]
   public struct SERVICE_FAILURE_ACTIONS
  {
   public int dwResetPeriod;
   public string lpRebootMsg;
   public string lpCommand;
   public int cActions;
   public int lpsaActions;
  }
 }
}


 

查看本文来源

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章