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.

98 lines
2.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2001.
  5. //
  6. // File: users.h
  7. //
  8. // Contents:
  9. //
  10. //----------------------------------------------------------------------------
  11. // Users.h: interface for the CUsers class.
  12. //
  13. //////////////////////////////////////////////////////////////////////
  14. #if !defined(AFX_USERS_H__FFCA99DE_56E0_11D1_BB65_00A0C906345D__INCLUDED_)
  15. #define AFX_USERS_H__FFCA99DE_56E0_11D1_BB65_00A0C906345D__INCLUDED_
  16. #if _MSC_VER >= 1000
  17. #pragma once
  18. #endif // _MSC_VER >= 1000
  19. #pragma warning(push, 3)
  20. #include <winefs.h>
  21. #pragma warning(pop)
  22. #define USERINFILE 1
  23. #define USERADDED 2
  24. #define USERREMOVED 4
  25. typedef struct USERSONFILE {
  26. USERSONFILE * m_pNext;
  27. DWORD m_dwFlag; // If the item is added, removed or existed in the file
  28. PVOID m_pCert; // Either the hash or the Blob
  29. PCCERT_CONTEXT m_pCertContext; // Cert Context. To be released when the item is deleted.
  30. LPWSTR m_szUserName;
  31. LPWSTR m_szDnName;
  32. PSID m_UserSid;
  33. } USERSONFILE, *PUSERSONFILE;
  34. //
  35. // This class supports single thread only.
  36. //
  37. class CUsers
  38. {
  39. public:
  40. CUsers();
  41. virtual ~CUsers();
  42. public:
  43. void Clear(void);
  44. DWORD GetUserRemovedCnt();
  45. DWORD GetUserAddedCnt();
  46. DWORD Add(
  47. LPWSTR UserName,
  48. LPWSTR DnName,
  49. PVOID UserCert,
  50. PSID UserSid = NULL,
  51. DWORD Flag = USERINFILE,
  52. PCCERT_CONTEXT pContext = NULL
  53. );
  54. DWORD Add( CUsers &NewUsers );
  55. PUSERSONFILE RemoveItemFromHead(void);
  56. DWORD Remove(
  57. LPCWSTR UserName,
  58. LPCWSTR CertName
  59. );
  60. PUSERSONFILE StartEnum();
  61. PUSERSONFILE GetNextUser(
  62. PUSERSONFILE Token,
  63. CString &UserName,
  64. CString &CertName
  65. );
  66. PVOID GetNextChangedUser(
  67. PVOID Token,
  68. LPWSTR *UserName,
  69. LPWSTR *DnName,
  70. PSID *UserSid,
  71. PVOID *CertData,
  72. DWORD *Flag
  73. );
  74. private:
  75. DWORD m_UserAddedCnt;
  76. DWORD m_UserRemovedCnt;
  77. PUSERSONFILE m_UsersRoot;
  78. };
  79. #endif // !defined(AFX_USERS_H__FFCA99DE_56E0_11D1_BB65_00A0C906345D__INCLUDED_)