WmiSchema.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. 
  2. namespace WMI
  3. {
  4. public enum ServiceType
  5. {
  6. KernalDriver = 1,
  7. FileSystemDriver = 2,
  8. Adapter = 4,
  9. RecognizerDriver = 8,
  10. OwnProcess = 16,
  11. ShareProcess = 32,
  12. InteractiveProcess = 256,
  13. }
  14. public enum ErrorControl
  15. {
  16. UserNotNotified = 0,
  17. UserNotified = 1,
  18. SystemRestartedWithLastKnownGoodConfiguration = 2,
  19. SystemAttemptsToStartWithAGoodConfiguration = 3
  20. }
  21. public enum StartMode
  22. {
  23. /// <summary>
  24. /// Device driver started by the operating system loader. This value is valid only for driver services.
  25. /// </summary>
  26. Boot,
  27. /// <summary>
  28. /// Device driver started by the operating system initialization process. This value is valid only for driver services.
  29. /// </summary>
  30. System,
  31. /// <summary>
  32. /// Service to be started automatically by the Service Control Manager during system startup.
  33. /// </summary>
  34. Automatic,
  35. /// <summary>
  36. /// Service to be started by the Service Control Manager when a process calls the StartService method.
  37. /// </summary>
  38. Manual,
  39. /// <summary>
  40. /// Service that can no longer be started.
  41. /// </summary>
  42. Disabled,
  43. }
  44. [WmiClassName("Win32_Service")]
  45. public interface Win32Services : IWmiCollection
  46. {
  47. // ReturnValue Create(bool desktopInteract, string displayName, int errorControl, string loadOrderGroup, string loadOrderGroupDependencies, string name, string pathName, string serviceDependencies, string serviceType, string startMode, string startName, string startPassword);
  48. void Create(string name, string displayName, string pathName, ServiceType serviceType, ErrorControl errorControl, StartMode startMode, bool desktopInteract, string[] serviceDependencies);
  49. void Create(string name, string displayName, string pathName, ServiceType serviceType, ErrorControl errorControl, StartMode startMode, bool desktopInteract, string startName, string startPassword, string[] serviceDependencies);
  50. Win32Service Select(string name);
  51. }
  52. // http://msdn.microsoft.com/en-us/library/windows/desktop/aa394418(v=vs.85).aspx
  53. public interface Win32Service : IWmiObject
  54. {
  55. string Description { get; set; }
  56. string Name { get; }
  57. bool Started { get; }
  58. void Delete();
  59. void StartService();
  60. void StopService();
  61. }
  62. }