WmiSchema.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. Win32Service Select(string name);
  50. }
  51. // http://msdn.microsoft.com/en-us/library/windows/desktop/aa394418(v=vs.85).aspx
  52. public interface Win32Service : IWmiObject
  53. {
  54. string Description { get; set; }
  55. string Name { get; }
  56. bool Started { get; }
  57. void Delete();
  58. void StartService();
  59. void StopService();
  60. }
  61. }