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.

308 lines
8.4 KiB

  1. #ifndef _RASHELP_H_
  2. #define _RASHELP_H_
  3. #include <regstr.h>
  4. #include <inetreg.h>
  5. #include <windowsx.h>
  6. #include <rasdlg.h>
  7. typedef enum
  8. {
  9. ENUM_NONE,
  10. ENUM_MULTIBYTE, // Win9x
  11. ENUM_UNICODE, // NT4
  12. ENUM_WIN2K // Win2K
  13. } ENUM_TYPE;
  14. /////////////////////////////////////////////////////////////////////////////////////
  15. class GetOSVersion
  16. {
  17. protected:
  18. static ENUM_TYPE _EnumType;
  19. public:
  20. GetOSVersion();
  21. ~GetOSVersion();
  22. };
  23. /////////////////////////////////////////////////////////////////////////////////////
  24. class RasEnumHelp : public GetOSVersion
  25. {
  26. private:
  27. //
  28. // Win2k version of RASENTRYNAMEW struct
  29. //
  30. // match RAS packing so structs match
  31. #include <pshpack4.h>
  32. #define W2KRASENTRYNAMEW struct tagW2KRASENTRYNAMEW
  33. W2KRASENTRYNAMEW
  34. {
  35. DWORD dwSize;
  36. WCHAR szEntryName[ RAS_MaxEntryName + 1 ];
  37. DWORD dwFlags;
  38. WCHAR szPhonebookPath[MAX_PATH + 1];
  39. };
  40. #define LPW2KRASENTRYNAMEW W2KRASENTRYNAMEW*
  41. #include <poppack.h>
  42. //
  43. // Any error we got during enumeration
  44. //
  45. DWORD _dwLastError;
  46. //
  47. // Number of entries we got
  48. //
  49. DWORD _dwEntries;
  50. //
  51. // Pointer to info retrieved from RAS
  52. //
  53. RASENTRYNAMEA * _preList;
  54. //
  55. // Last entry returned as multibyte or unicode when conversion required
  56. //
  57. CHAR _szCurrentEntryA[RAS_MaxEntryName + 1];
  58. WCHAR _szCurrentEntryW[RAS_MaxEntryName + 1];
  59. public:
  60. RasEnumHelp();
  61. ~RasEnumHelp();
  62. DWORD GetError();
  63. DWORD GetEntryCount();
  64. LPSTR GetEntryA(DWORD dwEntry);
  65. LPWSTR GetEntryW(DWORD dwEntry);
  66. };
  67. /////////////////////////////////////////////////////////////////////////////////////
  68. class RasEnumConnHelp : public GetOSVersion
  69. {
  70. private:
  71. // match RAS packing so structs match
  72. #include <pshpack4.h>
  73. #define W2KRASCONNW struct tagW2KRASCONNW
  74. W2KRASCONNW
  75. {
  76. DWORD dwSize;
  77. HRASCONN hrasconn;
  78. WCHAR szEntryName[ RAS_MaxEntryName + 1 ];
  79. //#if (WINVER >= 0x400)
  80. WCHAR szDeviceType[ RAS_MaxDeviceType + 1 ];
  81. WCHAR szDeviceName[ RAS_MaxDeviceName + 1 ];
  82. //#endif
  83. //#if (WINVER >= 0x401)
  84. WCHAR szPhonebook [ MAX_PATH ];
  85. DWORD dwSubEntry;
  86. //#endif
  87. //#if (WINVER >= 0x500)
  88. GUID guidEntry;
  89. //#endif
  90. };
  91. #define LPW2KRASCONNW W2KRASCONNW*
  92. #include <poppack.h>
  93. DWORD _dwLastError; // Any error we got during enumeration
  94. DWORD _dwConnections; // Number of connections
  95. DWORD _dwStructSize;
  96. RASCONNA *_pRasCon;
  97. // Last entry returned as multibyte or unicode when conversion required
  98. WCHAR _szEntryNameW[ RAS_MaxEntryName + 1 ];
  99. // WCHAR _szDeviceTypeW[ RAS_MaxDeviceType + 1 ];
  100. // WCHAR _szDeviceNameW[ RAS_MaxDeviceName + 1 ];
  101. // WCHAR _szPhonebookW[ MAX_PATH ];
  102. CHAR _szEntryNameA[ RAS_MaxEntryName + 1 ];
  103. // CHAR _szDeviceTypeA[ RAS_MaxDeviceType + 1 ];
  104. // CHAR _szDeviceNameA[ RAS_MaxDeviceName + 1 ];
  105. // CHAR _szPhonebookA[ MAX_PATH ];
  106. public:
  107. RasEnumConnHelp();
  108. ~RasEnumConnHelp();
  109. DWORD Enum();
  110. DWORD GetError();
  111. DWORD GetConnectionsCount();
  112. LPWSTR GetEntryW(DWORD dwConnectionNum);
  113. LPSTR GetEntryA(DWORD dwConnectionNum);
  114. LPWSTR GetLastEntryW(DWORD dwConnectionNum);
  115. LPSTR GetLastEntryA(DWORD dwConnectionNum);
  116. HRASCONN GetHandle(DWORD dwConnectionNum);
  117. };
  118. /////////////////////////////////////////////////////////////////////////////////////
  119. class RasEntryPropHelp : public GetOSVersion
  120. {
  121. private:
  122. // match RAS packing so structs match
  123. #include <pshpack4.h>
  124. #define W2KRASENTRYW struct tagW2KRASENTRYW
  125. W2KRASENTRYW
  126. {
  127. DWORD dwSize;
  128. DWORD dwfOptions;
  129. //
  130. // Location/phone number
  131. //
  132. DWORD dwCountryID;
  133. DWORD dwCountryCode;
  134. WCHAR szAreaCode[ RAS_MaxAreaCode + 1 ];
  135. WCHAR szLocalPhoneNumber[ RAS_MaxPhoneNumber + 1 ];
  136. DWORD dwAlternateOffset;
  137. //
  138. // PPP/Ip
  139. //
  140. RASIPADDR ipaddr;
  141. RASIPADDR ipaddrDns;
  142. RASIPADDR ipaddrDnsAlt;
  143. RASIPADDR ipaddrWins;
  144. RASIPADDR ipaddrWinsAlt;
  145. //
  146. // Framing
  147. //
  148. DWORD dwFrameSize;
  149. DWORD dwfNetProtocols;
  150. DWORD dwFramingProtocol;
  151. //
  152. // Scripting
  153. //
  154. WCHAR szScript[ MAX_PATH ];
  155. //
  156. // AutoDial
  157. //
  158. WCHAR szAutodialDll[ MAX_PATH ];
  159. WCHAR szAutodialFunc[ MAX_PATH ];
  160. //
  161. // Device
  162. //
  163. WCHAR szDeviceType[ RAS_MaxDeviceType + 1 ];
  164. WCHAR szDeviceName[ RAS_MaxDeviceName + 1 ];
  165. //
  166. // X.25
  167. //
  168. WCHAR szX25PadType[ RAS_MaxPadType + 1 ];
  169. WCHAR szX25Address[ RAS_MaxX25Address + 1 ];
  170. WCHAR szX25Facilities[ RAS_MaxFacilities + 1 ];
  171. WCHAR szX25UserData[ RAS_MaxUserData + 1 ];
  172. DWORD dwChannels;
  173. //
  174. // Reserved
  175. //
  176. DWORD dwReserved1;
  177. DWORD dwReserved2;
  178. //#if (WINVER >= 0x401)
  179. //
  180. // Multilink
  181. //
  182. DWORD dwSubEntries;
  183. DWORD dwDialMode;
  184. DWORD dwDialExtraPercent;
  185. DWORD dwDialExtraSampleSeconds;
  186. DWORD dwHangUpExtraPercent;
  187. DWORD dwHangUpExtraSampleSeconds;
  188. //
  189. // Idle timeout
  190. //
  191. DWORD dwIdleDisconnectSeconds;
  192. //#endif
  193. //#if (WINVER >= 0x500)
  194. //
  195. // Entry Type
  196. //
  197. DWORD dwType;
  198. //
  199. // EncryptionType
  200. //
  201. DWORD dwEncryptionType;
  202. //
  203. // CustomAuthKey to be used for EAP
  204. //
  205. DWORD dwCustomAuthKey;
  206. //
  207. // Guid of the connection
  208. //
  209. GUID guidId;
  210. //
  211. // Custom Dial Dll
  212. //
  213. WCHAR szCustomDialDll[MAX_PATH];
  214. //
  215. // Vpn Strategy
  216. //
  217. DWORD dwVpnStrategy;
  218. //#endif
  219. };
  220. #define LPW2KRASENTRYW W2KRASENTRYW*
  221. #include <poppack.h>
  222. DWORD _dwStructSize;
  223. DWORD _dwLastError; // Any error we got during enumeration
  224. RASENTRYA *_pRasEntry;
  225. // Last entry returned as multibyte or unicode when conversion required
  226. WCHAR _szEntryNameW[ RAS_MaxEntryName + 1 ];
  227. WCHAR _szDeviceTypeW[ RAS_MaxDeviceType + 1 ];
  228. WCHAR _szAutodialDllW[ MAX_PATH ];
  229. WCHAR _szAutodialFuncW[ MAX_PATH ];
  230. WCHAR _szCustomDialDllW[ MAX_PATH ];
  231. WCHAR _szPhoneNumberW[ RAS_MaxPhoneNumber + 1 ];
  232. WCHAR _szAreaCodeW[ RAS_MaxAreaCode + 1 ];
  233. CHAR _szEntryNameA[ RAS_MaxEntryName + 1 ];
  234. CHAR _szDeviceTypeA[ RAS_MaxDeviceType + 1 ];
  235. CHAR _szAutodialDllA[ MAX_PATH ];
  236. CHAR _szAutodialFuncA[ MAX_PATH ];
  237. public:
  238. RasEntryPropHelp();
  239. ~RasEntryPropHelp();
  240. DWORD GetError();
  241. DWORD GetA(LPSTR lpszEntryName);
  242. DWORD GetW(LPWSTR lpszEntryName);
  243. LPWSTR GetDeviceTypeW(VOID);
  244. LPSTR GetDeviceTypeA(VOID);
  245. LPWSTR GetAutodiallDllW();
  246. LPSTR GetAutodiallDllA();
  247. LPWSTR GetAutodialFuncW();
  248. LPSTR GetAutodialFuncA();
  249. LPWSTR GetCustomDialDllW();
  250. LPWSTR GetPhoneNumberW();
  251. DWORD GetCountryCode();
  252. DWORD GetOptions();
  253. LPWSTR GetAreaCodeW();
  254. };
  255. /////////////////////////////////////////////////////////////////////////////////////
  256. class RasGetConnectStatusHelp : public GetOSVersion
  257. {
  258. private:
  259. DWORD _dwLastError; // Any error we got during enumeration
  260. DWORD _dwStructSize;
  261. RASCONNSTATUSA *_pRasConnStatus;
  262. public:
  263. RasGetConnectStatusHelp(HRASCONN hrasconn);
  264. ~RasGetConnectStatusHelp();
  265. DWORD GetError();
  266. RASCONNSTATE ConnState();
  267. };
  268. /////////////////////////////////////////////////////////////////////////////////////
  269. #endif // _RASHELP_H_