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.

84 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Revision History:
  4. --*/
  5. // SelectInstanceDataMany.cpp : implementation file
  6. //
  7. #include "stdafx.h"
  8. #include "EnumGuid.h"
  9. #include "SelDataM.h"
  10. #include "wmihlp.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CSelectInstanceDataMany dialog
  18. CSelectInstanceDataMany::CSelectInstanceDataMany(LPDWORD lpVersion,
  19. LPDWORD lpDataSize, LPDWORD dwData, DWORD dwDataSize, CWnd* pParent /*=NULL*/)
  20. : CDialog(CSelectInstanceDataMany::IDD, pParent), lpVersion(lpVersion),
  21. lpDataSize(lpDataSize), dwData(dwData), dwDataSize(dwDataSize)
  22. {
  23. //{{AFX_DATA_INIT(CSelectInstanceDataMany)
  24. valVersion = 0;
  25. //}}AFX_DATA_INIT
  26. }
  27. void CSelectInstanceDataMany::DoDataExchange(CDataExchange* pDX)
  28. {
  29. CDialog::DoDataExchange(pDX);
  30. //{{AFX_DATA_MAP(CSelectInstanceDataMany)
  31. DDX_Control(pDX, IDC_DATA, txtData);
  32. DDX_Text(pDX, IDC_VERSION, valVersion);
  33. //}}AFX_DATA_MAP
  34. }
  35. BEGIN_MESSAGE_MAP(CSelectInstanceDataMany, CDialog)
  36. //{{AFX_MSG_MAP(CSelectInstanceDataMany)
  37. //}}AFX_MSG_MAP
  38. END_MESSAGE_MAP()
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CSelectInstanceDataMany message handlers
  41. void CSelectInstanceDataMany::OnOK()
  42. {
  43. CString txt, msg;
  44. TCHAR buf[1024];
  45. int i, numLines, nullLoc;
  46. UpdateData();
  47. *lpVersion = valVersion;
  48. if ((DWORD)(numLines = txtData.GetLineCount()) > dwDataSize) {
  49. msg.Format(_T("You have entered too many DWORDS. Up to %d are allowed\n"),
  50. dwDataSize);
  51. MessageBox(msg);
  52. return;
  53. }
  54. for (i = 0; i < numLines; i++) {
  55. nullLoc = txtData.GetLine(i, buf);
  56. buf[nullLoc] = 0;
  57. txt = buf;
  58. if (!ValidHexText(this, txt, dwData + i, i+1))
  59. return;
  60. }
  61. *lpDataSize = (DWORD) numLines;
  62. CDialog::OnOK();
  63. }