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.

234 lines
7.9 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1996.
  5. //
  6. // File: MARTA.H
  7. //
  8. // Contents: Private definitions and function prototypes used by the
  9. // access control APIs to handle the provider independence
  10. //
  11. // History: 19-Jun-96 MacM Created
  12. //
  13. //--------------------------------------------------------------------
  14. #ifndef __MARTA_H__
  15. #define __MARTA_H__
  16. #include <accprov.h>
  17. //
  18. // List of entry points for the provider DLL functions
  19. //
  20. #define ACC_PROV_GET_CAPS "AccProvGetCapabilities"
  21. #define ACC_PROV_OBJ_ACCESS "AccProvIsObjectAccessible"
  22. #define ACC_PROV_GRANT_ACCESS "AccProvGrantAccessRights"
  23. #define ACC_PROV_SET_ACCESS "AccProvSetAccessRights"
  24. #define ACC_PROV_REVOKE_ACCESS "AccProvRevokeAccessRights"
  25. #define ACC_PROV_REVOKE_AUDIT "AccProvRevokeAuditRights"
  26. #define ACC_PROV_GET_ALL "AccProvGetAllRights"
  27. #define ACC_PROV_ACCESS "AccProvGetTrusteesAccess"
  28. #define ACC_PROV_AUDIT "AccProvIsAccessAudited"
  29. #define ACC_PROV_OBJ_INFO "AccProvGetAccessInfoPerObjectType"
  30. #define ACC_PROV_CANCEL "AccProvCancelOperation"
  31. #define ACC_PROV_GET_RESULTS "AccProvGetOperationResults"
  32. #define ACC_PROV_HOBJ_ACCESS "AccProvHandleIsObjectAccessible"
  33. #define ACC_PROV_HGRANT_ACCESS "AccProvHandleGrantAccessRights"
  34. #define ACC_PROV_HSET_ACCESS "AccProvHandleSetAccessRights"
  35. #define ACC_PROV_HREVOKE_ACCESS "AccProvHandleRevokeAccessRights"
  36. #define ACC_PROV_HREVOKE_AUDIT "AccProvHandleRevokeAuditRights"
  37. #define ACC_PROV_HGET_ALL "AccProvHandleGetAllRights"
  38. #define ACC_PROV_HACCESS "AccProvHandleGetTrusteesAccess"
  39. #define ACC_PROV_HAUDIT "AccProvHandleIsAccessAudited"
  40. #define ACC_PROV_HOBJ_INFO "AccProvHandleGetAccessInfoPerObjectType"
  41. //
  42. // Registry keys that hold the provider information
  43. //
  44. #define ACC_PROV_REG_ROOT \
  45. L"System\\CurrentControlSet\\Control\\LSA\\AccessProviders"
  46. #define ACC_PROV_REG_ORDER L"ProviderOrder"
  47. #define ACC_PROV_REG_UNIQUE L"RequireUniqueAccessibility"
  48. #define ACC_PROV_REG_PATH L"ProviderPath"
  49. //
  50. // Flags used to control the provider state
  51. //
  52. #define ACC_PROV_PROV_OK 0x00000001
  53. #define ACC_PROV_PROV_FAILED 0x00000000
  54. //
  55. // Indicates that the RequireUniqueAccessibility flag was present
  56. //
  57. #define ACC_PROV_REQ_UNIQUE 0x00000001
  58. //
  59. // Indicates that the providers have been loaded
  60. //
  61. #define ACC_PROV_PROVIDERS_LOADED 0x00000002
  62. //
  63. // This structure is what contains all of the required information about
  64. // each of the providers
  65. //
  66. typedef struct _ACCPROV_PROV_INFO
  67. {
  68. PWSTR pwszProviderName; // "Friendly" name of the provider
  69. PWSTR pwszProviderPath; // DLL path name. Null after
  70. // module loaded
  71. HMODULE hDll; // Module handle of the DLL
  72. // after being loaded
  73. ULONG fProviderCaps; // Provider capabilities
  74. ULONG fProviderState; // Current state of the provider
  75. //
  76. // The following is the function table used to call the provider
  77. // functions
  78. //
  79. //
  80. // General functions
  81. //
  82. pfAccProvObjAccess pfObjAccess; // AccProvIsObjectAccessible
  83. pfAccProvHandleObjAccess pfhObjAccess; // AccProvHandleIsObjectAccessible
  84. pfAccProvCancelOp pfCancel; // AccProvCancelOperation
  85. pfAccProvGetResults pfResults; // AccProvGetOperationResults
  86. //
  87. // Required path based functions
  88. //
  89. pfAccProvAddRights pfGrantAccess; // AccProvGrantAccessRights
  90. pfAccProvSetRights pfSetAccess; // AccProvSetAccessRights
  91. pfAccProvRevoke pfRevokeAccess; // AccProvRevokeAccessRights
  92. pfAccProvRevoke pfRevokeAudit; // AccProvRevokeAuditRights
  93. pfAccProvGetRights pfGetRights; // AccProvGetAllRights
  94. pfAccProvTrusteeAccess pfTrusteeAccess;// AccProvGetTrusteesAccess
  95. pfAccProvAccessAudit pfAudit; // AccProvIsAccessAudited
  96. pfAccProvGetObjTypeInfo pfObjInfo; // AccProvGetAccessInfoPerObjectType
  97. //
  98. // Optional, handle based functions
  99. //
  100. pfAccProvHandleAddRights pfhGrantAccess; // AccProvHandleGrantAccessRights
  101. pfAccProvHandleSetRights pfhSetAccess; // AccProvHandleSetAccessRights
  102. pfAccProvHandleRevoke pfhRevokeAccess; // AccProvHandleRevokeAccessRights
  103. pfAccProvHandleRevoke pfhRevokeAudit; // AccProvHandleRevokeAuditRights
  104. pfAccProvHandleGetRights pfhGetRights; // AccProvHandleGetAllRights
  105. pfAccProvHandleTrusteeAccess pfhTrusteeAccess;// AccProvHandleGetTrusteesAccess
  106. pfAccProvHandleAccessAudit pfhAudit; // AccProvHandleIsAccessAudited
  107. pfAccProvHandleGetObjTypeInfo pfhObjInfo; // AccProvHandleGetAccessInfoPerObjectType
  108. } ACCPROV_PROV_INFO, *PACCPROV_PROV_INFO;
  109. //
  110. // This structure contains all of the information about the availible security
  111. // providers
  112. //
  113. typedef struct _ACCPROV_PROVIDERS
  114. {
  115. CRITICAL_SECTION ProviderLoadLock; // Lock the provider list during load time
  116. ULONG fOptions; // Various provider options
  117. ULONG cProviders; // Number of providers;
  118. PACCPROV_PROV_INFO pProvList; // Actual list of providers
  119. } ACCPROV_PROVIDERS, *PACCPROV_PROVIDERS;
  120. extern ACCPROV_PROVIDERS gAccProviders;
  121. //
  122. // Allocates the provider list
  123. //
  124. DWORD
  125. AccProvpAllocateProviderList(IN OUT PACCPROV_PROVIDERS pProviders);
  126. //
  127. // Frees a provider list
  128. //
  129. VOID
  130. AccProvpFreeProviderList(IN PACCPROV_PROVIDERS pProviders);
  131. //
  132. // Gets the capabilities of the given provider
  133. //
  134. DWORD
  135. AccProvpGetProviderCapabilities(IN PACCPROV_PROV_INFO pProvInfo);
  136. //
  137. // Loads a provider definition from the registry
  138. //
  139. DWORD
  140. AccProvpLoadProviderDef(IN HKEY hkReg,
  141. IN PWSTR pwszNextProv,
  142. OUT PACCPROV_PROV_INFO pProvInfo);
  143. //
  144. // Initializes the list of providers
  145. //
  146. DWORD
  147. AccProvpInitProviders(IN OUT PACCPROV_PROVIDERS pProviders);
  148. //
  149. // Loads the NTMARTA.DLL functions
  150. //
  151. DWORD
  152. AccProvpLoadMartaFunctions();
  153. BOOL
  154. MartaInitialize();
  155. BOOL
  156. MartaDllInitialize(IN HINSTANCE hMod,
  157. IN DWORD dwReason,
  158. IN PVOID pvReserved);
  159. //
  160. // Unloads any loaded DLLs
  161. //
  162. VOID
  163. AccProvUnload();
  164. //
  165. // Determines the provider for an object
  166. //
  167. DWORD
  168. AccProvpProbeProviderForObject(IN PWSTR pwszObject,
  169. IN HANDLE hObject,
  170. IN SE_OBJECT_TYPE ObjectType,
  171. IN PACCPROV_PROVIDERS pProviders,
  172. OUT PACCPROV_PROV_INFO *ppProvider);
  173. //
  174. // Determines which provider should handle a request...
  175. //
  176. DWORD
  177. AccProvpGetProviderForPath(IN PCWSTR pcwszObject,
  178. IN SE_OBJECT_TYPE ObjectType,
  179. IN PCWSTR pcwszProvider,
  180. IN PACCPROV_PROVIDERS pProviders,
  181. OUT PACCPROV_PROV_INFO *ppProvider);
  182. DWORD
  183. AccProvpGetProviderForHandle(IN HANDLE hObject,
  184. IN SE_OBJECT_TYPE ObjectType,
  185. IN PCWSTR pcwszProvider,
  186. IN PACCPROV_PROVIDERS pProviders,
  187. OUT PACCPROV_PROV_INFO *ppProvider);
  188. //
  189. // Macro to load a function pointer from a DLL
  190. //
  191. #define LOAD_ENTRYPT(ptr, typ, dll, str) \
  192. ptr = (typ)GetProcAddress(dll, str); \
  193. if(ptr == NULL) \
  194. { \
  195. goto Error; \
  196. }
  197. #endif // ifndef __MARTA_H__