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.

102 lines
2.4 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: ConnStat.h
  4. //
  5. // Module: CMDIAL32.DLL
  6. //
  7. // Synopsis: Definition for the class CConnStatistics class. Used to collect
  8. // dial statistics on Win9x.
  9. //
  10. // Copyright (c) 1996-1998 Microsoft Corporation
  11. //
  12. // Author: quintinb Created Header 08/17/99
  13. //
  14. //+----------------------------------------------------------------------------
  15. #ifndef CONNSTAT_H
  16. #define CONNSTAT_H
  17. #include <windows.h>
  18. #include <ras.h>
  19. //+---------------------------------------------------------------------------
  20. //
  21. // class CConnStatistics
  22. //
  23. // Description: A class to collect connection statistics
  24. // Not work for NT, NT has its own ras status dialog and
  25. // idle disconnect.
  26. // InitStatistics() will start gathering data from registry
  27. // OpenByDevice will gathering data from TAPI device handle
  28. //
  29. // History: fengsun Created 10/1/97
  30. //
  31. //----------------------------------------------------------------------------
  32. class CConnStatistics
  33. {
  34. public:
  35. CConnStatistics();
  36. ~CConnStatistics();
  37. BOOL IsDialupTwo() const;
  38. DWORD GetInitBytesRead() const;
  39. DWORD GetInitBytesWrite() const;
  40. BOOL IsAvailable() const; // whether statistic information is available
  41. BOOL InitStatistics();
  42. void Close(); // No more statistic information
  43. protected:
  44. BOOL GetPerfData(DWORD& dwRead, DWORD& dwWrite, DWORD& dwBaudRate) const;
  45. BOOL RasConnectionExists();
  46. void GetStatRegValues(HINSTANCE hInst);
  47. protected:
  48. DWORD m_dwBaudRate;
  49. HKEY m_hKey; // Performance registry handle
  50. DWORD m_dwInitBytesRead;
  51. DWORD m_dwInitBytesWrite;
  52. //
  53. // Registry names are different for PPP and PPTP
  54. //
  55. BOOL m_fAdapter2;
  56. //
  57. // Localized version of
  58. // "Dial-up Adapter"\TotalBytesRecvd"
  59. // "Dial-up Adapter"\TotalBytesXmit"
  60. // "Dial-up Adapter"\ConnectSpeed"
  61. //
  62. LPTSTR m_pszTotalBytesRecvd;
  63. LPTSTR m_pszTotalBytesXmit;
  64. LPTSTR m_pszConnectSpeed;
  65. };
  66. //
  67. // Inline functions
  68. //
  69. inline DWORD CConnStatistics::GetInitBytesRead() const
  70. {
  71. return m_dwInitBytesRead;
  72. }
  73. inline DWORD CConnStatistics::GetInitBytesWrite() const
  74. {
  75. return m_dwInitBytesWrite;
  76. }
  77. inline BOOL CConnStatistics::IsDialupTwo() const
  78. {
  79. return m_fAdapter2;
  80. }
  81. inline BOOL CConnStatistics::IsAvailable() const
  82. {
  83. return OS_NT5 ? TRUE : (m_hKey != NULL);
  84. }
  85. #endif