游泳

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

2019-12-04 13:14:34来源:励志吧0次阅读

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;

}

}

}

查看本文来源

分享到: