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.

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