Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.9 KiB

  1. import "unknwn.idl";
  2. cpp_quote("#ifndef _SERVICE_H_")
  3. cpp_quote("#define _SERVICE_H_")
  4. #define SERVICE_STATUS_HANDLE_MIDL
  5. #ifndef DECLARE_HANDLE
  6. #define DECLARE_HANDLE(name) \
  7. struct name##__ { DWORD_PTR unused; }; \
  8. typedef struct name##__ _far* name
  9. #endif
  10. [
  11. object,
  12. local,
  13. uuid(02506D0A-A7F5-419d-94D2-ED26F0753654),
  14. helpstring("Mini-Service Interface"),
  15. pointer_default(unique)
  16. ]
  17. interface IService : IUnknown
  18. {
  19. cpp_quote("#ifdef SERVICE_STATUS_HANDLE_MIDL")
  20. DECLARE_HANDLE(SERVICE_STATUS_HANDLE);
  21. cpp_quote("#endif")
  22. // pszEventRelinquishControl is the name of an event used to signal this
  23. // object (running on a diff thread than the main service thread) that some
  24. // service control events needs to be processed. It is in a signaled
  25. // state as long as there is event(s) to process.
  26. // The Run method should return as soon as possible when the event is in a
  27. // signaled state.
  28. // Do minimum intialization in this fct. After that fct is called and
  29. // InitDeviceEventHandler is called too (if applicable) the service will
  30. // be reported as running. Then InitFinal will be called.
  31. HRESULT InitMinimum([in] DWORD cArg, [in] LPWSTR* ppszArgs,
  32. [in] LPCWSTR pszEventRelinquishControl,
  33. [out] DWORD* pdwCtrlAccept, [out] BOOL* pfWantsDeviceEvents);
  34. // Called after the service is declared running, to complete
  35. // initialization.
  36. HRESULT InitFinal();
  37. HRESULT Run();
  38. // - Will be called with dwControlCode set to one of the following
  39. // depending on the value of *pdwCtrlAccept
  40. // SERVICE_CONTROL_STOP
  41. // SERVICE_CONTROL_PAUSE
  42. // SERVICE_CONTROL_CONTINUE
  43. // SERVICE_CONTROL_SHUTDOWN
  44. // SERVICE_CONTROL_PARAMCHANGE
  45. // should return S_FALSE and a non-zero dwWaitHint if pending
  46. //
  47. // - Shall not return S_FALSE for SERVICE_CONTROL_SHUTDOWN and
  48. // SERVICE_CONTROL_PARAMCHANGE, or for unknown dwControl's
  49. //
  50. // - If returns FAILED for return value, then this service will be
  51. // terminated
  52. HRESULT HandleServiceControl([in] DWORD dwControlCode,
  53. [out]DWORD* pdwWaitHint);
  54. // will be called iff (TRUE == *pfWantsDeviceEvents)
  55. HRESULT InitDeviceEventHandler([in] SERVICE_STATUS_HANDLE ssh);
  56. // will be called iff (TRUE == *pfWantsDeviceEvents)
  57. HRESULT HandleDeviceEvent([in] DWORD dwEventType, [in] LPVOID pEventData);
  58. // will be called iff (SERVICE_ACCEPT_POWEREVENT & *pdwCtrlAccept)
  59. HRESULT HandlePowerEvent([in] DWORD dwEventType, [in] LPVOID pEventData);
  60. // will be called iff (SERVICE_ACCEPT_HARDWAREPROFILECHANGE &
  61. // *pdwCtrlAccept)
  62. HRESULT HandleHWProfileEvent([in] DWORD dwEventType,
  63. [in] LPVOID pEventData);
  64. // will be called iff SERVICE_CONTROL_SESSIONCHANGE occured
  65. HRESULT HandleSessionChange([in] DWORD dwEventType, [in] LPVOID pvEventData);
  66. };
  67. cpp_quote("#endif")