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.

360 lines
6.5 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1995 - 1999
  3. All rights reserved.
  4. Module Name:
  5. util.hxx
  6. Abstract:
  7. Holds util prototypes
  8. Author:
  9. Albert Ting (AlbertT) 27-Jan-1995
  10. Revision History:
  11. --*/
  12. #ifndef _UTIL_HXX
  13. #define _UTIL_HXX
  14. //
  15. // -1 indicates GetLastError should be used instead of the input value.
  16. //
  17. const DWORD kMsgGetLastError = (DWORD)-1;
  18. const DWORD kMsgNone = 0;
  19. const UINT kMaxEditText = 4096;
  20. typedef struct MSG_ERRMAP
  21. {
  22. DWORD dwError; // Error code to map
  23. UINT idsString; // Mapped message in resouce file
  24. } *PMSG_ERRMAP;
  25. typedef struct MSG_HLPMAP
  26. {
  27. DWORD dwError; // Error code to map
  28. UINT uIdMessage; // Mapped message in resouce file
  29. LPCTSTR pszHelpFile; // Name of Troubleshooter URL
  30. } *PMSG_HLPMAP;
  31. LPTSTR
  32. pszStrCat(
  33. LPTSTR pszDest,
  34. LPCTSTR pszSource,
  35. UINT& cchDest
  36. );
  37. INT
  38. iMessage(
  39. IN HWND hwnd,
  40. IN UINT idsTitle,
  41. IN UINT idsMessage,
  42. IN UINT uType,
  43. IN DWORD dwLastError,
  44. IN const PMSG_ERRMAP pMsgErrMap
  45. ...
  46. );
  47. INT
  48. iMessage2(
  49. IN HWND hwnd,
  50. IN LPCTSTR pszTitle,
  51. IN LPCTSTR pszMessage,
  52. IN UINT uType,
  53. IN DWORD dwLastError,
  54. IN const PMSG_ERRMAP pMsgErrMap
  55. ...
  56. );
  57. INT
  58. iMessageEx(
  59. IN HWND hwnd,
  60. IN UINT idsTitle,
  61. IN UINT idsMessage,
  62. IN UINT uType,
  63. IN DWORD dwLastError,
  64. IN const PMSG_ERRMAP pMsgErrMap,
  65. IN UINT idMessage,
  66. IN const PMSG_HLPMAP pHlpErrMap,
  67. ...
  68. );
  69. HRESULT
  70. Internal_Message(
  71. OUT INT *piResult,
  72. IN HINSTANCE hModule,
  73. IN HWND hwnd,
  74. IN LPCTSTR pszTitle,
  75. IN LPCTSTR pszMessage,
  76. IN UINT uType,
  77. IN DWORD dwLastError,
  78. IN const PMSG_ERRMAP pMsgErrMap,
  79. IN UINT idMessage,
  80. IN const PMSG_HLPMAP pHlpErrMap,
  81. IN va_list valist
  82. );
  83. VOID
  84. vShowResourceError(
  85. HWND hwnd
  86. );
  87. VOID
  88. vShowUnexpectedError(
  89. HWND hwnd,
  90. UINT idsTitle
  91. );
  92. VOID
  93. vPrinterSplitFullName(
  94. IN LPTSTR pszScratch,
  95. IN DWORD cchScratchSize,
  96. IN LPCTSTR pszFullName,
  97. IN LPCTSTR *ppszServer,
  98. IN LPCTSTR *ppszPrinter
  99. );
  100. BOOL
  101. bBuildFullPrinterName(
  102. IN LPCTSTR pszServer,
  103. IN LPCTSTR pszPrinterName,
  104. IN TString &strFullName
  105. );
  106. BOOL
  107. bGetMachineName(
  108. IN OUT TString &strMachineName,
  109. IN BOOL bNoLeadingSlashes = FALSE
  110. );
  111. BOOL
  112. NewFriendlyName(
  113. IN LPCTSTR pszServerName,
  114. IN LPCTSTR lpBaseName,
  115. OUT LPTSTR lpNewName,
  116. IN size_t cchNewNameMax,
  117. IN OUT WORD *pwInstance = NULL
  118. );
  119. BOOL
  120. CreateUniqueName(
  121. IN LPTSTR lpDest,
  122. IN UINT cchMaxChars,
  123. IN LPCTSTR lpBaseName,
  124. IN WORD wInstance
  125. );
  126. BOOL
  127. bSplitPath(
  128. IN LPTSTR pszScratch,
  129. IN size_t cchScratch,
  130. IN LPCTSTR *ppszFile,
  131. IN LPCTSTR *ppszPath,
  132. IN LPCTSTR *ppszExt,
  133. IN LPCTSTR pszFull
  134. );
  135. BOOL
  136. bCopyMultizString(
  137. IN LPTSTR *ppszMultizCopy,
  138. IN LPCTSTR pszMultizString
  139. );
  140. LPCTSTR
  141. pszStrToSpoolerServerName(
  142. IN TString &strServerName
  143. );
  144. VOID
  145. vStripTrailWhiteSpace(
  146. IN LPTSTR pszString
  147. );
  148. BOOL
  149. bTrimString(
  150. IN OUT LPTSTR pszTrimMe,
  151. IN LPCTSTR pszTrimChars
  152. );
  153. BOOL
  154. bIsRemote(
  155. IN LPCTSTR pszName
  156. );
  157. BOOL
  158. bLookupErrorMessageMap(
  159. IN const PMSG_ERRMAP pMsgErrMap,
  160. IN DWORD dwLastError,
  161. IN OUT MSG_ERRMAP **ppErrMapEntry
  162. );
  163. BOOL
  164. bLookupHelpMessageMap(
  165. IN const PMSG_HLPMAP pMsgHlpMap,
  166. IN DWORD dwLastError,
  167. IN OUT MSG_HLPMAP **ppHelpMapEntry
  168. );
  169. BOOL
  170. bGoodLastError(
  171. IN DWORD dwLastError
  172. );
  173. BOOL
  174. WINAPI
  175. UtilHelpCallback(
  176. IN HWND hwnd,
  177. IN PVOID pVoid
  178. );
  179. BOOL
  180. StringA2W(
  181. IN OUT LPWSTR *ppResult,
  182. IN LPCSTR pString
  183. );
  184. BOOL
  185. StringW2A(
  186. IN OUT LPSTR *ppResult,
  187. IN LPCWSTR pString
  188. );
  189. VOID
  190. CenterDialog(
  191. IN HWND hwndToCenter,
  192. IN HWND hwndContext
  193. );
  194. BOOL
  195. GetDomainName(
  196. OUT TString &strDomainName
  197. );
  198. BOOL
  199. ConstructPrinterFriendlyName(
  200. IN LPCTSTR pszFullPrinter,
  201. IN OUT LPTSTR pszPrinterBuffer,
  202. IN OUT UINT *pcchSize
  203. );
  204. BOOL
  205. WINAPIV
  206. bConstructMessageString(
  207. IN HINSTANCE hInst,
  208. IN TString &strString,
  209. IN INT iResId,
  210. IN ...
  211. );
  212. BOOL
  213. bIsLocalPrinterNameValid(
  214. IN LPCTSTR pszPrinter
  215. );
  216. BOOL
  217. CheckRestrictions(
  218. IN HWND hwnd,
  219. IN RESTRICTIONS rest
  220. );
  221. VOID
  222. vAdjustHeaderColumns(
  223. IN HWND hwndLV,
  224. IN UINT uColumnsCount,
  225. IN UINT uPercentages[]
  226. );
  227. VOID
  228. LoadPrinterIcons(
  229. IN LPCTSTR pszPrinterName,
  230. OUT HICON *phLargeIcon,
  231. OUT HICON *phSmallIcon
  232. );
  233. BOOL
  234. CommandConfirmationPurge(
  235. IN HWND hwnd,
  236. IN LPCTSTR pszPrinterName
  237. );
  238. BOOL
  239. bMatchTemplate(
  240. IN LPCTSTR pszTemplate,
  241. IN LPCTSTR pszText
  242. );
  243. BOOL
  244. bIsFaxPort(
  245. IN LPCTSTR pszName,
  246. IN LPCTSTR pszMonitor
  247. );
  248. HRESULT
  249. AbbreviateText(
  250. IN LPCTSTR pszText,
  251. IN UINT cchMaxChars,
  252. OUT TString *pstrAbbreviatedText
  253. );
  254. BOOL
  255. MoveWindowWrap(
  256. HWND hwnd,
  257. int deltaX,
  258. int deltaY
  259. );
  260. HRESULT
  261. IsColorPrinter(
  262. IN LPCWSTR pszPrinter,
  263. IN OUT LPBOOL pbColor
  264. );
  265. // Some new private APIs to launch the home networking wizard (HNW)
  266. // when ForceGuest is enabled and ILM_GUEST_NETWORK_LOGON is not
  267. // enabled. - DCR: #256891. Printing bug: #282379.
  268. HRESULT
  269. IsGuestAccessMode(
  270. OUT BOOL *pbGuestAccessMode
  271. );
  272. HRESULT
  273. IsGuestEnabledForNetworkAccess(
  274. OUT BOOL *pbGuestEnabledForNetworkAccess
  275. );
  276. HRESULT
  277. IsSharingEnabled(
  278. OUT BOOL *pbSharingEnabled
  279. );
  280. HRESULT
  281. LaunchHomeNetworkingWizard(
  282. IN HWND hwnd,
  283. OUT BOOL *pbRebootRequired
  284. );
  285. HRESULT
  286. IsRedirectedPort(
  287. IN LPCTSTR pszPortName,
  288. OUT BOOL *pbIsRedirected
  289. );
  290. BOOL
  291. AreWeOnADomain(
  292. OUT BOOL *pbOnDomain
  293. );
  294. HRESULT
  295. MsgInfinitelyWaitForSingleObject(
  296. IN HANDLE hWaitableObject
  297. );
  298. #endif // ndef _UTIL_HXX