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.

102 lines
3.7 KiB

  1. /************************************************
  2. MultiUsr.h
  3. Header for multiple user functionality.
  4. Initially by Christopher Evans (cevans) 7/16/98
  5. *************************************************/
  6. #ifndef _MULTIUSR_H
  7. #define _MULTIUSR_H
  8. #define CCH_USERPASSWORD_MAX_LENGTH 16
  9. #define CCH_USERNAME_MAX_LENGTH CCH_IDENTITY_NAME_MAX_LENGTH
  10. typedef struct
  11. {
  12. BOOL fUsePassword;
  13. BOOL fPasswordValid;
  14. GUID uidUserID;
  15. TCHAR szUsername[CCH_USERNAME_MAX_LENGTH];
  16. TCHAR szPassword[CCH_USERPASSWORD_MAX_LENGTH];
  17. }USERINFO, *LPUSERINFO;
  18. typedef struct
  19. {
  20. TCHAR szUsername[CCH_USERNAME_MAX_LENGTH];
  21. BOOL fDeleteMessages;
  22. }DELETEUSERDIALOGINFO, *LPDELETEUSERDIALOGINFO;
  23. typedef struct
  24. {
  25. TCHAR szPassword[CCH_USERPASSWORD_MAX_LENGTH];
  26. TCHAR szMsg[255];
  27. }CONFIRMPWDDIALOGINFO, *LPCONFIRMPWDDIALOGINFO;
  28. typedef struct
  29. {
  30. BOOL fUsePassword;
  31. TCHAR szPassword[CCH_USERPASSWORD_MAX_LENGTH];
  32. }PASSWORD_STORE;
  33. #define ID_LOGIN_AS_LAST 0
  34. #define ID_LOGIN_ASK_ME 1
  35. #define ASK_BEFORE_LOGIN (0xffffffff)
  36. class CStringList
  37. {
  38. public:
  39. CStringList();
  40. virtual ~CStringList();
  41. inline int GetLength (void) {return m_count;}
  42. void AddString (TCHAR* lpszInString);
  43. void RemoveString (int iIndex);
  44. TCHAR* GetString (int iIndex);
  45. void Sort ();
  46. private:
  47. int m_count;
  48. int m_ptrCount;
  49. TCHAR** m_strings;
  50. };
  51. EXTERN_C void MU_Init();
  52. CStringList* MU_GetUsernameList(void);
  53. HRESULT MU_UsernameToUserId(TCHAR *lpszUsername, GUID *puidUserId);
  54. BOOL MU_GetPasswordForUsername(TCHAR *lpszInUsername, TCHAR *szOutPassword, BOOL *pfUsePassword);
  55. BOOL MU_UsernameExists(TCHAR* lpszUsername);
  56. BOOL MU_GetUserInfo(GUID *puidUserId, LPUSERINFO lpUserInfo);
  57. BOOL MU_SetUserInfo(LPUSERINFO lpUserInfo);
  58. HRESULT MU_SwitchToUser(TCHAR *lpszUsername);
  59. void MU_SwitchToLastUser();
  60. HRESULT MU_GetUserDirectoryRoot(GUID *uidUserID, DWORD dwFlags, WCHAR *lpszUserRoot, int cch);
  61. ULONG MU_CountUsers(void);
  62. HRESULT MU_GetRegRootForUserID(GUID *puidUserId, LPSTR pszPath);
  63. HRESULT MU_CreateUser(LPUSERINFO lpUserInfo);
  64. HRESULT MU_DeleteUser(GUID *puidUserId);
  65. LPCTSTR MU_GetRegRoot();
  66. HRESULT MU_MakeDefaultUser(GUID *puidUserId);
  67. BOOL MU_GetCurrentUserID(GUID *puidUserId);
  68. BOOL MU_GetDefaultUserID(GUID *puidUserId);
  69. BOOL MU_UserIdToUsername(GUID *puidUserId, TCHAR *lpszUsername, ULONG cch);
  70. BOOL MU_IdentitiesDisabled();
  71. DWORD MU_GetDefaultOptionIndex(HWND hwndCombo);
  72. DWORD MU_GetLoginOptionIndex(HWND hwndCombo);
  73. void MU_GetLoginOption(GUID *puidStartAs);
  74. BOOL MU_SetLoginOption(HWND hwndCombo, LRESULT dOption);
  75. BOOL MU_CanEditIdentity(HWND hwndParent, GUID *puidIdentityId);
  76. DWORD MU_GenerateDirectoryNameForIdentity(GUID *puidIdentityId);
  77. HRESULT MU_GetDirectoryIdForIdentity(GUID *puidIdentityId, DWORD *pdwDirId);
  78. HRESULT MU_GetDirectoryIdForIdentity(GUID *puidIdentityId, DWORD *pdwDirId);
  79. HRESULT _ClaimNextUserId(GUID *puidUserId);
  80. void _MakeDefaultFirstUser();
  81. BOOL _FillListBoxWithUsernames(HWND hListbox);
  82. BOOL _FillComboBoxWithUsernames(HWND hCombobox, HWND hListbox);
  83. void _ResetRememberedLoginOption(void);
  84. void _RememberLoginOption(HWND hwndCombo);
  85. void _MigratePasswords();
  86. #endif _MULTIUSR_H