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.

45 lines
1.1 KiB

  1. #include "stdafx.h"
  2. #include "strpass.h"
  3. #ifdef _DEBUG
  4. #undef THIS_FILE
  5. static char BASED_CODE THIS_FILE[] = __FILE__;
  6. #endif
  7. #define new DEBUG_NEW
  8. void AFXAPI
  9. DDX_Text_SecuredString(CDataExchange * pDX, int nIDC, CStrPassword & value)
  10. {
  11. HWND hWndCtrl = pDX->PrepareEditCtrl(nIDC);
  12. if (pDX->m_bSaveAndValidate)
  13. {
  14. // get the value from the UI if we need to
  15. if (!::SendMessage(hWndCtrl, EM_GETMODIFY, 0, 0))
  16. {
  17. return;
  18. }
  19. CString strNew;
  20. int nLen = ::GetWindowTextLength(hWndCtrl);
  21. ::GetWindowText(hWndCtrl, strNew.GetBufferSetLength(nLen), nLen + 1);
  22. strNew.ReleaseBuffer();
  23. value = (LPCTSTR) strNew;
  24. }
  25. else
  26. {
  27. //
  28. // set the value in the UI if we need to
  29. //
  30. if (!value.IsEmpty())
  31. {
  32. TCHAR * pszPassword = NULL;
  33. pszPassword = value.GetClearTextPassword();
  34. if (pszPassword)
  35. {
  36. ::SetWindowText(hWndCtrl,pszPassword);
  37. }
  38. }
  39. }
  40. }