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.

157 lines
3.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1998
  6. //
  7. // File: dlggen.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // DlgGen.cpp : implementation file
  11. //
  12. #include "stdafx.h"
  13. #include "DlgGen.h"
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CDlgGeneral dialog
  21. CDlgGeneral::CDlgGeneral(CWnd* pParent /*=NULL*/)
  22. : CQryDialog(CDlgGeneral::IDD, pParent)
  23. {
  24. Init();
  25. }
  26. void CDlgGeneral::Init()
  27. {
  28. //{{AFX_DATA_INIT(CDlgGeneral)
  29. m_bRAS = FALSE;
  30. m_bLANtoLAN = FALSE;
  31. m_bDemandDial = FALSE;
  32. //}}AFX_DATA_INIT
  33. }
  34. void CDlgGeneral::DoDataExchange(CDataExchange* pDX)
  35. {
  36. CQryDialog::DoDataExchange(pDX);
  37. //{{AFX_DATA_MAP(CDlgGeneral)
  38. DDX_Check(pDX, IDC_QRY_CHECK_RAS, m_bRAS);
  39. DDX_Check(pDX, IDC_QRY_CHECK_LANTOLAN, m_bLANtoLAN);
  40. DDX_Check(pDX, IDC_QRY_CHECK_DEMANDDIAL, m_bDemandDial);
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(CDlgGeneral, CQryDialog)
  44. //{{AFX_MSG_MAP(CDlgGeneral)
  45. // NOTE: the ClassWizard will add message map macros here
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CDlgGeneral message handlers
  50. // Query handle will call these functions through page proc
  51. HRESULT CDlgGeneral::GetQueryParams(LPDSQUERYPARAMS* ppDsQueryParams)
  52. {
  53. HRESULT hr = S_OK;
  54. UpdateData(TRUE);
  55. CString filter;
  56. CString subFilter;
  57. try
  58. {
  59. filter = FILTER_PREFIX;
  60. #if 0 // name field is removed
  61. // Name Field
  62. if(m_strName.GetLength() != 0)
  63. {
  64. subFilter += FILTER_PREFIX;
  65. subFilter += ATTR_NAME_DN;
  66. subFilter += _T("=");
  67. subFilter += DNPREFIX_ROUTERID;
  68. subFilter += m_strName;
  69. subFilter += _T(",*");
  70. subFilter += FILTER_POSTFIX;
  71. }
  72. #endif
  73. if(m_bRAS)
  74. {
  75. subFilter += FILTER_PREFIX;
  76. subFilter += ATTR_NAME_RRASATTRIBUTE;
  77. subFilter += _T("=");
  78. subFilter += ATTR_VAL_RAS;
  79. subFilter += FILTER_POSTFIX;
  80. }
  81. if(m_bLANtoLAN)
  82. {
  83. subFilter += FILTER_PREFIX;
  84. subFilter += ATTR_NAME_RRASATTRIBUTE;
  85. subFilter += _T("=");
  86. subFilter += ATTR_VAL_LANtoLAN;
  87. subFilter += FILTER_POSTFIX;
  88. }
  89. if(m_bDemandDial)
  90. {
  91. subFilter += FILTER_PREFIX;
  92. subFilter += ATTR_NAME_RRASATTRIBUTE;
  93. subFilter += _T("=");
  94. subFilter += ATTR_VAL_DEMANDDIAL;
  95. subFilter += FILTER_POSTFIX;
  96. }
  97. if(subFilter.GetLength())
  98. {
  99. filter += _T("&");
  100. filter += FILTER_PREFIX;
  101. filter += ATTR_NAME_OBJECTCLASS;
  102. filter += _T("=");
  103. filter += ATTR_CLASS_RRASID;
  104. filter += FILTER_POSTFIX;
  105. filter += FILTER_PREFIX;
  106. filter += _T("|");
  107. filter += subFilter;
  108. filter += FILTER_POSTFIX;
  109. }
  110. else
  111. {
  112. filter += ATTR_NAME_OBJECTCLASS;
  113. filter += _T("=");
  114. filter += ATTR_CLASS_RRASID;
  115. }
  116. filter += FILTER_POSTFIX;
  117. USES_CONVERSION;
  118. LPWSTR pQuery = T2W((LPTSTR)(LPCTSTR)filter);
  119. hr = ::BuildQueryParams(ppDsQueryParams, pQuery);
  120. }
  121. catch(CMemoryException* pException)
  122. {
  123. pException->Delete();
  124. hr = E_OUTOFMEMORY;
  125. }
  126. return hr;
  127. }