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.

159 lines
7.1 KiB

  1. // ############################################################################
  2. #ifndef __RNAANPI_H_
  3. #define __RNAANPI_H_
  4. #include "enumodem.h"
  5. #include "obcomglb.h"
  6. #define RASAPI_LIBRARY L"RASAPI32.DLL"
  7. #define RNAPH_LIBRARY L"RNAPH.DLL"
  8. #define RASAPI_RASSETENTRY "RasSetEntryPropertiesA"
  9. #define RASAPI_RASGETENTRY "RasGetEntryPropertiesA"
  10. #define RASAPI_RASDELETEENTRY "RasDeleteEntryA"
  11. #define LEN_APPEND_INT 3 // number of digits for MAX_APPEND_INT
  12. #define MAX_APPEND_INT 999 // maximum number to append to connectoid name // when cycling through names to create unique name
  13. // ############################################################################
  14. typedef DWORD (WINAPI* PFNRASENUMDEVICES)(LPRASDEVINFO lpRasDevInfo, LPDWORD lpcb, LPDWORD lpcDevices);
  15. typedef DWORD (WINAPI* PFNRASVALIDATEENTRYNAE)(LPCWSTR lpszPhonebook, LPCWSTR lpszEntry);
  16. typedef DWORD (WINAPI* PFNRASSETENTRYPROPERTIES)(LPCWSTR lpszPhonebook, LPCWSTR lpszEntry, LPBYTE lpbEntryInfo, DWORD dwEntryInfoSize, LPBYTE lpbDeviceInfo, DWORD dwDeviceInfoSize);
  17. typedef DWORD (WINAPI* PFNRASGETENTRYPROPERTIES)(LPCWSTR lpszPhonebook, LPCWSTR lpszEntry, LPBYTE lpbEntryInfo, LPDWORD lpdwEntryInfoSize, LPBYTE lpbDeviceInfo, LPDWORD lpdwDeviceInfoSize);
  18. typedef DWORD (WINAPI* PFNRASDELETEENTRY)(LPWSTR lpszPhonebook, LPWSTR lpszEntry);
  19. typedef DWORD (WINAPI* PFNRASHANGUP)(HRASCONN);
  20. typedef DWORD (WINAPI* PFNRASENUMCONNECTIONS)(LPRASCONN, LPDWORD, LPDWORD);
  21. typedef DWORD (WINAPI* PFNRASDIAL)(LPRASDIALEXTENSIONS, LPWSTR,LPRASDIALPARAMS,DWORD,LPVOID,LPHRASCONN);
  22. typedef DWORD (WINAPI* PFNRASGETENTRYDIALPARAMS)(LPCWSTR, LPRASDIALPARAMS,LPBOOL);
  23. typedef DWORD (WINAPI* PFNRASGETCONNECTSTATUS)(HRASCONN, LPRASCONNSTATUS);
  24. typedef DWORD (WINAPI* PFNRASGETCOUNTRYINFO)(LPRASCTRYINFO, LPDWORD);
  25. typedef DWORD (WINAPI* PFNRASSETENTRYDIALPARAMS)(LPCWSTR, LPRASDIALPARAMS,BOOL);
  26. //BOOL LclSetEntryScriptPatch(LPWSTR lpszScript, LPCWSTR lpszEntry);
  27. static const WCHAR szDefaultAreaCode[] = L"555";
  28. static const WCHAR cszDeviceSwitch[] = L"DEVICE=switch";
  29. static const WCHAR cszRasPBKFilename[] = L"\\ras\\rasphone.pbk";
  30. #define SCRIPT_PATCH_BUFFER_SIZE 2048
  31. #define SIZEOF_NULL 1
  32. static const WCHAR cszType[] = L"Type=";
  33. /*
  34. typedef struct tagINETCLIENTINFO
  35. {
  36. DWORD dwSize;
  37. DWORD dwFlags;
  38. WCHAR szEMailName[MAX_EMAIL_NAME + 1];
  39. WCHAR szEMailAddress[MAX_EMAIL_ADDRESS + 1];
  40. WCHAR szPOPLogonName[MAX_LOGON_NAME + 1];
  41. WCHAR szPOPLogonPassword[MAX_LOGON_PASSWORD + 1];
  42. WCHAR szPOPServer[MAX_SERVER_NAME + 1];
  43. WCHAR szSMTPServer[MAX_SERVER_NAME + 1];
  44. WCHAR szNNTPLogonName[MAX_LOGON_NAME + 1];
  45. WCHAR szNNTPLogonPassword[MAX_LOGON_PASSWORD + 1];
  46. WCHAR szNNTPServer[MAX_SERVER_NAME + 1];
  47. // end of version 1.0 structure;
  48. // extended 1.1 structure includes the following fields:
  49. WCHAR szNNTPName[MAX_EMAIL_NAME + 1];
  50. WCHAR szNNTPAddress[MAX_EMAIL_ADDRESS + 1];
  51. int iIncomingProtocol;
  52. WCHAR szIncomingMailLogonName[MAX_LOGON_NAME + 1];
  53. WCHAR szIncomingMailLogonPassword[MAX_LOGON_PASSWORD + 1];
  54. WCHAR szIncomingMailServer[MAX_SERVER_NAME + 1];
  55. BOOL fMailLogonSPA;
  56. BOOL fNewsLogonSPA;
  57. WCHAR szLDAPLogonName[MAX_LOGON_NAME + 1];
  58. WCHAR szLDAPLogonPassword[MAX_LOGON_PASSWORD + 1];
  59. WCHAR szLDAPServer[MAX_SERVER_NAME + 1];
  60. BOOL fLDAPLogonSPA;
  61. BOOL fLDAPResolve;
  62. } INETCLIENTINFO, *PINETCLIENTINFO, FAR *LPINETCLIENTINFO;
  63. */
  64. // ############################################################################
  65. class RNAAPI
  66. {
  67. public:
  68. RNAAPI();
  69. ~RNAAPI();
  70. DWORD RasEnumDevices(LPRASDEVINFO, LPDWORD, LPDWORD);
  71. DWORD RasValidateEntryName(LPCWSTR, LPCWSTR);
  72. DWORD RasSetEntryProperties(LPCWSTR lpszPhonebook, LPCWSTR lpszEntry,
  73. LPBYTE lpbEntryInfo, DWORD dwEntryInfoSize,
  74. LPBYTE lpbDeviceInfo, DWORD dwDeviceInfoSize);
  75. DWORD RasGetEntryProperties(LPCWSTR lpszPhonebook, LPCWSTR lpszEntry,
  76. LPBYTE lpbEntryInfo, LPDWORD lpdwEntryInfoSize,
  77. LPBYTE lpbDeviceInfo, LPDWORD lpdwDeviceInfoSize);
  78. DWORD RasDeleteEntry(LPWSTR lpszPhonebook, LPWSTR lpszEntry);
  79. DWORD RasHangUp(HRASCONN hrasconn);
  80. DWORD RasGetEntryDialParams(LPCWSTR lpszPhonebook, LPRASDIALPARAMS lprasdialparams,
  81. LPBOOL lpfPassword);
  82. DWORD RasDial(LPRASDIALEXTENSIONS lpRasDialExtensions, LPWSTR lpszPhonebook,
  83. LPRASDIALPARAMS lpRasDialParams, DWORD dwNotifierType,LPVOID lpvNotifier,
  84. LPHRASCONN lphRasConn);
  85. DWORD RasEnumConnections(LPRASCONN lprasconn, LPDWORD lpcb,LPDWORD lpcConnections);
  86. DWORD RasGetConnectStatus(HRASCONN, LPRASCONNSTATUS);
  87. DWORD RasGetCountryInfo(LPRASCTRYINFO, LPDWORD);
  88. DWORD RasSetEntryDialParams(LPCWSTR, LPRASDIALPARAMS,BOOL);
  89. HRESULT InetConfigClientEx(
  90. HWND hwndParent,
  91. LPCWSTR lpszPhonebook,
  92. LPCWSTR lpszEntryName,
  93. LPRASENTRY lpRasEntry,
  94. LPCWSTR lpszUsername,
  95. LPCWSTR lpszPassword,
  96. LPCWSTR lpszProfileName,
  97. INETCLIENTINFO* lpINetClientInfo,
  98. DWORD dwfOptions,
  99. LPBOOL lpfNeedsRestart,
  100. LPWSTR szConnectoidName,
  101. DWORD dwSizeOfCreatedEntryName,
  102. LPBYTE lpDeviceInfo = 0,
  103. LPDWORD lpdwDeviceInfoSize = 0);
  104. private:
  105. BOOL LoadApi(LPCSTR, FARPROC*);
  106. DWORD CreateConnectoid(LPCWSTR pszPhonebook, LPCWSTR pszConnectionName,
  107. LPRASENTRY lpRasEntry, LPCWSTR pszUserName, LPCWSTR pszPassword,
  108. LPBYTE lpDeviceInfo = 0, LPDWORD lpdwDeviceInfoSize = 0);
  109. DWORD SetConnectoidUsername(LPCWSTR pszPhonebook, LPCWSTR pszConnectoidName,
  110. LPCWSTR pszUserName, LPCWSTR pszPassword);
  111. //BOOL LclSetEntryScriptPatch(LPCWSTR lpszScript, LPCWSTR lpszEntry);
  112. DWORD MakeConnectoid(
  113. HWND hwndParent,
  114. DWORD dwfOptions,
  115. LPCWSTR lpszPhonebook,
  116. LPCWSTR lpszEntryName,
  117. LPRASENTRY lpRasEntry,
  118. LPCWSTR lpszUsername,
  119. LPCWSTR lpszPassword,
  120. LPBOOL lpfNeedsRestart,
  121. LPBYTE lpDeviceInfo = 0,
  122. LPDWORD lpdwDeviceInfoSize = 0);
  123. HINSTANCE m_hInst;
  124. HINSTANCE m_hInst2;
  125. PFNRASENUMDEVICES m_fnRasEnumDeviecs;
  126. PFNRASVALIDATEENTRYNAE m_fnRasValidateEntryName;
  127. PFNRASSETENTRYPROPERTIES m_fnRasSetEntryProperties;
  128. PFNRASGETENTRYPROPERTIES m_fnRasGetEntryProperties;
  129. PFNRASDELETEENTRY m_fnRasDeleteEntry;
  130. PFNRASHANGUP m_fnRasHangUp;
  131. PFNRASENUMCONNECTIONS m_fnRasEnumConnections;
  132. PFNRASDIAL m_fnRasDial;
  133. PFNRASGETENTRYDIALPARAMS m_fnRasGetEntryDialParams;
  134. PFNRASGETCONNECTSTATUS m_fnRasGetConnectStatus;
  135. PFNRASGETCOUNTRYINFO m_fnRasGetCountryInfo;
  136. PFNRASSETENTRYDIALPARAMS m_fnRasSetEntryDialParams;
  137. CEnumModem *m_pEnumModem;
  138. BOOL m_bUseAutoProxyforConnectoid;
  139. };
  140. #endif