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.

278 lines
5.2 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. utils.h
  5. Abstract:
  6. <abstract>
  7. --*/
  8. #ifndef _UTILS_H_
  9. #define _UTILS_H_
  10. //#include <nttypes.h>
  11. #include <ntsecapi.h> // For PUNICODE_STRING
  12. #include "stdafx.h"
  13. #include "propbag.h"
  14. //===========================================================================
  15. // Macro Definitions
  16. //===========================================================================
  17. #define DEFAULT_LOG_FILE_SERIAL_NUMBER ((DWORD)0x00000001)
  18. #define DEFAULT_LOG_FILE_MAX_SIZE ((DWORD)-1)
  19. #define DEFAULT_CTR_LOG_FILE_TYPE SLF_BIN_FILE
  20. //===========================================================================
  21. // Exported Functions
  22. //===========================================================================
  23. //
  24. // Conversion
  25. //
  26. BOOL TruncateLLTime (LONGLONG llTime, LONGLONG* pllTime);
  27. BOOL LLTimeToVariantDate (LONGLONG llTime, DATE *pDate);
  28. BOOL VariantDateToLLTime (DATE Date, LONGLONG *pllTime);
  29. DWORD SlqTimeToMilliseconds ( SLQ_TIME_INFO* pTimeInfo, LONGLONG* pllmsecs);
  30. //
  31. // Property bag I/O
  32. //
  33. HRESULT _stdcall
  34. DwordFromPropertyBag (
  35. CPropertyBag* pPropBag,
  36. LPCWSTR szPropName,
  37. DWORD& rdwData );
  38. HRESULT _stdcall
  39. ShortFromPropertyBag (
  40. CPropertyBag* pPropBag,
  41. LPCWSTR szPropName,
  42. SHORT& riData );
  43. HRESULT _stdcall
  44. BOOLFromPropertyBag (
  45. CPropertyBag* pPropBag,
  46. LPCWSTR szPropName,
  47. BOOL& rbData );
  48. HRESULT _stdcall
  49. DoubleFromPropertyBag (
  50. CPropertyBag* pPropBag,
  51. LPCWSTR szPropName,
  52. DOUBLE& rdblData );
  53. HRESULT _stdcall
  54. FloatFromPropertyBag (
  55. CPropertyBag* pPropBag,
  56. LPCWSTR szPropName,
  57. FLOAT& rfData );
  58. HRESULT _stdcall
  59. CyFromPropertyBag (
  60. CPropertyBag* pPropBag,
  61. LPCWSTR szPropName,
  62. CY& rcyData );
  63. HRESULT _stdcall
  64. StringFromPropertyBag (
  65. CPropertyBag* pPropBag,
  66. LPCWSTR szPropName,
  67. LPWSTR szData,
  68. DWORD* pdwBufLen );
  69. HRESULT _stdcall
  70. LLTimeFromPropertyBag (
  71. CPropertyBag* pPropBag,
  72. LPCWSTR szPropName,
  73. LONGLONG& rllData );
  74. HRESULT _stdcall
  75. SlqTimeFromPropertyBag (
  76. CPropertyBag* pPropBag,
  77. WORD wFlags,
  78. PSLQ_TIME_INFO pstiDefault,
  79. PSLQ_TIME_INFO pstiData );
  80. // Registry I/O
  81. DWORD _stdcall
  82. AddStringToMszBuffer (
  83. LPCWSTR szString,
  84. LPWSTR szBuffer,
  85. DWORD* pdwBufLen,
  86. DWORD* pdwBufStringLen );
  87. LONG _stdcall
  88. WriteRegistryStringValue (
  89. HKEY hKey,
  90. LPCWSTR cwszValueName,
  91. DWORD dwType,
  92. LPCWSTR pszBuffer,
  93. DWORD dwBufLen );
  94. LONG _stdcall
  95. WriteRegistryDwordValue (
  96. HKEY hKey,
  97. LPCWSTR cwszValueName,
  98. LPDWORD pdwValue,
  99. DWORD dwType=REG_DWORD); // Also supports REG_BINARY
  100. LONG _stdcall
  101. WriteRegistrySlqTime (
  102. HKEY hKey,
  103. LPCWSTR cwszValueName,
  104. PSLQ_TIME_INFO pstiData );
  105. LONG _stdcall
  106. ReadRegistryDwordValue (
  107. HKEY hKey,
  108. LPCWSTR cwszValueName,
  109. LPDWORD pdwValue );
  110. LONG _stdcall
  111. ReadRegistrySlqTime (
  112. HKEY hKey,
  113. LPCWSTR cwszValueName,
  114. PSLQ_TIME_INFO pstiData );
  115. //
  116. // Wrapper and helper functions for html to registry
  117. //
  118. HRESULT _stdcall
  119. StringFromPropBagAlloc (
  120. CPropertyBag* pPropBag,
  121. LPCWSTR szPropertyName,
  122. LPWSTR* pszBuffer,
  123. DWORD* pdwBufferLen,
  124. DWORD* pdwStringLen = NULL );
  125. HRESULT _stdcall
  126. AddStringToMszBufferAlloc (
  127. LPCWSTR szString,
  128. LPWSTR* pszBuffer,
  129. DWORD* pdwBufLen,
  130. DWORD* pdwBufStringLen );
  131. HRESULT _stdcall
  132. InitDefaultSlqTimeInfo (
  133. DWORD dwQueryType,
  134. WORD wTimeType,
  135. PSLQ_TIME_INFO pstiData );
  136. /*
  137. HRESULT
  138. ProcessStringProperty (
  139. CPropertyBag* pPropBag,
  140. HKEY hKeyParent,
  141. LPCWSTR szHtmlPropertyName,
  142. LPCWSTR szRegPropertyName,
  143. DWORD dwRegType,
  144. LPWSTR* pszBuffer,
  145. DWORD* pdwBufferLen );
  146. */
  147. //
  148. // Resources
  149. //
  150. LPWSTR ResourceString(UINT uID);
  151. //
  152. // Messages
  153. //
  154. DWORD _stdcall
  155. FormatSystemMessage (
  156. DWORD dwMessageId,
  157. LPWSTR pszSystemMessage,
  158. DWORD dwBufSize,
  159. ... );
  160. DWORD _stdcall
  161. FormatResourceString (
  162. DWORD dwResourceId,
  163. LPWSTR pszFormattedString,
  164. DWORD dwBufSize,
  165. va_list* pargList );
  166. void _stdcall
  167. DisplayResourceString (
  168. DWORD dwResourceId,
  169. ... );
  170. void _stdcall
  171. DisplayErrorMessage (
  172. DWORD dwMessageId,
  173. ... );
  174. BOOL _stdcall
  175. IsLogManMessage (
  176. DWORD dwMessageId,
  177. DWORD* pdwResourceId = NULL );
  178. //
  179. // Files
  180. //
  181. BOOL _stdcall
  182. FileRead (
  183. HANDLE hFile,
  184. void* lpMemory,
  185. DWORD nAmtToRead );
  186. BOOL _stdcall
  187. FileWrite (
  188. HANDLE hFile,
  189. void* lpMemory,
  190. DWORD nAmtToWrite );
  191. BOOL _stdcall
  192. IsValidFileName (
  193. LPCWSTR cszFileName );
  194. LPTSTR _stdcall
  195. ExtractFileName (
  196. LPTSTR pFileSpec );
  197. //
  198. // Folder path
  199. //
  200. BOOL _stdcall
  201. LoadDefaultLogFileFolder(
  202. TCHAR *szFolder
  203. );
  204. DWORD _stdcall
  205. ParseFolderPath(
  206. LPCTSTR szOrigPath,
  207. LPTSTR szBuffer,
  208. INT* piBufLen );
  209. DWORD __stdcall
  210. IsValidDirPath (
  211. LPCWSTR cszPath,
  212. BOOL bLastNameIsDirectory,
  213. BOOL bCreateMissingDirs,
  214. BOOL& rbIsValid );
  215. //
  216. // Guids
  217. //
  218. DWORD _stdcall
  219. GuidFromString(
  220. IN PUNICODE_STRING GuidString,
  221. OUT GUID* Guid );
  222. #endif //_UTILS_H_