Leaked source code of windows server 2003
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.

49 lines
1.9 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Job Scheduler
  4. //
  5. // Microsoft Windows
  6. // Copyright (C) Microsoft Corporation, 2002.
  7. //
  8. // File: FolderSecurity.h
  9. //
  10. // Contents: functions to read folder security and perform access checks against it
  11. //
  12. // History: 5-April-02 HHance created
  13. //
  14. //-----------------------------------------------------------------------------
  15. #ifndef FOLDER_SECURITY_COMPILED_ALREADY
  16. #define FOLDER_SECURITY_COMPILED_ALREADY
  17. #define HandleImpersonation true
  18. #define DontHandleImpersonation false
  19. // returns S_OK if the folder's DACL allows the requested access
  20. // E_ACCESSDENIED if not
  21. // ERROR_FILE_NOT_FOUND if not found
  22. // other error on other error
  23. // HANDLE clientToken // handle to client access token
  24. // DWORD desiredAccess // requested access rights
  25. // Suggested rights:
  26. // FILE_READ_DATA
  27. // FILE_WRITE_DATA
  28. // FILE_EXECUTE
  29. // FILE_DELETE_CHILD (for directories)
  30. //
  31. HRESULT FolderAccessCheck(const WCHAR* folderName, HANDLE clientToken, DWORD desiredAccess);
  32. // helper function - uses current thread/process token
  33. // to call AccessCheck
  34. HRESULT FolderAccessCheckOnThreadToken(const WCHAR* folderName, DWORD desiredAccess);
  35. // helper function - makes use of RPC Impersonation capabilities
  36. // intended to be called from the task scheduler service process
  37. // if bHandleImpersonation is true, this function calls RPCImpersonateClient and RPCRevertToSelf
  38. HRESULT RPCFolderAccessCheck(const WCHAR* folderName, DWORD desiredAccess, bool bHandleImpersonation);
  39. // helper function - makes use of COM impersonation capabilities
  40. HRESULT CoFolderAccessCheck(const WCHAR* pFolderName, DWORD desiredAccess);
  41. #endif // FOLDER_SECURITY_COMPILED_ALREADY