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.

116 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. ScOpen.h
  5. Abstract:
  6. Contains data structures used for Service Controller Handles.
  7. Also some closely-related prototypes.
  8. Author:
  9. Dan Lafferty (danl) 20-Jan-1992
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. 20-Jan-1992 danl
  14. created
  15. 11-Mar-1992 ritaw
  16. changed context handle structure
  17. 10-Apr-1992 JohnRo
  18. Added ScIsValidServiceHandle() and ScCreateServiceHandle().
  19. 15-Apr-1992 JohnRo
  20. Added ScIsValidScManagerHandle().
  21. --*/
  22. #ifndef SCOPEN_H
  23. #define SCOPEN_H
  24. #include <svcctl.h> // MIDL generated header file. (SC_RPC_HANDLE)
  25. //
  26. // Signature value in handle
  27. //
  28. #define SC_SIGNATURE 0x6E4F6373 // "scOn" in ASCII.
  29. #define SERVICE_SIGNATURE 0x76724573 // "sErv" in ASCII.
  30. //
  31. // The following are definitions for the Flags field in the handle.
  32. //
  33. // SC_HANDLE_GENERATE_ON_CLOSE indicates that NtCloseAuditAlarm must
  34. // be called when this handle is closed. This flag
  35. // is set when an audit is generated on open.
  36. //
  37. #define SC_HANDLE_GENERATE_ON_CLOSE 0x0001
  38. //
  39. // Data associated with each opened context handle
  40. //
  41. typedef struct _SC_HANDLE_STRUCT{
  42. DWORD Signature; // For block identification to detect some app errors
  43. DWORD Flags; // See definitions above
  44. DWORD AccessGranted; // Access granted to client.
  45. union { // Object specific data
  46. struct {
  47. LPWSTR DatabaseName; // Name of database opened
  48. } ScManagerObject;
  49. struct {
  50. LPSERVICE_RECORD ServiceRecord; // Pointer to service record
  51. } ScServiceObject;
  52. } Type;
  53. } SC_HANDLE_STRUCT, *LPSC_HANDLE_STRUCT;
  54. //
  55. // FUNCTION PROTOTYPES
  56. //
  57. DWORD
  58. ScCreateServiceHandle(
  59. IN LPSERVICE_RECORD ServiceRecord,
  60. OUT LPSC_HANDLE_STRUCT *ContextHandle
  61. );
  62. BOOL
  63. ScIsValidScManagerHandle(
  64. IN SC_RPC_HANDLE hScManager
  65. );
  66. BOOL
  67. ScIsValidServiceHandle(
  68. IN SC_RPC_HANDLE hService
  69. );
  70. typedef enum
  71. {
  72. SC_HANDLE_TYPE_MANAGER = 0,
  73. SC_HANDLE_TYPE_SERVICE
  74. }
  75. SC_HANDLE_TYPE, *PSC_HANDLE_TYPE;
  76. BOOL
  77. ScIsValidScManagerOrServiceHandle(
  78. IN SC_RPC_HANDLE ContextHandle,
  79. OUT PSC_HANDLE_TYPE phType
  80. );
  81. #endif // SCOPEN_H