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.

70 lines
1.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 2002
  6. //
  7. // File: credobj.h
  8. //
  9. // History: 2002/03/29 artm Separated from editor.h.
  10. //
  11. //--------------------------------------------------------------------------
  12. ////////////////////////////////////////////////////////////////////////////////
  13. // CCredentialObject
  14. //
  15. // Class manages the storing of a user name and password (latter stored using
  16. // data protection API). It also stores a flag marking whether or not to
  17. // use credentials.
  18. #ifndef _CREDENTIALOBJECT_
  19. #define _CREDENTIALOBJECT_
  20. #ifndef STRSAFE_NO_DEPRECATE
  21. #define STRSAFE_NO_DEPRECATE
  22. #endif
  23. #ifndef _DDX_ENCRYPTED
  24. #define _DDX_ENCRYPTED
  25. #endif
  26. #ifndef ENCRYPT_WITH_CRYPTPROTECTDATA
  27. #define ENCRYPT_WITH_CRYPTPROTECTDATA
  28. #endif
  29. #include "common.h"
  30. #include "EncryptedString.hpp"
  31. class CCredentialObject
  32. {
  33. public :
  34. CCredentialObject(void);
  35. CCredentialObject(const CCredentialObject* pCredObject);
  36. ~CCredentialObject(void);
  37. void GetUsername(CString& sUsername) const { sUsername = m_sUsername; }
  38. void SetUsername(LPCWSTR lpszUsername) { m_sUsername = lpszUsername; }
  39. const EncryptedString& GetPassword(void) const
  40. {
  41. return m_password;
  42. }
  43. HRESULT SetPasswordFromHwnd(HWND parentDialog, int itemResID);
  44. BOOL UseCredentials() const { return m_bUseCredentials; }
  45. void SetUseCredentials(const BOOL bUseCred) { m_bUseCredentials = bUseCred; }
  46. private :
  47. CString m_sUsername;
  48. EncryptedString m_password;
  49. BOOL m_bUseCredentials;
  50. // Disallow these to prevent accidental copying.
  51. const CCredentialObject& operator=(const CCredentialObject& rhs);
  52. CCredentialObject(const CCredentialObject& rhs);
  53. };
  54. #endif //_CREDENTIALOBJECT_