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.

388 lines
9.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (c) Microsoft Corporation. All rights reserved.
  5. //
  6. // File: R A S U I P . H
  7. //
  8. // Contents: Private RAS APIs used by the NT5 Connections UI. These
  9. // APIs are exported by rasdlg.dll.
  10. //
  11. // Notes:
  12. //
  13. // Author: shaunco 10 Nov 1997
  14. //
  15. //----------------------------------------------------------------------------
  16. #ifndef _RASUIP_
  17. #define _RASUIP_
  18. #if defined (_MSC_VER)
  19. #if ( _MSC_VER >= 1200 )
  20. #pragma warning(push)
  21. #endif
  22. #if ( _MSC_VER >= 800 )
  23. #pragma warning(disable:4001)
  24. #pragma warning(disable:4201)
  25. #pragma warning(disable:4214)
  26. #pragma warning(disable:4514)
  27. #endif
  28. #if (_MSC_VER >= 1020)
  29. #pragma once
  30. #endif
  31. #endif
  32. #include <prsht.h>
  33. #include <ras.h>
  34. #include <hnetcfg.h>
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. //+---------------------------------------------------------------------------
  39. // RASENTRYDLG.reserved2 argument block valid when RASENTRYDLG.dwFlags
  40. // RASEDFLAG_ShellOwned is set.
  41. //
  42. typedef struct
  43. _RASEDSHELLOWNEDR2
  44. {
  45. // Add page routine to be called by RasEntryDlg before returning.
  46. // Callback returns context 'lparam'.
  47. //
  48. LPFNADDPROPSHEETPAGE pfnAddPage;
  49. LPARAM lparam;
  50. // When RASEDFLAG_NewEntry and RASEDFLAG_ShellOwned are set,
  51. // pvWizardCtx is filled in by RasEntryDlg so that the shell has
  52. // context information with which to pass to the NccXXX APIs below.
  53. //
  54. LPVOID pvWizardCtx;
  55. }
  56. RASEDSHELLOWNEDR2;
  57. //+---------------------------------------------------------------------------
  58. // RAS Connection wizard APIs
  59. //
  60. // Flags returned from RasWizCreateNewEntry
  61. //
  62. #define NCC_FLAG_ALL_USERS 0x1 // Create connection for all users
  63. #define NCC_FLAG_CREATE_INCOMING 0x2 // Create incoming connection instead
  64. #define NCC_FLAG_SHARED 0x4
  65. #define NCC_FLAG_FIREWALL 0x8 // If turn on Firewall
  66. #define NCC_FLAG_GLOBALCREDS 0x10 // If the credentials is for all users
  67. #define NCC_FLAG_DEFAULT_INTERNET 0x20 // If this is a default internet connection
  68. // Types of connections to be used in calls to RasWizXXX
  69. #define RASWIZ_TYPE_DIALUP 0x1
  70. #define RASWIZ_TYPE_DIRECT 0x2
  71. #define RASWIZ_TYPE_INCOMING 0x3
  72. #define RASWIZ_TYPE_BROADBAND 0x4
  73. DWORD
  74. APIENTRY
  75. RasWizCreateNewEntry(
  76. IN DWORD dwRasWizType,
  77. IN LPVOID pvData,
  78. OUT LPWSTR pszwPbkFile,
  79. OUT LPWSTR pszwEntryName,
  80. OUT DWORD* pdwFlags);
  81. DWORD
  82. APIENTRY
  83. RasWizGetNCCFlags(
  84. IN DWORD dwRasWizType,
  85. IN LPVOID pvData,
  86. OUT DWORD * pdwFlags);
  87. DWORD
  88. APIENTRY
  89. RasWizGetUserInputConnectionName (
  90. IN LPVOID pvData,
  91. OUT LPWSTR pszwInputName);
  92. DWORD
  93. APIENTRY
  94. RasWizGetSuggestedEntryName(
  95. IN DWORD dwRasWizType,
  96. IN LPVOID pvData,
  97. OUT LPWSTR pszwSuggestedName);
  98. DWORD
  99. APIENTRY
  100. RasWizQueryMaxPageCount(
  101. IN DWORD dwRasWizType);
  102. DWORD
  103. APIENTRY
  104. RasWizSetEntryName(
  105. IN DWORD dwRasWizType,
  106. IN LPVOID pvData,
  107. IN LPCWSTR pszwName);
  108. DWORD
  109. APIENTRY
  110. RasWizIsEntryRenamable(
  111. IN DWORD dwRasWizType,
  112. IN LPVOID pvData,
  113. OUT BOOL* pfRenamable);
  114. //+---------------------------------------------------------------------------
  115. // Inbound connection APIs
  116. //
  117. typedef HANDLE HRASSRVCONN;
  118. #define RASSRV_MaxName 256
  119. // Types of ras server connections (RASSRVCONN.dwType values)
  120. //
  121. #define RASSRVUI_MODEM 0
  122. #define RASSRVUI_VPN 1
  123. #define RASSRVUI_DCC 2
  124. // Defines a structure that identifies a client connection
  125. //
  126. typedef struct _RASSRVCONN
  127. {
  128. DWORD dwSize; // Size of the structure (used for versioning)
  129. HRASSRVCONN hRasSrvConn; // Handle of the connection
  130. DWORD dwType;
  131. WCHAR szEntryName [RASSRV_MaxName + 1];
  132. WCHAR szDeviceName [RASSRV_MaxName + 1];
  133. GUID Guid;
  134. } RASSRVCONN, *LPRASSRVCONN;
  135. // Starts the remote access service and marks it as autostart.
  136. // If the remoteaccess service is not installed, this function
  137. // returns an error.
  138. DWORD
  139. APIENTRY
  140. RasSrvInitializeService (
  141. VOID);
  142. // Stops the remote access service and marks it as disabled.
  143. DWORD
  144. APIENTRY
  145. RasSrvCleanupService (
  146. VOID);
  147. DWORD
  148. APIENTRY
  149. RasSrvIsServiceRunning (
  150. OUT BOOL* pfIsRunning);
  151. //
  152. // Returns whether is it ok to display the "Incoming Connections"
  153. // connection.
  154. //
  155. DWORD
  156. APIENTRY
  157. RasSrvAllowConnectionsConfig (
  158. OUT BOOL* pfAllow);
  159. DWORD
  160. APIENTRY
  161. RasSrvAddPropPages (
  162. IN HRASSRVCONN hRasSrvConn,
  163. IN HWND hwndParent,
  164. IN LPFNADDPROPSHEETPAGE pfnAddPage,
  165. IN LPARAM lParam,
  166. IN OUT PVOID * ppvContext);
  167. DWORD
  168. APIENTRY
  169. RasSrvAddWizPages (
  170. IN LPFNADDPROPSHEETPAGE pfnAddPage,
  171. IN LPARAM lParam,
  172. IN OUT PVOID * ppvContext); // context should be passed in as pvData
  173. // subsequent calls to RasWizXXX
  174. // Function behaves anagolously to the WIN32 function RasEnumConnections but
  175. // for client connections instead of dialout connections.
  176. DWORD
  177. APIENTRY
  178. RasSrvEnumConnections (
  179. IN OUT LPRASSRVCONN pRasSrvConn, // Buffer of array of connections.
  180. IN LPDWORD pcb, // size in bytes of buffer
  181. OUT LPDWORD pcConnections); // number of connections written to buffer
  182. // Gets the status of a Ras Server Connection
  183. DWORD
  184. APIENTRY
  185. RasSrvIsConnectionConnected (
  186. IN HRASSRVCONN hRasSrvConn, // The connection in question
  187. OUT BOOL* pfConnected); // Buffer to hold the type
  188. // Hang up the given connection
  189. DWORD
  190. APIENTRY
  191. RasSrvHangupConnection (
  192. IN HRASSRVCONN hRasSrvConn); // The connection in question
  193. // Has "show icons in taskbar" been checked?
  194. DWORD
  195. APIENTRY
  196. RasSrvQueryShowIcon (
  197. OUT BOOL* pfShowIcon);
  198. // Allows the editing of ras user preferences
  199. DWORD
  200. APIENTRY
  201. RasUserPrefsDlg (
  202. HWND hwndParent);
  203. // Enables or disables having the user manually dial
  204. // his/her remote access server.
  205. DWORD
  206. APIENTRY
  207. RasUserEnableManualDial (
  208. IN HWND hwndParent, // parent for error dialogs
  209. IN BOOL bLogon, // whether a user is logged in
  210. IN BOOL bEnable ); // whether to enable or not
  211. DWORD
  212. APIENTRY
  213. RasUserGetManualDial (
  214. IN HWND hwndParent, // parent for error dialogs
  215. IN BOOL bLogon, // whether a user is logged in
  216. IN PBOOL pbEnabled ); // whether to enable or not
  217. //+---------------------------------------------------------------------------
  218. // Connection sharing API routines
  219. //
  220. // Defines the structure used to store information about the shared connection.
  221. // This structure is stored as binary data in the registry, and any changes
  222. // to it must be made with this in mind.
  223. //
  224. #include <packon.h>
  225. typedef struct _RASSHARECONN
  226. {
  227. DWORD dwSize;
  228. BOOL fIsLanConnection;
  229. union {
  230. GUID guid;
  231. RASENTRYNAMEW name;
  232. };
  233. } RASSHARECONN, *LPRASSHARECONN;
  234. #include <packoff.h>
  235. // Flag set by 'RasQueryLanConnTable' for private LAN connections
  236. //
  237. #define NCCF_PRIVATE_LAN 0x1000
  238. // Name of secure event object shared with rasauto service.
  239. //
  240. #define RAS_AUTO_DIAL_SHARED_CONNECTION_EVENT \
  241. "RasAutoDialSharedConnectionEvent"
  242. // VOID
  243. // RasEntryToSharedConnection(
  244. // IN LPCWSTR pszPhonebookPath,
  245. // IN LPCWSTR pszEntryName,
  246. // OUT LPRASSHARECONN pConn );
  247. //
  248. // Macro for conversion of phonebook/entry to 'RASSHARECONN'.
  249. //
  250. #define RasEntryToSharedConnection( _pszPhonebookPath, _pszEntryName, _pConn ) \
  251. ( \
  252. ZeroMemory((_pConn), sizeof(RASSHARECONN)), \
  253. (_pConn)->dwSize = sizeof(RASSHARECONN), \
  254. (_pConn)->fIsLanConnection = FALSE, \
  255. (_pConn)->name.dwSize = sizeof((_pConn)->name), \
  256. (_pConn)->name.dwFlags = REN_AllUsers, \
  257. lstrcpynW((_pConn)->name.szPhonebookPath, _pszPhonebookPath, MAX_PATH), \
  258. lstrcpynW((_pConn)->name.szEntryName, _pszEntryName, RAS_MaxEntryName) \
  259. )
  260. // VOID
  261. // RasGuidToSharedConnection(
  262. // IN REFGUID guid,
  263. // OUT LPRASSHARECONN pConn );
  264. //
  265. // Macro for conversion of LAN GUID to 'RASSHARECONN'
  266. //
  267. #define RasGuidToSharedConnection( _guid, _pConn ) \
  268. ( \
  269. ZeroMemory((_pConn), sizeof(RASSHARECONN)), \
  270. (_pConn)->dwSize = sizeof(RASSHARECONN), \
  271. (_pConn)->fIsLanConnection = TRUE, \
  272. CopyMemory(&(_pConn)->guid, (_guid), sizeof(GUID)) \
  273. )
  274. // VOID
  275. // RasIsEqualSharedConnection(
  276. // IN LPRASSHARECONN pConn1,
  277. // IN LPRASSHARECONN pConn2 );
  278. //
  279. // Macro for comparison of 'RASSHARECONN' values
  280. //
  281. #define RasIsEqualSharedConnection( _pConn1, _pConn2 ) \
  282. ( \
  283. ((_pConn1)->fIsLanConnection == (_pConn2)->fIsLanConnection) && \
  284. ((_pConn1)->fIsLanConnection \
  285. ? !memcmp(&(_pConn1)->guid, &(_pConn2)->guid, sizeof(GUID)) \
  286. : (!lstrcmpiW( \
  287. (_pConn1)->name.szPhonebookPath, \
  288. (_pConn2)->name.szPhonebookPath) && \
  289. !lstrcmpiW( \
  290. (_pConn1)->name.szEntryName, \
  291. (_pConn2)->name.szEntryName))) \
  292. )
  293. DWORD
  294. APIENTRY
  295. RasAutoDialSharedConnection( VOID );
  296. DWORD
  297. APIENTRY
  298. RasIsSharedConnection(
  299. IN LPRASSHARECONN pConn,
  300. OUT PBOOL pfShared );
  301. DWORD
  302. APIENTRY
  303. RasQuerySharedAutoDial(
  304. IN PBOOL pfEnabled );
  305. DWORD
  306. APIENTRY
  307. RasQuerySharedConnection(
  308. OUT LPRASSHARECONN pConn );
  309. DWORD
  310. APIENTRY
  311. RasSetSharedAutoDial(
  312. IN BOOL fEnable );
  313. //+---------------------------------------------------------------------------
  314. // Internal RAS APIs
  315. //
  316. DWORD
  317. APIENTRY
  318. DwRasUninitialize();
  319. #ifdef __cplusplus
  320. } // extern "C"
  321. #endif
  322. #if defined (_MSC_VER)
  323. #if ( _MSC_VER >= 1200 )
  324. #pragma warning(pop)
  325. #elif ( _MSC_VER >= 800 )
  326. #pragma warning(default:4001)
  327. #pragma warning(default:4201)
  328. #pragma warning(default:4214)
  329. #pragma warning(default:4514)
  330. #endif
  331. #endif
  332. #endif // _RASUIP_