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.

52 lines
2.6 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: allowaccess.h
  4. //
  5. // Module: Common Code
  6. //
  7. // Synopsis: Implements the function AllowAccessToWorld.
  8. //
  9. // Copyright (c) 1999 Microsoft Corporation
  10. //
  11. // Author: quintinb Created 12/04/01
  12. //
  13. //+----------------------------------------------------------------------------
  14. #include <aclapi.h>
  15. typedef WINUSERAPI DWORD (WINAPI *pfnGetSidLengthRequiredSpec)(UCHAR);
  16. typedef WINUSERAPI BOOL (WINAPI *pfnInitializeSidSpec)(PSID, PSID_IDENTIFIER_AUTHORITY, BYTE);
  17. typedef WINUSERAPI PDWORD (WINAPI *pfnGetSidSubAuthoritySpec)(PSID, DWORD);
  18. typedef WINUSERAPI BOOL (WINAPI *pfnInitializeAclSpec)(PACL, DWORD, DWORD);
  19. typedef WINUSERAPI BOOL (WINAPI *pfnAddAccessAllowedAceExSpec)(PACL, DWORD, DWORD, DWORD, PSID);
  20. typedef WINUSERAPI BOOL (WINAPI *pfnInitializeSecurityDescriptorSpec)(PSECURITY_DESCRIPTOR, DWORD);
  21. typedef WINUSERAPI BOOL (WINAPI *pfnSetSecurityDescriptorDaclSpec)(PSECURITY_DESCRIPTOR, BOOL, PACL, BOOL);
  22. typedef WINUSERAPI BOOL (WINAPI *pfnSetSecurityDescriptorOwnerSpec)(PSECURITY_DESCRIPTOR, PSID, BOOL);
  23. typedef WINUSERAPI BOOL (WINAPI *pfnSetSecurityDescriptorGroupSpec)(PSECURITY_DESCRIPTOR, PSID, BOOL);
  24. typedef WINUSERAPI BOOL (WINAPI *pfnGetSecurityDescriptorDaclSpec)(PSECURITY_DESCRIPTOR, LPBOOL, PACL*, LPBOOL);
  25. typedef WINUSERAPI DWORD (WINAPI *pfnSetNamedSecurityInfoSpec)(TCHAR*, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID, PSID, PACL, PACL);
  26. typedef struct _AdvapiLinkageStruct {
  27. HMODULE hAdvapi32;
  28. union {
  29. struct {
  30. pfnGetSidLengthRequiredSpec pfnGetSidLengthRequired;
  31. pfnInitializeSidSpec pfnInitializeSid;
  32. pfnGetSidSubAuthoritySpec pfnGetSidSubAuthority;
  33. pfnInitializeAclSpec pfnInitializeAcl;
  34. pfnAddAccessAllowedAceExSpec pfnAddAccessAllowedAceEx;
  35. pfnInitializeSecurityDescriptorSpec pfnInitializeSecurityDescriptor;
  36. pfnSetSecurityDescriptorDaclSpec pfnSetSecurityDescriptorDacl;
  37. pfnSetSecurityDescriptorOwnerSpec pfnSetSecurityDescriptorOwner;
  38. pfnSetSecurityDescriptorGroupSpec pfnSetSecurityDescriptorGroup;
  39. pfnGetSecurityDescriptorDaclSpec pfnGetSecurityDescriptorDacl;
  40. pfnSetNamedSecurityInfoSpec pfnSetNamedSecurityInfo;
  41. };
  42. void *apvPfnAdvapi32[12];
  43. };
  44. } AdvapiLinkageStruct;
  45. BOOL LinkToAdavapi32(AdvapiLinkageStruct* pAdvapiLink);
  46. void UnlinkFromAdvapi32(AdvapiLinkageStruct* pAdvapiLink);
  47. DWORD AllocateSecurityDescriptorAllowAccessToWorld(PSECURITY_DESCRIPTOR *ppSd, AdvapiLinkageStruct* pAdvapiLink);
  48. BOOL AllowAccessToWorld(LPTSTR pszDirOrFile);