securent.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 2k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. #ifndef _SECURENT_INC
  2. #define _SECURENT_INC
  3. // all this seurity mumbo-jumbo is only necessary on NT
  4. #ifdef WINNT
  5. //
  6. // we have some structs to help make sense of the horrible ACL api's
  7. //
  8. typedef struct _SHELL_USER_SID
  9. {
  10.     SID_IDENTIFIER_AUTHORITY sidAuthority;
  11.     DWORD dwUserGroupID;
  12.     DWORD dwUserID;
  13. } SHELL_USER_SID, *PSHELL_USER_SID;
  14. //
  15. // common SHELL_USER_SID's
  16. //
  17. extern const SHELL_USER_SID susCurrentUser;     // the current user 
  18. extern const SHELL_USER_SID susSystem;          // the "SYSTEM" group
  19. extern const SHELL_USER_SID susAdministrators;  // the "Administrators" group
  20. extern const SHELL_USER_SID susPowerUsers;      // the "Power Users" group
  21. extern const SHELL_USER_SID susGuests;          // the "Guests" group
  22. extern const SHELL_USER_SID susEveryone;        // the "Everyone" group
  23. typedef struct _SHELL_USER_PERMISSION
  24. {
  25.     SHELL_USER_SID susID;       // identifies the user for whom you want to grant permissions to
  26.     DWORD dwAccessType;         // currently, this is either ACCESS_ALLOWED_ACE_TYPE or  ACCESS_DENIED_ACE_TYPE
  27.     BOOL fInherit;              // the permissions inheritable? (eg a directory or reg key and you want new children to inherit this permission)
  28.     DWORD dwAccessMask;         // access granted (eg FILE_LIST_CONTENTS or KEY_ALL_ACCESS, etc...)
  29.     DWORD dwInheritMask;        // mask used for inheritance, usually (OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE)
  30.     DWORD dwInheritAccessMask;  // the inheritable access granted (eg GENERIC_ALL)
  31. } SHELL_USER_PERMISSION, *PSHELL_USER_PERMISSION;
  32. //
  33. // Shell helper functions for security
  34. //
  35. STDAPI_(SECURITY_DESCRIPTOR*) GetShellSecurityDescriptor(PSHELL_USER_PERMISSION* apUserPerm, int cUserPerm);
  36. STDAPI_(PTOKEN_USER) GetUserToken(HANDLE hUser);
  37. STDAPI_(LPTSTR) GetUserSid(HANDLE hToken);
  38. STDAPI_(BOOL) GetUserProfileKey(HANDLE hToken, HKEY *phkey);
  39. STDAPI_(BOOL) IsUserAnAdmin();
  40. #else
  41. // on win95 we just return FALSE here
  42. #define GetUserProfileKey(hToken, phkey) FALSE
  43. #endif // WINNT
  44. #endif // _SECURENT_INC