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.

118 lines
2.9 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1996.
  5. //
  6. // File: member.hxx
  7. //
  8. // Contents: class used to check trustee account group memberships.
  9. //
  10. // Classes: CMemberCheck
  11. //
  12. // History: Nov-94 Created DaveMont
  13. //
  14. //--------------------------------------------------------------------
  15. #ifndef __MEMBERCHECK__
  16. #define __MEMBERCHECK__
  17. //+-------------------------------------------------------------------
  18. //
  19. // Class: CMemberCheck
  20. //
  21. // Synopsis: checks account group memberships
  22. //
  23. //--------------------------------------------------------------------
  24. class CMemberCheck
  25. {
  26. public:
  27. inline CMemberCheck(IN PTRUSTEE_NODE pTrusteeNode);
  28. inline ~CMemberCheck();
  29. DWORD Init();
  30. DWORD IsMemberOf(IN PTRUSTEE_NODE pTrusteeNode,
  31. OUT PBOOL pfIsMemberOf);
  32. private:
  33. DWORD GetDomainInfo(IN PSID pSid);
  34. DWORD GetSidType(IN PSID Sid,
  35. OUT SID_NAME_USE *pSidType);
  36. DWORD GetSidTypeMultiple(IN LONG Count,
  37. IN PSID *Sids,
  38. OUT PLSA_TRANSLATED_NAME *pNames);
  39. DWORD CheckGroup(IN PSID pSid,
  40. OUT PBOOL pfIsMemberOf,
  41. IN DWORD RecursionCount);
  42. DWORD CheckDomainUsers(IN PSID pSid,
  43. OUT PBOOL pfIsMemberOf,
  44. OUT PBOOL pbQuitEarly);
  45. DWORD CheckAlias(IN PSID pSid,
  46. OUT PBOOL pfIsMemberOf,
  47. IN DWORD RecursionCount);
  48. PTRUSTEE_NODE _pCurrentNode;
  49. PISID _pDomainSid;
  50. WCHAR _wszComputerName[MAX_COMPUTERNAME_LENGTH + 1];
  51. SAM_HANDLE _hDomain;
  52. };
  53. //+---------------------------------------------------------------------------
  54. //
  55. // Member: ctor
  56. //
  57. // Synopsis: initializes member variables
  58. //
  59. // Arguments: [IN pTrusteeNode] -- Trustee to check against
  60. //
  61. //----------------------------------------------------------------------------
  62. CMemberCheck::CMemberCheck(IN PTRUSTEE_NODE pTrusteeNode)
  63. : _pCurrentNode (pTrusteeNode),
  64. _pDomainSid (NULL),
  65. _hDomain (NULL)
  66. {
  67. }
  68. //+---------------------------------------------------------------------------
  69. //
  70. // Member: dtor
  71. //
  72. // Synopsis: frees allocated memory and closes handles
  73. //
  74. //----------------------------------------------------------------------------
  75. CMemberCheck::~CMemberCheck()
  76. {
  77. AccFree(_pDomainSid);
  78. if(_hDomain != NULL)
  79. {
  80. if(LoadDLLFuncTable() == ERROR_SUCCESS)
  81. {
  82. (*DLLFuncs.PSamCloseHandle)(_hDomain);
  83. }
  84. }
  85. }
  86. #endif // __MEMBERCHECK__