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.

164 lines
6.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: cnetapi.h
  7. //
  8. // Contents: Network/SENS API wrappers
  9. //
  10. // Classes:
  11. //
  12. // Notes:
  13. //
  14. // History: 08-Dec-97 rogerg Created.
  15. //
  16. //--------------------------------------------------------------------------
  17. #ifndef _MOBSYNC_NETAPIIMPL
  18. #define _MOBSYNC_NETAPIIMPL
  19. // not defined until 401 but need to include header as 40 so rasconn
  20. // structure is valid on 40
  21. #ifndef RASADP_LoginSessionDisable
  22. #define RASADP_LoginSessionDisable 1
  23. #endif // RASADP_LoginSessionDisable
  24. // Sens definitions
  25. typedef BOOL (WINAPI *ISNETWORKALIVE)(LPDWORD);
  26. // Ras definitions
  27. typedef DWORD (APIENTRY *RASENUMCONNECTIONSW)( LPRASCONNW, LPDWORD, LPDWORD );
  28. typedef DWORD (APIENTRY *RASENUMCONNECTIONSA)( LPRASCONNA, LPDWORD, LPDWORD );
  29. typedef DWORD (APIENTRY *RASDIAL)(LPRASDIALEXTENSIONS, LPTSTR, LPRASDIALPARAMS, DWORD,
  30. LPVOID, LPHRASCONN );
  31. typedef DWORD (APIENTRY *RASHANGUP)( HRASCONN );
  32. typedef DWORD (APIENTRY *RASGETCONNECTSTATUSPROC)( HRASCONN, LPRASCONNSTATUS );
  33. typedef DWORD (APIENTRY *RASGETERRORSTRINGPROCW)( UINT, LPWSTR, DWORD );
  34. typedef DWORD (APIENTRY *RASGETERRORSTRINGPROCA)( UINT, LPSTR, DWORD );
  35. typedef DWORD (APIENTRY *RASGETAUTODIALPARAM)(DWORD, LPVOID, LPDWORD );
  36. typedef DWORD (APIENTRY *RASSETAUTODIALPARAM)(DWORD, LPVOID, DWORD );
  37. typedef DWORD (APIENTRY *RASENUMENTRIESPROCA)( LPSTR, LPSTR, LPRASENTRYNAMEA, LPDWORD,
  38. LPDWORD );
  39. typedef DWORD (APIENTRY *RASENUMENTRIESPROCW)( LPWSTR, LPWSTR, LPRASENTRYNAMEW, LPDWORD,
  40. LPDWORD );
  41. typedef DWORD (APIENTRY *RASGETENTRYPROPERTIESPROC)(LPTSTR, LPTSTR, LPBYTE, LPDWORD,
  42. LPBYTE, LPDWORD );
  43. #ifndef RASDEFINED
  44. #define RASDEFINED
  45. #endif //RASDEFINED
  46. // wininet definitions
  47. typedef DWORD (WINAPI *INTERNETDIAL)(HWND hwndParent,char* lpszConnectoid,DWORD dwFlags,
  48. LPDWORD lpdwConnection, DWORD dwReserved);
  49. typedef DWORD (WINAPI *INTERNETDIALW)(HWND hwndParent,WCHAR* lpszConnectoid,DWORD dwFlags,
  50. LPDWORD lpdwConnection, DWORD dwReserved);
  51. typedef DWORD (WINAPI *INTERNETHANGUP)(DWORD dwConnection,DWORD dwReserved);
  52. typedef BOOL (WINAPI *INTERNETAUTODIAL)(DWORD dwFlags,DWORD dwReserved);
  53. typedef BOOL (WINAPI *INTERNETAUTODIALHANGUP)(DWORD dwReserved);
  54. typedef BOOL (WINAPI *INTERNETGETLASTRESPONSEINFO)(LPDWORD lpdwError,
  55. LPSTR lpszBuffer,LPDWORD lpdwBufferLength);
  56. typedef BOOL (WINAPI *INTERNETQUERYOPTION)( HINTERNET hInternet,
  57. DWORD dwOption,
  58. LPVOID lpBuffer,
  59. LPDWORD lpdwBufferLength );
  60. typedef BOOL (WINAPI *INTERNETSETOPTION)( HINTERNET hInternet,
  61. DWORD dwOption,
  62. LPVOID lpBuffer,
  63. DWORD dwBufferLength );
  64. // declaration of our internal class
  65. class CNetApi : public INetApi, public CLockHandler
  66. {
  67. public:
  68. CNetApi();
  69. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  70. STDMETHODIMP_(ULONG) AddRef();
  71. STDMETHODIMP_(ULONG) Release();
  72. STDMETHODIMP_(BOOL) IsSensInstalled(void);
  73. STDMETHODIMP_(BOOL) IsNetworkAlive(LPDWORD lpdwFlags);
  74. STDMETHODIMP GetWanConnections(DWORD *cbNumEntries,RASCONN **pWanConnections);
  75. STDMETHODIMP FreeWanConnections(RASCONN *pWanConnections);
  76. STDMETHODIMP GetConnectionStatus(LPCTSTR pszConnectionName,DWORD ConnectionType,BOOL *fConnected,BOOL *fCanEstablishConnection);
  77. STDMETHODIMP RasGetAutodial( BOOL& fEnabled );
  78. STDMETHODIMP RasSetAutodial( BOOL fEnabled );
  79. STDMETHODIMP_(DWORD) RasGetErrorStringProc( UINT uErrorValue, LPTSTR lpszErrorString,DWORD cBufSize);
  80. STDMETHODIMP_(DWORD) RasEnumEntries(LPWSTR reserved,LPWSTR lpszPhoneBook,
  81. LPRASENTRYNAME lprasEntryName,LPDWORD lpcb,LPDWORD lpcEntries);
  82. STDMETHODIMP_(DWORD) RasEnumConnections(LPRASCONNW lprasconn,LPDWORD lpcb,LPDWORD lpcConnections);
  83. // methods for calling wininet
  84. STDMETHODIMP_(DWORD) InternetDialA(HWND hwndParent,char* lpszConnectoid,DWORD dwFlags,
  85. LPDWORD lpdwConnection, DWORD dwReserved);
  86. STDMETHODIMP_(DWORD)InternetDialW(HWND hwndParent,WCHAR* lpszConnectoid,DWORD dwFlags,
  87. LPDWORD lpdwConnection, DWORD dwReserved);
  88. STDMETHODIMP_(DWORD)InternetHangUp(DWORD dwConnection,DWORD dwReserved);
  89. STDMETHODIMP_(BOOL) InternetAutodial(DWORD dwFlags,DWORD dwReserved);
  90. STDMETHODIMP_(BOOL) InternetAutodialHangup(DWORD dwReserved);
  91. STDMETHODIMP InternetGetAutodial( DWORD *pdwMode );
  92. STDMETHODIMP InternetSetAutodial( DWORD dwMode );
  93. STDMETHODIMP_(BOOL) IsGlobalOffline(void);
  94. STDMETHODIMP_(BOOL) SetOffline(BOOL fOffline);
  95. private:
  96. ~CNetApi();
  97. HRESULT LoadRasApiDll();
  98. HRESULT LoadWinInetDll();
  99. STDMETHODIMP LoadSensDll();
  100. HRESULT _InternetGetAutodialFromWininet(DWORD *pdwMode);
  101. HRESULT _InternetGetAutodialFromRegistry(DWORD *pdwMode);
  102. HRESULT _InternetSetAutodialViaWininet(DWORD dwMode);
  103. HRESULT _InternetSetAutodialViaRegistry(DWORD dwMode);
  104. // Sens Dll imports
  105. BOOL m_fTriedToLoadSens;
  106. HINSTANCE m_hInstSensApiDll;
  107. ISNETWORKALIVE m_pIsNetworkAlive;
  108. // Ras Dll Imports
  109. BOOL m_fTriedToLoadRas;
  110. HINSTANCE m_hInstRasApiDll;
  111. RASENUMCONNECTIONSW m_pRasEnumConnectionsW;
  112. RASENUMCONNECTIONSA m_pRasEnumConnectionsA;
  113. RASENUMENTRIESPROCA m_pRasEnumEntriesA;
  114. RASENUMENTRIESPROCW m_pRasEnumEntriesW;
  115. RASGETENTRYPROPERTIESPROC m_pRasGetEntryPropertiesW;
  116. RASGETERRORSTRINGPROCW m_pRasGetErrorStringW;
  117. RASGETERRORSTRINGPROCA m_pRasGetErrorStringA;
  118. // Ras dll imports of NT 4 or 5
  119. RASGETAUTODIALPARAM m_pRasGetAutodialParam;
  120. RASSETAUTODIALPARAM m_pRasSetAutodialParam;
  121. // wininet Dll Imports
  122. BOOL m_fTriedToLoadWinInet;
  123. HINSTANCE m_hInstWinInetDll;
  124. INTERNETDIAL m_pInternetDial;
  125. INTERNETDIALW m_pInternetDialW;
  126. INTERNETHANGUP m_pInternetHangUp;
  127. INTERNETAUTODIAL m_pInternetAutodial;
  128. INTERNETAUTODIALHANGUP m_pInternetAutodialHangup;
  129. INTERNETQUERYOPTION m_pInternetQueryOption;
  130. INTERNETSETOPTION m_pInternetSetOption;
  131. ULONG m_cRefs; // Reference count for this global object
  132. };
  133. #endif // _MOBSYNC_NETAPIIMPL