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.

95 lines
2.3 KiB

  1. // Users.h: interface for the CUsers class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_USERS_H__FFCA99DE_56E0_11D1_BB65_00A0C906345D__INCLUDED_)
  5. #define AFX_USERS_H__FFCA99DE_56E0_11D1_BB65_00A0C906345D__INCLUDED_
  6. #if _MSC_VER >= 1000
  7. #pragma once
  8. #endif // _MSC_VER >= 1000
  9. #include <winefs.h>
  10. #define USERINFILE 1
  11. #define USERADDED 2
  12. #define USERREMOVED 4
  13. typedef struct USERSONFILE {
  14. USERSONFILE * Next;
  15. DWORD Flag; // If the item is added, removed or existed in the file
  16. PVOID Cert; // Either the hash or the Blob
  17. PVOID Context; // Cert Context. To be released when the item is deleted.
  18. LPTSTR UserName;
  19. PSID UserSid;
  20. } USERSONFILE, *PUSERSONFILE;
  21. //
  22. // This class supports single thread only.
  23. //
  24. class CUsers
  25. {
  26. public:
  27. CUsers();
  28. virtual ~CUsers();
  29. public:
  30. void Clear(void);
  31. DWORD GetUserRemovedCnt();
  32. DWORD GetUserAddedCnt();
  33. DWORD Add(
  34. LPTSTR UserName,
  35. PVOID UserCert,
  36. PSID UserSid = NULL,
  37. DWORD Flag = USERINFILE,
  38. PVOID Context = NULL
  39. );
  40. DWORD Add( CUsers &NewUsers );
  41. PUSERSONFILE RemoveItemFromHead(void);
  42. DWORD Remove(
  43. LPCTSTR UserName
  44. );
  45. PVOID StartEnum();
  46. PVOID GetNextUser(
  47. PVOID Token,
  48. CString &UserName,
  49. CString &CertHash
  50. );
  51. PVOID GetNextChangedUser(
  52. PVOID Token,
  53. LPTSTR *UserName,
  54. PSID *UserSid,
  55. PVOID *CertData,
  56. DWORD *Flag
  57. );
  58. void ConvertHashToStr(
  59. PBYTE pHashData,
  60. DWORD cbData,
  61. LPWSTR OutHashStr
  62. );
  63. DWORD GetCertInfo(
  64. LPCTSTR UserName,
  65. PVOID *CertData,
  66. PVOID *CertContext
  67. );
  68. private:
  69. DWORD m_UserAddedCnt;
  70. DWORD m_UserRemovedCnt;
  71. PUSERSONFILE m_UsersRoot;
  72. };
  73. #endif // !defined(AFX_USERS_H__FFCA99DE_56E0_11D1_BB65_00A0C906345D__INCLUDED_)