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.

168 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. nwrights.h
  5. Abstract:
  6. This module contains the prototypes for the
  7. routines called to manipulate security descriptors.
  8. Author:
  9. Chuck Y. Chan (chuckc)
  10. Revision History:
  11. ChuckC 24th Oct 1993 Created
  12. --*/
  13. //
  14. // structure used to define how a single NW Right maps to
  15. // an NT Access mask.
  16. //
  17. typedef struct _NW_TO_NT_MAPPING {
  18. ULONG NWRight ;
  19. ULONG NTAccess ;
  20. } NW_TO_NT_MAPPING, *PNW_TO_NT_MAPPING ;
  21. //
  22. // structure used to define how the Rights for a Netware object maps
  23. // to the corresponding NT AccessMasks.
  24. //
  25. // first entry is the AceFlags to distinguish between ACE for the Object
  26. // and ACE for inheritted objects
  27. //
  28. // the GENERIC_MAPPING structure should match that already defined for
  29. // the NT object in question.
  30. //
  31. // the array of NW mappings defines the NT Access Mask for each NW Right
  32. // the object uses. the last entry should be {0, 0}.
  33. //
  34. // for example, file object mappings:
  35. //
  36. // RIGHTS_MAPPING FileRightsMapping =
  37. // {
  38. // 0,
  39. // { FILE_GENERIC_READ,
  40. // FILE_GENERIC_WRITE,
  41. // FILE_GENERIC_EXECUTE,
  42. // FILE_ALL_ACCESS
  43. // },
  44. // { { NW_FILE_READ, GENERIC_READ }
  45. // { NW_FILE_WRITE, GENERIC_WRITE }
  46. // { NW_FILE_CREATE, 0 }
  47. // { NW_FILE_DELETE, GENERIC_WRITE }
  48. // { NW_FILE_PERM, WRITE_DAC }
  49. // { NW_FILE_SCAN, 0 }
  50. // { NW_FILE_MODIFY, GENERIC_WRITE }
  51. // { NW_FILE_SUPERVISOR, GENERIC_ALL }
  52. // { 0, 0 }
  53. // }
  54. // } ;
  55. //
  56. //
  57. typedef struct _RIGHTS_MAPPING {
  58. ULONG NtAceFlags ;
  59. GENERIC_MAPPING GenericMapping ;
  60. NW_TO_NT_MAPPING Nw2NtMapping[] ;
  61. } RIGHTS_MAPPING, *PRIGHTS_MAPPING ;
  62. //
  63. // define the NW_FILE_* rights
  64. //
  65. #define NW_FILE_READ 0x0001
  66. #define NW_FILE_WRITE 0x0002
  67. #define NW_FILE_CREATE 0x0008
  68. #define NW_FILE_DELETE 0x0010
  69. #define NW_FILE_PERM 0x0020
  70. #define NW_FILE_SCAN 0x0040
  71. #define NW_FILE_MODIFY 0x0080
  72. #define NW_FILE_SUPERVISOR 0x0100
  73. #define NW_PRINT_USER 0x0001
  74. #define NW_PRINT_ADMIN 0x0002
  75. #define NW_PRINTJOB_ADMIN 0x0004
  76. //
  77. // #define these so they can be changed easily. these macros
  78. // should be used to free the memory allocated by the routines in
  79. // this module.
  80. //
  81. #define NW_ALLOC(x) ((LPBYTE)LocalAlloc(LPTR,x))
  82. #define NW_FREE(p) ((void)LocalFree((HLOCAL)p))
  83. //
  84. // predefined mappings (defined in nwrights.c)
  85. //
  86. extern RIGHTS_MAPPING FileRightsMapping ;
  87. extern RIGHTS_MAPPING DirRightsMapping ;
  88. extern RIGHTS_MAPPING PrintRightsMapping ;
  89. extern RIGHTS_MAPPING JobRightsMapping ;
  90. //
  91. // function prototypes. details of parameters can be found in nwrights.c
  92. //
  93. NTSTATUS
  94. NwAddRight(
  95. PSECURITY_DESCRIPTOR pSD,
  96. PSID pSid,
  97. ULONG Rights,
  98. PRIGHTS_MAPPING pMap,
  99. PSECURITY_DESCRIPTOR *ppNewSD
  100. ) ;
  101. NTSTATUS
  102. NwRemoveRight(
  103. PSECURITY_DESCRIPTOR pSD,
  104. PSID pSid,
  105. ULONG Rights,
  106. PRIGHTS_MAPPING pMap
  107. ) ;
  108. NTSTATUS
  109. NwCheckTrusteeRights(
  110. PSECURITY_DESCRIPTOR pSD,
  111. PSID pSid,
  112. ULONG Rights,
  113. PRIGHTS_MAPPING pMap
  114. ) ;
  115. NTSTATUS
  116. NwScanTrustees(
  117. PSECURITY_DESCRIPTOR pSD,
  118. PSID **pppSids,
  119. ULONG **ppRights,
  120. ULONG *pCount,
  121. BOOL fAccessRightsOnly,
  122. PRIGHTS_MAPPING pMapObject,
  123. PRIGHTS_MAPPING pMapNewObject
  124. ) ;
  125. NTSTATUS MapNwRightsToNTAccess(
  126. ULONG NWRights,
  127. PRIGHTS_MAPPING pMap,
  128. ACCESS_MASK *pAccessMask
  129. ) ;
  130. NTSTATUS MapSpecificToGeneric(
  131. ACCESS_MASK * pAccessMask,
  132. PGENERIC_MAPPING pGenMapping ) ;
  133. NTSTATUS CreateNewSecurityDescriptor(
  134. PSECURITY_DESCRIPTOR *ppNewSD,
  135. PSECURITY_DESCRIPTOR pSD,
  136. PACL pAcl) ;