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.

532 lines
8.8 KiB

  1. /* Copyright (c) 1995, Microsoft Corporation, all rights reserved
  2. **
  3. ** nouiutil.h
  4. ** No UI helper routines (no HWNDs required)
  5. ** Public header
  6. **
  7. ** 08/25/95 Steve Cobb
  8. */
  9. #pragma once
  10. #ifndef _NOUIUTIL_H_
  11. #define _NOUIUTIL_H_
  12. /* Maximum length of string returned by LToT without terminating null.
  13. */
  14. #define MAXLTOTLEN 11
  15. /* Heap allocation macros allowing easy substitution of alternate heap. These
  16. ** are used by the other utility sections.
  17. */
  18. #ifndef EXCL_HEAPDEFS
  19. #define Malloc(c) (void*)GlobalAlloc(0,(c))
  20. #define Realloc(p,c) (void*)GlobalReAlloc((p),(c),GMEM_MOVEABLE)
  21. #define Free(p) (void*)GlobalFree(p)
  22. #endif
  23. /* Bits returned by GetInstalledProtocols.
  24. */
  25. #define NP_Nbf 0x1
  26. #define NP_Ipx 0x2
  27. #define NP_Ip 0x4
  28. #define NP_Netmon 0x8
  29. /* Definition of comparison function required by ShellSort and
  30. ** ShellSortIndirect.
  31. ** The comparison is essentially <arg1> - <arg2>, thus the function should
  32. ** return negative if the first item is less than the second, zero
  33. ** if the items are equal, and positive if the first item is greater
  34. ** than the second.
  35. */
  36. typedef INT (*PFNCOMPARE)( VOID*, VOID* );
  37. /* Linked list library.
  38. */
  39. #ifndef EXCL_DTL_H
  40. #include <dtl.h>
  41. #endif
  42. /* International formatting library.
  43. */
  44. #ifndef EXCL_INTL_H
  45. #include <intl.h>
  46. #endif
  47. /* User preference library.
  48. */
  49. #ifndef EXCL_PBUSER_H
  50. #include <pbuser.h>
  51. #endif
  52. /* RasApi utility library.
  53. */
  54. #ifndef EXCL_RAUTIL_H
  55. #include <rautil.h>
  56. #endif
  57. /* RasMan utility library.
  58. */
  59. #ifndef EXCL_RMUTIL_H
  60. #include <rmutil.h>
  61. #endif
  62. /* RAS DLL entrypoint loader library.
  63. */
  64. #ifndef EXCL_LOADDLLS_H
  65. #include <loaddlls.h>
  66. #endif
  67. /* EAP configuration utility library.
  68. */
  69. #ifndef EXCL_EAPCFG_H
  70. #include <eapcfg.h>
  71. #endif
  72. /* Node types used by MultiSz calls.
  73. */
  74. #define NT_Psz 1
  75. #define NT_Kv 2
  76. //
  77. // Defs to determine which entrypoint to load
  78. //
  79. #define CUSTOM_RASDIALDLG 0
  80. #define CUSTOM_RASENTRYDLG 1
  81. #define CUSTOM_RASDIAL 2
  82. #define CUSTOM_RASDELETEENTRYNOTIFY 3
  83. /*----------------------------------------------------------------------------
  84. ** Datatypes
  85. **----------------------------------------------------------------------------
  86. */
  87. /* Key/Value string pair. The contents of a Kv node.
  88. */
  89. #define KEYVALUE struct tagKEYVALUE
  90. KEYVALUE
  91. {
  92. TCHAR* pszKey;
  93. TCHAR* pszValue;
  94. };
  95. /* RAS-relevant Unimodem settings.
  96. */
  97. #define UNIMODEMINFO struct tagUNIMODEMINFO
  98. UNIMODEMINFO
  99. {
  100. BOOL fHwFlow;
  101. BOOL fEc;
  102. BOOL fEcc;
  103. DWORD dwBps;
  104. BOOL fSpeaker;
  105. BOOL fOperatorDial;
  106. BOOL fUnimodemPreTerminal;
  107. DWORD dwModemProtocol; // selected modem protocol
  108. DTLLIST *pListProtocols; // list of available protocols
  109. };
  110. /*----------------------------------------------------------------------------
  111. ** Prototypes
  112. **----------------------------------------------------------------------------
  113. */
  114. INT
  115. ComparePszNode(
  116. IN DTLNODE* pNode1,
  117. IN DTLNODE* pNode2 );
  118. DWORD
  119. CreateDirectoriesOnPath(
  120. LPTSTR pszPath,
  121. LPSECURITY_ATTRIBUTES psa);
  122. DTLNODE*
  123. CreateKvNode(
  124. IN LPCTSTR pszKey,
  125. IN LPCTSTR pszValue );
  126. DTLNODE*
  127. CreatePszNode(
  128. IN LPCTSTR psz );
  129. VOID
  130. DestroyKvNode(
  131. IN DTLNODE* pdtlnode );
  132. VOID
  133. DestroyPszNode(
  134. IN DTLNODE* pdtlnode );
  135. BOOL
  136. DeviceAndPortFromPsz(
  137. IN TCHAR* pszDP,
  138. OUT TCHAR** ppszDevice,
  139. OUT TCHAR** ppszPort );
  140. DTLNODE*
  141. DuplicateKvNode(
  142. IN DTLNODE* pdtlnode );
  143. DTLNODE*
  144. DuplicatePszNode(
  145. IN DTLNODE* pdtlnode );
  146. BOOL
  147. FFileExists(
  148. IN TCHAR* pszPath );
  149. BOOL
  150. FIsTcpipInstalled();
  151. BOOL
  152. FIsUserAdminOrPowerUser();
  153. VOID*
  154. Free0(
  155. VOID* p );
  156. //for utilsys.c
  157. TCHAR*
  158. GetComputer(
  159. void );
  160. TCHAR*
  161. GetLogonDomain(
  162. void );
  163. TCHAR*
  164. GetLogonUser(
  165. void );
  166. // For whistler 480871 gangz
  167. //
  168. DWORD
  169. RasSrvIsRRASConfigured(
  170. OUT BOOL * pfConfig);
  171. BOOL
  172. IsFirewallAvailablePlatform(
  173. void);
  174. BOOL
  175. IsAdvancedServerPlatform(
  176. void);
  177. BOOL
  178. IsPersonalPlatform(
  179. void);
  180. BOOL
  181. IsStandaloneWKS(
  182. void);
  183. BOOL
  184. IsConsumerPlatform(
  185. void);
  186. //end of definitions for utilsys.c
  187. DWORD
  188. GetInstalledProtocols(
  189. VOID );
  190. DWORD
  191. GetInstalledProtocolsEx(
  192. HANDLE hConnection,
  193. BOOL fRouter,
  194. BOOL fRasCli,
  195. BOOL fRasSrv );
  196. VOID
  197. GetRegBinary(
  198. IN HKEY hkey,
  199. IN TCHAR* pszName,
  200. OUT BYTE** ppbResult,
  201. OUT DWORD* pcbResult );
  202. VOID
  203. GetRegDword(
  204. IN HKEY hkey,
  205. IN TCHAR* pszName,
  206. OUT DWORD* pdwResult );
  207. DWORD
  208. GetRegExpandSz(
  209. IN HKEY hkey,
  210. IN TCHAR* pszName,
  211. OUT TCHAR** ppszResult );
  212. DWORD
  213. GetRegMultiSz(
  214. IN HKEY hkey,
  215. IN TCHAR* pszName,
  216. IN OUT DTLLIST** ppListResult,
  217. IN DWORD dwNodeType );
  218. DWORD
  219. GetRegSz(
  220. IN HKEY hkey,
  221. IN TCHAR* pszName,
  222. OUT TCHAR** ppszResult );
  223. DWORD
  224. GetRegSzz(
  225. IN HKEY hkey,
  226. IN TCHAR* pszName,
  227. OUT TCHAR** ppszResult );
  228. CHAR
  229. HexChar(
  230. IN BYTE byte );
  231. BYTE
  232. HexValue(
  233. IN CHAR byte );
  234. void
  235. IpHostAddrToPsz(
  236. IN DWORD dwAddr,
  237. OUT LPTSTR pszBuffer );
  238. BOOL
  239. IsAllWhite(
  240. IN LPCTSTR psz );
  241. BOOL
  242. IsNullTerminatedA(
  243. IN CHAR* psz,
  244. IN DWORD dwSize );
  245. DWORD
  246. IpPszToHostAddr(
  247. IN LPCTSTR cp );
  248. DWORD
  249. GetRasUnimodemBlob(
  250. IN HANDLE hConnection,
  251. IN HPORT hport,
  252. IN CHAR* pszDeviceType,
  253. OUT BYTE** ppBlob,
  254. OUT DWORD* pcbBlob );
  255. DWORD
  256. GetRasUnimodemBlobEx(
  257. IN HANDLE hConnection,
  258. IN HPORT hport,
  259. IN CHAR* pszDeviceType,
  260. IN BOOL fGlobal,
  261. OUT BYTE** ppBlob,
  262. OUT DWORD* pcbBlob );
  263. VOID
  264. GetRasUnimodemInfo(
  265. IN HANDLE hConnection,
  266. IN HPORT hport,
  267. IN CHAR* pszDeviceType,
  268. OUT UNIMODEMINFO* pInfo );
  269. TCHAR*
  270. LToT(
  271. LONG lValue,
  272. TCHAR* pszBuf,
  273. INT nRadix );
  274. TCHAR*
  275. PszFromDeviceAndPort(
  276. IN TCHAR* pszDevice,
  277. IN TCHAR* pszPort );
  278. LPCTSTR
  279. PszLoadStringPcch (
  280. HINSTANCE hinst,
  281. UINT unId,
  282. int* pcch);
  283. LPCTSTR
  284. PszLoadString (
  285. HINSTANCE hinst,
  286. UINT unId);
  287. DWORD
  288. RegDeleteTree(
  289. IN HKEY RootKey,
  290. IN TCHAR* SubKeyName );
  291. BOOL
  292. RegValueExists(
  293. IN HKEY hkey,
  294. IN TCHAR* pszValue );
  295. BOOL
  296. RestartComputer();
  297. TCHAR*
  298. StripPath(
  299. IN TCHAR* pszPath );
  300. LONG
  301. TToL(
  302. TCHAR *pszBuf );
  303. TCHAR*
  304. PszFromError(
  305. IN DWORD dwError );
  306. TCHAR*
  307. PszFromId(
  308. IN HINSTANCE hInstance,
  309. IN DWORD dwStringId );
  310. BOOL
  311. RestartComputer();
  312. VOID
  313. SanitizeUnimodemBlob(
  314. IN OUT BYTE* pBlob );
  315. VOID
  316. SetDefaultUnimodemInfo(
  317. OUT UNIMODEMINFO* pInfo );
  318. HFONT
  319. SetFont(
  320. HWND hwndCtrl,
  321. TCHAR* pszFaceName,
  322. BYTE bfPitchAndFamily,
  323. INT nPointSize,
  324. BOOL fUnderline,
  325. BOOL fStrikeout,
  326. BOOL fItalic,
  327. BOOL fBold );
  328. DWORD
  329. SetRegDword(
  330. IN HKEY hkey,
  331. IN TCHAR* pszName,
  332. IN DWORD dwValue );
  333. DWORD
  334. SetRegMultiSz(
  335. IN HKEY hkey,
  336. IN TCHAR* pszName,
  337. IN DTLLIST* pListValues,
  338. IN DWORD dwNodeType );
  339. DWORD
  340. SetRegSz(
  341. IN HKEY hkey,
  342. IN TCHAR* pszName,
  343. IN TCHAR* pszValue );
  344. DWORD
  345. SetRegSzz(
  346. IN HKEY hkey,
  347. IN TCHAR* pszName,
  348. IN TCHAR* pszValue );
  349. DWORD
  350. ShellSort(
  351. IN VOID* pItemTable,
  352. IN DWORD dwItemSize,
  353. IN DWORD dwItemCount,
  354. IN PFNCOMPARE pfnCompare );
  355. VOID
  356. ShellSortIndirect(
  357. IN VOID* pItemTable,
  358. IN VOID** ppItemTable,
  359. IN DWORD dwItemSize,
  360. IN DWORD dwItemCount,
  361. IN PFNCOMPARE pfnCompare );
  362. TCHAR*
  363. StrDup(
  364. LPCTSTR psz );
  365. CHAR*
  366. StrDupAFromT(
  367. LPCTSTR psz );
  368. CHAR*
  369. StrDupAFromTAnsi(
  370. LPCTSTR psz);
  371. TCHAR*
  372. StrDupTFromA(
  373. LPCSTR psz );
  374. TCHAR*
  375. StrDupTFromW(
  376. LPCWSTR psz );
  377. WCHAR*
  378. StrDupWFromA(
  379. LPCSTR psz );
  380. TCHAR*
  381. StrDupTFromAUsingAnsiEncoding(
  382. LPCSTR psz );
  383. WCHAR*
  384. StrDupWFromAUsingAnsiEncoding(
  385. LPCSTR psz );
  386. WCHAR*
  387. StrDupWFromT(
  388. LPCTSTR psz );
  389. DWORD
  390. StrCpyWFromA(
  391. WCHAR* pszDst,
  392. LPCSTR pszSrc,
  393. DWORD dwDstChars);
  394. DWORD
  395. StrCpyAFromW(
  396. LPSTR pszDst,
  397. LPCWSTR pszSrc,
  398. DWORD dwDstChars);
  399. DWORD
  400. StrCpyWFromAUsingAnsiEncoding(
  401. WCHAR* pszDst,
  402. LPCSTR pszSrc,
  403. DWORD dwDstChars);
  404. DWORD
  405. StrCpyAFromWUsingAnsiEncoding(
  406. LPSTR pszDst,
  407. LPCWSTR pszSrc,
  408. DWORD dwDstChars);
  409. int
  410. StrNCmpA(
  411. IN CHAR* psz1,
  412. IN CHAR* psz2,
  413. IN INT nLen );
  414. CHAR*
  415. StrStrA(
  416. IN CHAR* psz1,
  417. IN CHAR* psz2 );
  418. VOID
  419. UnimodemInfoFromBlob(
  420. IN BYTE* pBlob,
  421. OUT UNIMODEMINFO* pInfo );
  422. VOID
  423. UnimodemInfoToBlob(
  424. IN UNIMODEMINFO* pInfo,
  425. IN OUT BYTE* pBlob );
  426. TCHAR*
  427. UnNull(
  428. TCHAR* psz );
  429. #endif // _NOUIUTIL_H_