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.

367 lines
6.3 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 idHlpMessage,
  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 LPCTSTR pszFullName,
  96. IN LPCTSTR *ppszServer,
  97. IN LPCTSTR *ppszPrinter
  98. );
  99. BOOL
  100. bBuildFullPrinterName(
  101. IN LPCTSTR pszServer,
  102. IN LPCTSTR pszPrinterName,
  103. IN TString &strFullName
  104. );
  105. BOOL
  106. bGetMachineName(
  107. IN OUT TString &strMachineName,
  108. IN BOOL bNoLeadingSlashes = FALSE
  109. );
  110. BOOL
  111. NewFriendlyName(
  112. IN LPCTSTR pszServerName,
  113. IN LPCTSTR lpBaseName,
  114. IN LPTSTR lpNewName,
  115. IN OUT WORD *pwInstance = NULL
  116. );
  117. BOOL
  118. CreateUniqueName(
  119. IN LPTSTR lpDest,
  120. IN UINT cchMaxChars,
  121. IN LPCTSTR lpBaseName,
  122. IN WORD wInstance
  123. );
  124. BOOL
  125. bSplitPath(
  126. IN LPTSTR pszScratch,
  127. IN LPCTSTR *ppszFile,
  128. IN LPCTSTR *ppszPath,
  129. IN LPCTSTR *ppszExt,
  130. IN LPCTSTR pszFull
  131. );
  132. BOOL
  133. bCopyMultizString(
  134. IN LPTSTR *ppszMultizCopy,
  135. IN LPCTSTR pszMultizString
  136. );
  137. LPCTSTR
  138. pszStrToSpoolerServerName(
  139. IN TString &strServerName
  140. );
  141. VOID
  142. vStripTrailWhiteSpace(
  143. IN LPTSTR pszString
  144. );
  145. BOOL
  146. bTrimString(
  147. IN OUT LPTSTR pszTrimMe,
  148. IN LPCTSTR pszTrimChars
  149. );
  150. BOOL
  151. bIsRemote(
  152. IN LPCTSTR pszName
  153. );
  154. BOOL
  155. bLookupErrorMessageMap(
  156. IN const PMSG_ERRMAP pMsgErrMap,
  157. IN DWORD dwLastError,
  158. IN OUT MSG_ERRMAP **ppErrMapEntry
  159. );
  160. BOOL
  161. bLookupHelpMessageMap(
  162. IN const PMSG_HLPMAP pMsgHlpMap,
  163. IN DWORD dwLastError,
  164. IN OUT MSG_HLPMAP **ppHelpMapEntry
  165. );
  166. BOOL
  167. bGoodLastError(
  168. IN DWORD dwLastError
  169. );
  170. BOOL
  171. WINAPI
  172. UtilHelpCallback(
  173. IN HWND hwnd,
  174. IN PVOID pVoid
  175. );
  176. BOOL
  177. StringA2W(
  178. IN OUT LPWSTR *ppResult,
  179. IN LPCSTR pString
  180. );
  181. BOOL
  182. StringW2A(
  183. IN OUT LPSTR *ppResult,
  184. IN LPCWSTR pString
  185. );
  186. VOID
  187. CenterDialog(
  188. IN HWND hwndToCenter,
  189. IN HWND hwndContext
  190. );
  191. BOOL
  192. GetDomainName(
  193. OUT TString &strDomainName
  194. );
  195. BOOL
  196. ConstructPrinterFriendlyName(
  197. IN LPCTSTR pszFullPrinter,
  198. IN OUT LPTSTR pszPrinterBuffer,
  199. IN OUT UINT *pcchSize
  200. );
  201. BOOL
  202. WINAPIV
  203. bConstructMessageString(
  204. IN HINSTANCE hInst,
  205. IN TString &strString,
  206. IN INT iResId,
  207. IN ...
  208. );
  209. BOOL
  210. bIsLocalPrinterNameValid(
  211. IN LPCTSTR pszPrinter
  212. );
  213. BOOL
  214. CheckRestrictions(
  215. IN HWND hwnd,
  216. IN RESTRICTIONS rest
  217. );
  218. VOID
  219. vAdjustHeaderColumns(
  220. IN HWND hwndLV,
  221. IN UINT uColumnsCount,
  222. IN UINT uPercentages[]
  223. );
  224. VOID
  225. LoadPrinterIcons(
  226. IN LPCTSTR pszPrinterName,
  227. OUT HICON *phLargeIcon,
  228. OUT HICON *phSmallIcon
  229. );
  230. BOOL
  231. CommandConfirmationPurge(
  232. IN HWND hwnd,
  233. IN LPCTSTR pszPrinterName
  234. );
  235. DWORD
  236. dwDateFormatFlags(
  237. HWND hWnd
  238. );
  239. BOOL
  240. bMatchTemplate(
  241. IN LPCTSTR pszTemplate,
  242. IN LPCTSTR pszText
  243. );
  244. BOOL
  245. bIsFaxPort(
  246. IN LPCTSTR pszName,
  247. IN LPCTSTR pszMonitor
  248. );
  249. HRESULT
  250. AbbreviateText(
  251. IN LPCTSTR pszText,
  252. IN UINT cchMaxChars,
  253. OUT TString *pstrAbbreviatedText
  254. );
  255. BOOL
  256. MoveWindowWrap(
  257. HWND hwnd,
  258. int deltaX,
  259. int deltaY
  260. );
  261. HRESULT
  262. IsColorPrinter(
  263. IN LPCWSTR pszPrinter,
  264. IN OUT LPBOOL pbColor
  265. );
  266. // Some new private APIs to launch the home networking wizard (HNW)
  267. // when ForceGuest is enabled and ILM_GUEST_NETWORK_LOGON is not
  268. // enabled. - DCR: #256891. Printing bug: #282379.
  269. HRESULT
  270. IsGuestAccessMode(
  271. OUT BOOL *pbGuestAccessMode
  272. );
  273. HRESULT
  274. IsGuestEnabledForNetworkAccess(
  275. OUT BOOL *pbGuestEnabledForNetworkAccess
  276. );
  277. HRESULT
  278. IsSharingEnabled(
  279. OUT BOOL *pbSharingEnabled
  280. );
  281. HRESULT
  282. LaunchHomeNetworkingWizard(
  283. IN HWND hwnd,
  284. OUT BOOL *pbRebootRequired
  285. );
  286. HRESULT
  287. IsRedirectedPort(
  288. IN LPCTSTR pszPortName,
  289. OUT BOOL *pbIsRedirected
  290. );
  291. BOOL
  292. AreWeOnADomain(
  293. OUT BOOL *pbOnDomain
  294. );
  295. INT
  296. DisplayMessageFromOtherResourceDll(
  297. IN HWND hwnd,
  298. IN UINT idsTitle,
  299. IN PCWSTR pszMessageDll,
  300. IN UINT idsMessage,
  301. IN UINT uType,
  302. ...
  303. );
  304. #endif // ndef _UTIL_HXX