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.

109 lines
2.3 KiB

  1. // DlgProp.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "wabtool.h"
  5. #include "DlgProp.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CDlgProp dialog
  13. CDlgProp::CDlgProp(CWnd* pParent /*=NULL*/)
  14. : CDialog(CDlgProp::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CDlgProp)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. }
  20. void CDlgProp::DoDataExchange(CDataExchange* pDX)
  21. {
  22. CDialog::DoDataExchange(pDX);
  23. //{{AFX_DATA_MAP(CDlgProp)
  24. // NOTE: the ClassWizard will add DDX and DDV calls here
  25. //}}AFX_DATA_MAP
  26. }
  27. BEGIN_MESSAGE_MAP(CDlgProp, CDialog)
  28. //{{AFX_MSG_MAP(CDlgProp)
  29. //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CDlgProp message handlers
  33. BOOL CDlgProp::OnInitDialog()
  34. {
  35. CDialog::OnInitDialog();
  36. CEdit * pEdit = (CEdit *) GetDlgItem(IDC_EDIT_TAG);
  37. pEdit->SetLimitText(32);
  38. TCHAR sz[32];
  39. wsprintf(sz, "%x", m_ulPropTag);
  40. pEdit->SetWindowText(sz);
  41. pEdit = (CEdit *) GetDlgItem(IDC_EDIT_VALUE);
  42. pEdit->SetLimitText(512);
  43. pEdit->SetWindowText(m_lpszPropVal);
  44. return TRUE; // return TRUE unless you set the focus to a control
  45. // EXCEPTION: OCX Property Pages should return FALSE
  46. }
  47. ULONG GetULONGVal(CEdit * pEdit)
  48. {
  49. TCHAR sz[32];
  50. const LPTSTR lpZero = "00000000";
  51. pEdit->GetWindowText(sz, sizeof(sz));
  52. int nLen = lstrlen(sz);
  53. if(nLen < 8)
  54. {
  55. // pad with zeros
  56. TCHAR sz1[32];
  57. lstrcpy(sz1, sz);
  58. CopyMemory(sz, lpZero, 8-nLen);
  59. sz[8-nLen] = '\0';
  60. lstrcat(sz, sz1);
  61. }
  62. CharUpper(sz);
  63. LPTSTR lp = sz;
  64. ULONG ulVal = 0;
  65. while(lp && *lp)
  66. {
  67. int i = 0;
  68. if(*lp >= 'A' && *lp <= 'F')
  69. i = *lp - 'A' + 10;
  70. else if(*lp >= '0' && *lp <= '9')
  71. i = *lp - '0';
  72. ulVal = ulVal * 16 + i;
  73. lp = CharNext(lp);
  74. }
  75. return ulVal;
  76. }
  77. void CDlgProp::OnOK()
  78. {
  79. m_ulPropTag = GetULONGVal((CEdit *) GetDlgItem(IDC_EDIT_TAG));
  80. GetDlgItemText(IDC_EDIT_VALUE, m_lpszPropVal, m_cbsz);
  81. CDialog::OnOK();
  82. }