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.

126 lines
4.6 KiB

  1. // Pop3RegKeysUtil.cpp: implementation of the CPop3RegKeysUtil class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include <windows.h>
  5. #include <stdlib.h>
  6. #include <assert.h>
  7. #include <tchar.h>
  8. #include "Pop3RegKeysUtil.h"
  9. #include <pop3regkeys.h>
  10. //////////////////////////////////////////////////////////////////////
  11. // Construction/Destruction
  12. //////////////////////////////////////////////////////////////////////
  13. CPop3RegKeysUtil::CPop3RegKeysUtil() :
  14. m_dwAuthType(-1), m_dwCreateUser(-1), m_dwPort(-1), m_dwLoggingLevel(-1), m_dwSocketBacklog(-1), m_dwSocketMin(-1), m_dwSocketMax(-1), m_dwSocketThreshold(-1), m_dwSPARequired(-1), m_dwThreadcount(-1)
  15. {
  16. ZeroMemory( m_sAuthGuid, sizeof(m_sAuthGuid)/sizeof(TCHAR) );
  17. ZeroMemory( m_sGreeting, sizeof(m_sGreeting)/sizeof(TCHAR) );
  18. ZeroMemory( m_sMailRoot, sizeof(m_sMailRoot)/sizeof(TCHAR) );
  19. }
  20. CPop3RegKeysUtil::~CPop3RegKeysUtil()
  21. {
  22. }
  23. //////////////////////////////////////////////////////////////////////
  24. // Implementation: public
  25. //////////////////////////////////////////////////////////////////////
  26. long CPop3RegKeysUtil::Restore()
  27. {
  28. long l, lRC = ERROR_SUCCESS;
  29. if ( -1 != m_dwAuthType )
  30. {
  31. l = RegSetAuthMethod( m_dwAuthType );
  32. if ( ERROR_SUCCESS == lRC ) lRC = l;
  33. }
  34. if ( -1 != m_dwCreateUser )
  35. {
  36. l = RegSetCreateUser( m_dwCreateUser );
  37. if ( ERROR_SUCCESS == lRC ) lRC = l;
  38. }
  39. if ( -1 != m_dwPort )
  40. {
  41. l = RegSetPort( m_dwPort );
  42. if ( ERROR_SUCCESS == lRC ) lRC = l;
  43. }
  44. if ( -1 != m_dwLoggingLevel )
  45. {
  46. l = RegSetLoggingLevel( m_dwLoggingLevel );
  47. if ( ERROR_SUCCESS == lRC ) lRC = l;
  48. }
  49. if ( -1 != m_dwSocketBacklog )
  50. {
  51. l = RegSetSocketBacklog( m_dwSocketBacklog );
  52. if ( ERROR_SUCCESS == lRC ) lRC = l;
  53. }
  54. if ( -1 != m_dwSocketMin )
  55. {
  56. l = RegSetSocketMin( m_dwSocketMin );
  57. if ( ERROR_SUCCESS == lRC ) lRC = l;
  58. }
  59. if ( -1 != m_dwSocketMax )
  60. {
  61. l = RegSetSocketMax( m_dwSocketMax );
  62. if ( ERROR_SUCCESS == lRC ) lRC = l;
  63. }
  64. if ( -1 != m_dwSocketThreshold )
  65. {
  66. l = RegSetSocketThreshold( m_dwSocketThreshold );
  67. if ( ERROR_SUCCESS == lRC ) lRC = l;
  68. }
  69. if ( -1 != m_dwSPARequired )
  70. {
  71. l = RegSetSPARequired( m_dwSPARequired );
  72. if ( ERROR_SUCCESS == lRC ) lRC = l;
  73. }
  74. if ( -1 != m_dwThreadcount )
  75. {
  76. l = RegSetThreadCount( m_dwThreadcount );
  77. if ( ERROR_SUCCESS == lRC ) lRC = l;
  78. }
  79. if ( 0 < _tcslen( m_sAuthGuid ))
  80. {
  81. l = RegSetAuthGuid( m_sAuthGuid );
  82. if ( ERROR_SUCCESS == lRC ) lRC = l;
  83. }
  84. if ( 0 < _tcslen( m_sGreeting ))
  85. {
  86. l = RegSetGreeting( m_sGreeting );
  87. if ( ERROR_SUCCESS == lRC ) lRC = l;
  88. }
  89. if ( 0 < _tcslen( m_sMailRoot ))
  90. {
  91. l = RegSetMailRoot( m_sMailRoot );
  92. if ( ERROR_SUCCESS == lRC ) lRC = l;
  93. }
  94. return lRC;
  95. }
  96. long CPop3RegKeysUtil::Save()
  97. {
  98. long l, lRC = ERROR_SUCCESS;
  99. l = RegQueryAuthMethod( m_dwAuthType ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  100. l = RegQueryCreateUser( m_dwCreateUser ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  101. l = RegQueryPort( m_dwPort ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  102. l = RegQueryLoggingLevel( m_dwLoggingLevel ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  103. l = RegQuerySocketBacklog( m_dwSocketBacklog ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  104. l = RegQuerySocketMin( m_dwSocketMin ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  105. l = RegQuerySocketMax( m_dwSocketMax ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  106. l = RegQuerySocketThreshold( m_dwSocketThreshold ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  107. l = RegQuerySPARequired( m_dwSPARequired ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  108. l = RegQueryThreadCountPerCPU( m_dwThreadcount ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  109. DWORD dwSize = sizeof(m_sAuthGuid)/sizeof(TCHAR);
  110. l = RegQueryAuthGuid( m_sAuthGuid, &dwSize ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  111. l = RegQueryGreeting( m_sGreeting, sizeof(m_sGreeting)/sizeof(TCHAR) ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  112. l = RegQueryMailRoot( m_sMailRoot, sizeof(m_sMailRoot)/sizeof(TCHAR) ); if ( ERROR_SUCCESS == lRC ) lRC = l;
  113. return lRC;
  114. }