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.

282 lines
6.0 KiB

  1. /*
  2. File utils.h
  3. Defines utility declarations that facilitate the implementation of the
  4. connections ras dialup server ui.
  5. Paul Mayfield, 9/29/97
  6. */
  7. #ifndef _rassrvui_utils_h
  8. #define _rassrvui_utils_h
  9. #include "rassrv.h"
  10. //
  11. // Global flags that tag the current state of this
  12. // machine
  13. //
  14. #define RASSRVUI_MACHINE_F_Initialized 0x1
  15. #define RASSRVUI_MACHINE_F_Server 0x2
  16. #define RASSRVUI_MACHINE_F_Member 0x4
  17. #define RASSRVUI_MACHINE_F_ShowIcon 0x8
  18. //
  19. // Defines the global variables data structure
  20. //
  21. typedef struct _RASSRVUI_GLOBALS
  22. {
  23. //
  24. // The following should only be accessed when the
  25. // csLock is held.
  26. //
  27. MPR_SERVER_HANDLE hRasServer;
  28. DWORD dwMachineFlags;
  29. //
  30. // The following do not need to be protected by the
  31. // csLock as they are initialized at process attach
  32. // and thereafter are only read.
  33. //
  34. HINSTANCE hInstDll;
  35. HANDLE hPrivateHeap;
  36. LPCTSTR atmRassrvPageData;
  37. LPCTSTR atmRassrvPageId;
  38. DWORD dwErrorData;
  39. //
  40. // Locks (some) global variables
  41. //
  42. CRITICAL_SECTION csLock;
  43. } RASSRVUI_GLOBALS;
  44. extern RASSRVUI_GLOBALS Globals;
  45. // ======================================
  46. // Methods to operate on global variables
  47. // ======================================
  48. #define GBL_LOCK EnterCriticalSection(&(Globals.csLock))
  49. #define GBL_UNLOCK LeaveCriticalSection(&(Globals.csLock))
  50. //
  51. // Initializes the global variables
  52. //
  53. DWORD
  54. gblInit(
  55. IN HINSTANCE hInstDll,
  56. OUT RASSRVUI_GLOBALS * Globs);
  57. //
  58. // Loads the machine flags
  59. //
  60. DWORD
  61. gblLoadMachineFlags(
  62. IN RASSRVUI_GLOBALS * Globs);
  63. //
  64. // Frees resources held by global variables
  65. //
  66. DWORD
  67. gblCleanup(
  68. IN RASSRVUI_GLOBALS * Globs);
  69. //
  70. // Establishes communication with the ras server if
  71. // not already established
  72. //
  73. DWORD
  74. gblConnectToRasServer();
  75. /* Enhanced list view callback to report drawing information. 'HwndLv' is
  76. ** the handle of the list view control. 'DwItem' is the index of the item
  77. ** being drawn.
  78. **
  79. ** Returns the address of standard draw information.
  80. */
  81. LVXDRAWINFO*
  82. LvDrawInfoCallback(
  83. IN HWND hwndLv,
  84. IN DWORD dwItem );
  85. // ============================================================
  86. // ============================================================
  87. // Special purpose ras server functions.
  88. // ============================================================
  89. // ============================================================
  90. //
  91. // Allocates and Zeros memory. Returns pointer to allocated memory
  92. // or NULL if ERROR_NOT_ENOUGH_MEMORY
  93. //
  94. PVOID
  95. RassrvAlloc (
  96. IN DWORD dwSize,
  97. IN BOOL bZero);
  98. VOID
  99. RassrvFree(
  100. IN PVOID pvBuf);
  101. //
  102. // Adds a new user to the system local user database.
  103. //
  104. DWORD
  105. RasSrvAddUser (
  106. IN PWCHAR pszUserLogonName,
  107. IN PWCHAR pszUserComment,
  108. IN PWCHAR pszUserPassword);
  109. //
  110. // Deletes a user from the system local user datbase
  111. //
  112. DWORD
  113. RasSrvDeleteUser(
  114. IN PWCHAR pszUserLogonName);
  115. //
  116. // Changes the full name and password of a user. If
  117. // either of pszFullName or pszPassword is null, it is
  118. // ignored.
  119. //
  120. DWORD
  121. RasSrvEditUser (
  122. IN PWCHAR pszLogonName,
  123. IN OPTIONAL PWCHAR pszFullName,
  124. IN OPTIONAL PWCHAR pszPassword);
  125. //
  126. // Warns the user that he/she is about to swith to mmc
  127. //
  128. BOOL
  129. RassrvWarnMMCSwitch(
  130. IN HWND hwndDlg);
  131. //
  132. // Launches the given console in MMC
  133. //
  134. DWORD
  135. RassrvLaunchMMC(
  136. IN DWORD dwConsoleId);
  137. //
  138. // Returns RASSRVUI_MACHINE_F_* values for the current machine
  139. //
  140. DWORD
  141. RasSrvGetMachineFlags(
  142. OUT LPDWORD lpdwFlags);
  143. //
  144. // Manipulate the enabling/disabling of multilink
  145. //
  146. DWORD
  147. RasSrvGetMultilink(
  148. OUT BOOL * bEnabled);
  149. DWORD
  150. RasSrvSetMultilink(
  151. IN BOOL bEnable);
  152. //
  153. // Manipulate the showing of ras server icons in the task bar
  154. //
  155. DWORD
  156. RasSrvGetIconShow(
  157. OUT BOOL * pbEnabled);
  158. DWORD
  159. RasSrvSetIconShow(
  160. IN BOOL bEnable);
  161. //
  162. // Set the logging level
  163. //
  164. DWORD
  165. RasSrvSetLogLevel(
  166. IN DWORD dwLevel);
  167. //
  168. // Manipulate the forcing of data and password encryption'
  169. //
  170. DWORD
  171. RasSrvGetEncryption(
  172. OUT BOOL * pbEncrypted);
  173. DWORD
  174. RasSrvSetEncryption(
  175. IN BOOL bEncrypted);
  176. // Displays context sensitive help
  177. DWORD
  178. RasSrvHelp(
  179. IN HWND hwndDlg, // Dialog needing help
  180. IN UINT uMsg, // Help message
  181. IN WPARAM wParam, // parameter
  182. IN LPARAM lParam, // parameter
  183. IN const DWORD* pdwMap); // map control id to help id
  184. //
  185. // Registry helper functions. All string buffers must be
  186. // at least 256 chars long.
  187. //
  188. DWORD
  189. RassrvRegGetDw(
  190. DWORD * pdwVal,
  191. DWORD dwDefault,
  192. const PWCHAR pszKeyName,
  193. const PWCHAR pszValueName);
  194. DWORD
  195. RassrvRegSetDw(
  196. DWORD dwVal,
  197. const PWCHAR pszKeyName,
  198. const PWCHAR pszValueName);
  199. DWORD
  200. RassrvRegGetDwEx(
  201. DWORD * pdwVal,
  202. DWORD dwDefault,
  203. const PWCHAR pszKeyName,
  204. const PWCHAR pszValueName,
  205. IN BOOL bCreate);
  206. DWORD
  207. RassrvRegSetDwEx(
  208. IN DWORD dwFlag,
  209. IN CONST PWCHAR pszKeyName,
  210. IN CONST PWCHAR pszValueName,
  211. IN BOOL bCreate);
  212. DWORD
  213. RassrvRegGetStr(
  214. PWCHAR pszBuf,
  215. PWCHAR pszDefault,
  216. const PWCHAR pszKeyName,
  217. const PWCHAR pszValueName);
  218. DWORD
  219. RassrvRegSetStr(
  220. PWCHAR pszStr,
  221. const PWCHAR pszKeyName,
  222. const PWCHAR pszValueName);
  223. // Api shows whatever ui is neccessary to inform the user that
  224. // he/she should wait while services are started.
  225. DWORD
  226. RasSrvShowServiceWait(
  227. IN HINSTANCE hInst,
  228. IN HWND hwndParent,
  229. OUT HANDLE * phData);
  230. DWORD
  231. RasSrvFinishServiceWait (
  232. IN HANDLE hData);
  233. // Pops up a warning with the given parent window and reboots
  234. // windows
  235. DWORD
  236. RasSrvReboot(
  237. IN HWND hwndParent);
  238. #endif