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.

111 lines
5.1 KiB

  1. // ==================================================================================================================
  2. // R A S A P I . H
  3. // ==================================================================================================================
  4. #ifndef __RASAPI_H
  5. #define __RASAPI_H
  6. // ==================================================================================================================
  7. // Depends On
  8. // ==================================================================================================================
  9. #include <ras.h>
  10. #include <raserror.h>
  11. #include <rasdlg.h>
  12. // ==================================================================================================================
  13. // API Typedefs
  14. // ==================================================================================================================
  15. typedef DWORD (APIENTRY *RASDIALPROC)(LPRASDIALEXTENSIONS, LPTSTR, LPRASDIALPARAMS, DWORD, LPVOID, LPHRASCONN);
  16. typedef DWORD (APIENTRY *RASENUMCONNECTIONSPROC)(LPRASCONN, LPDWORD, LPDWORD);
  17. typedef DWORD (APIENTRY *RASENUMENTRIESPROC)(LPTSTR, LPTSTR, LPRASENTRYNAME, LPDWORD, LPDWORD);
  18. typedef DWORD (APIENTRY *RASGETCONNECTSTATUSPROC)(HRASCONN, LPRASCONNSTATUS);
  19. typedef DWORD (APIENTRY *RASGETERRORSTRINGPROC)(UINT, LPTSTR, DWORD);
  20. typedef DWORD (APIENTRY *RASHANGUPPROC)(HRASCONN);
  21. typedef DWORD (APIENTRY *RASSETENTRYDIALPARAMSPROC)(LPTSTR, LPRASDIALPARAMS, BOOL);
  22. typedef DWORD (APIENTRY *RASGETENTRYDIALPARAMSPROC)(LPTSTR, LPRASDIALPARAMS, BOOL*);
  23. typedef DWORD (APIENTRY *RASCREATEPHONEBOOKENTRYPROC)(HWND, LPTSTR);
  24. typedef DWORD (APIENTRY *RASEDITPHONEBOOKENTRYPROC)(HWND, LPTSTR, LPTSTR);
  25. typedef BOOL (APIENTRY *RASDIALDLGPROC)(LPSTR, LPSTR, LPSTR, LPRASDIALDLG);
  26. // =================================================================================
  27. // RAS Connection Handler
  28. // =================================================================================
  29. #define MAX_RAS_ERROR 256
  30. class CRas
  31. {
  32. private:
  33. ULONG m_cRef;
  34. BOOL m_fIStartedRas;
  35. DWORD m_iConnectType;
  36. TCHAR m_szConnectName[RAS_MaxEntryName + 1];
  37. TCHAR m_szCurrentConnectName[RAS_MaxEntryName + 1];
  38. HRASCONN m_hRasConn;
  39. BOOL m_fForceHangup;
  40. RASDIALPARAMS m_rdp;
  41. BOOL m_fSavePassword;
  42. BOOL m_fShutdown;
  43. private:
  44. // ----------------------------------------------------------
  45. // RAS Async Dial Progress Dialog
  46. // ----------------------------------------------------------
  47. HRESULT HrStartRasDial(HWND hwndParent);
  48. static INT_PTR CALLBACK RasProgressDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  49. VOID FailedRasDial(HWND hwnd, HRESULT hrRasError, DWORD dwRasError);
  50. static BOOL CALLBACK RasLogonDlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  51. HRESULT HrRasLogon(HWND hwndParent, BOOL fForcePrompt);
  52. UINT UnPromptCloseConn(HWND hwnd);
  53. static BOOL CALLBACK RasCloseConnDlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  54. BOOL FLogonRetry(HWND hwnd, LPTSTR pszCancel);
  55. public:
  56. // ----------------------------------------------------------
  57. // Construction and Destruction
  58. // ----------------------------------------------------------
  59. CRas();
  60. ~CRas();
  61. // ----------------------------------------------------------
  62. // Ref Counting of course
  63. // ----------------------------------------------------------
  64. ULONG AddRef(VOID);
  65. ULONG Release(VOID);
  66. // ----------------------------------------------------------
  67. // Before you try to connect !!!
  68. // ----------------------------------------------------------
  69. VOID SetConnectInfo(DWORD iConnectType, LPTSTR pszConnectName);
  70. // ----------------------------------------------------------
  71. // Connect using ConnectInfo
  72. // ----------------------------------------------------------
  73. HRESULT HrConnect(HWND hwnd);
  74. // ----------------------------------------------------------
  75. // Disconnect
  76. // ----------------------------------------------------------
  77. VOID Disconnect(HWND hwnd, BOOL fShutdown);
  78. // ----------------------------------------------------------
  79. // Are we actually using a RAS connection
  80. // ----------------------------------------------------------
  81. BOOL FUsingRAS(VOID);
  82. // ----------------------------------------------------------
  83. // Name of the current connection
  84. // ----------------------------------------------------------
  85. LPTSTR GetCurrentConnectionName() { return m_szCurrentConnectName; }
  86. };
  87. // =================================================================================
  88. // Prototypes
  89. // =================================================================================
  90. CRas *LpCreateRasObject(VOID);
  91. VOID RasInit(VOID);
  92. VOID RasDeinit(VOID);
  93. VOID FillRasCombo(HWND hwndCtl, BOOL fUpdateOnly);
  94. DWORD EditPhonebookEntry(HWND hwnd, LPTSTR pszEntryName);
  95. DWORD CreatePhonebookEntry(HWND hwnd);
  96. #endif // _RASAPI_H