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.

290 lines
6.0 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. allutils.h
  5. Abstract:
  6. Includes all header files necessary to use the libraries generated under the
  7. utils directory. Declares many macros and MAX constants.
  8. Author:
  9. Jim Schmidt (jimschm) 23-Aug-1996
  10. Revision History:
  11. marcw 2-Sep-1999 Ported over from win95upg project (migutil.h) Needs lots of cleanup.
  12. --*/
  13. #pragma once
  14. //
  15. // Includes
  16. //
  17. #include "utiltypes.h"
  18. #include "main.h"
  19. #include "dbgtrack.h"
  20. #include "basemem.h"
  21. #include "log.h"
  22. #include "growbuf.h"
  23. #include "strings.h"
  24. #include "poolmem.h"
  25. #include "growlist.h"
  26. #include "version.h"
  27. #include "modimage.h"
  28. #include "icons.h"
  29. #include "unicode.h"
  30. #include "hash.h"
  31. #include "basefile.h"
  32. #include "memdb.h"
  33. #include "inf.h"
  34. #include "ini.h"
  35. #include "blobs.h"
  36. #include "objstr.h"
  37. #include "exclist.h"
  38. #include "reg.h"
  39. #include "regenum.h"
  40. #include "fileenum.h"
  41. #include "cablib.h"
  42. #include "wnd.h"
  43. #include "strmap.h"
  44. #include "linkpif.h"
  45. #include "progbar.h"
  46. //
  47. // Strings
  48. //
  49. // None
  50. //
  51. // Constants
  52. //
  53. #define MAX_PATH_PLUS_NUL (MAX_PATH+1)
  54. #define MAX_MBCHAR_PATH (MAX_PATH_PLUS_NUL*2)
  55. #define MAX_WCHAR_PATH MAX_PATH_PLUS_NUL
  56. #define MAX_MBCHAR_PRINTABLE_PATH (MAX_PATH*2)
  57. #define MAX_WCHAR_PRINTABLE_PATH MAX_PATH
  58. #define MAX_SERVER_NAMEA (64*2)
  59. #define MAX_USER_NAMEA (MAX_SERVER_NAMEA + (20 * 2))
  60. #define MAX_REGISTRY_KEYA (1024 * 2)
  61. #define MAX_REGISTRY_VALUE_NAMEA (260 * 2)
  62. #define MAX_COMPONENT_NAMEA (256 * 2)
  63. #define MAX_COMPUTER_NAMEA (64 * 2)
  64. #define MAX_CMDLINEA (1024 * 2) // maximum number of chars in a Win95 command line
  65. #define MAX_KEYBOARDLAYOUT 64
  66. #define MAX_INF_SECTION_NAME 128
  67. #define MAX_INF_KEY_NAME 128
  68. #define MAX_SERVER_NAMEW 64
  69. #define MAX_USER_NAMEW (MAX_SERVER_NAMEW + 20)
  70. #define MAX_REGISTRY_KEYW 1024
  71. #define MAX_REGISTRY_VALUE_NAMEW 260
  72. #define MAX_COMPONENT_NAMEW 256
  73. #define MAX_COMPUTER_NAMEW 64
  74. #define MAX_CMDLINEW 1024 // maximum number of chars in a Win95 command line
  75. #ifdef UNICODE
  76. #define MAX_SERVER_NAME MAX_SERVER_NAMEW
  77. #define MAX_USER_NAME MAX_USER_NAMEW
  78. #define MAX_REGISTRY_KEY MAX_REGISTRY_KEYW
  79. #define MAX_REGISTRY_VALUE_NAME MAX_REGISTRY_VALUE_NAMEW
  80. #define MAX_COMPONENT_NAME MAX_COMPONENT_NAMEW
  81. #define MAX_COMPUTER_NAME MAX_COMPUTER_NAMEW
  82. #define MAX_CMDLINE MAX_CMDLINEW
  83. #define MAX_TCHAR_PATH MAX_WCHAR_PATH
  84. #define MAX_TCHAR_PRINTABLE_PATH MAX_WCHAR_PRINTABLE_PATH
  85. #else
  86. #define MAX_SERVER_NAME MAX_SERVER_NAMEA
  87. #define MAX_USER_NAME MAX_USER_NAMEA
  88. #define MAX_REGISTRY_KEY MAX_REGISTRY_KEYA
  89. #define MAX_REGISTRY_VALUE_NAME MAX_REGISTRY_VALUE_NAMEA
  90. #define MAX_COMPONENT_NAME MAX_COMPONENT_NAMEA
  91. #define MAX_COMPUTER_NAME MAX_COMPUTER_NAMEA
  92. #define MAX_CMDLINE MAX_CMDLINEA
  93. #define MAX_TCHAR_PATH MAX_MBCHAR_PATH
  94. #define MAX_TCHAR_PRINTABLE_PATH MAX_MBCHAR_PRINTABLE_PATH
  95. #endif
  96. //
  97. // Macros
  98. //
  99. //
  100. // OSVERSION macros...
  101. //
  102. #define ISNT() (g_OsInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
  103. #define ISWIN9X() (g_OsInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
  104. #define ISWIN95_GOLDEN() (ISWIN95() && WORD(g_OsInfo.dwBuildNumber) <= 1000)
  105. #define ISWIN95_OSR2() (ISWIN95() && WORD(g_OsInfo.dwBuildNumber) > 1000)
  106. #define ISWIN95() (ISWIN9X() && !ISMEMPHIS())
  107. #define ISMEMPHIS() (ISWIN9X() && g_OsInfo.dwMajorVersion==4 && g_OsInfo.dwMinorVersion==10)
  108. #define BUILDNUMBER() (g_OsInfo.dwBuildNumber)
  109. //
  110. // Error condition tags.
  111. //
  112. // These tags should be used for all error conditions.
  113. //
  114. #define ERROR_CRITICAL
  115. #define ERROR_NONCRITICAL
  116. #define ERROR_TRIVIAL
  117. #define ERROR_ABNORMAL_CONDITION
  118. //
  119. // Types
  120. //
  121. typedef struct {
  122. HANDLE EventHandle;
  123. } OUR_CRITICAL_SECTION, *POUR_CRITICAL_SECTION;
  124. //
  125. // Globals
  126. //
  127. extern HINSTANCE g_hInst;
  128. extern HANDLE g_hHeap;
  129. extern OSVERSIONINFOA g_OsInfo;
  130. extern BOOL g_IsPc98;
  131. //
  132. // Boot drive letter
  133. //
  134. extern PCSTR g_BootDrivePathA;
  135. extern PCWSTR g_BootDrivePathW;
  136. extern PCSTR g_BootDriveA;
  137. extern PCWSTR g_BootDriveW;
  138. extern CHAR g_BootDriveLetterA;
  139. extern WCHAR g_BootDriveLetterW;
  140. //
  141. // Macro expansion list
  142. //
  143. // None
  144. //
  145. // Public function prototypes
  146. //
  147. //
  148. // Critical Section APIs, implemented because TryEnterCriticalSection is
  149. // supported only on NT, and we need it on Win9x.
  150. //
  151. BOOL
  152. InitializeOurCriticalSection (
  153. OUR_CRITICAL_SECTION *pcs
  154. );
  155. VOID
  156. DeleteOurCriticalSection (
  157. OUR_CRITICAL_SECTION *pcs
  158. );
  159. BOOL
  160. EnterOurCriticalSection (
  161. OUR_CRITICAL_SECTION *pcs
  162. );
  163. VOID
  164. LeaveOurCriticalSection (
  165. OUR_CRITICAL_SECTION *pcs
  166. );
  167. BOOL
  168. TryEnterOurCriticalSection (
  169. OUR_CRITICAL_SECTION *pcs
  170. );
  171. //
  172. // Includes of util modules
  173. //
  174. VOID
  175. CenterWindow (
  176. HWND Wnd,
  177. HWND Parent OPTIONAL
  178. );
  179. VOID
  180. TurnOnWaitCursor (
  181. VOID
  182. );
  183. VOID
  184. TurnOffWaitCursor (
  185. VOID
  186. );
  187. VOID
  188. OutOfMemory_Terminate (
  189. VOID
  190. );
  191. VOID
  192. SetOutOfMemoryParent (
  193. HWND hwnd
  194. );
  195. HANDLE
  196. StartThread (
  197. IN PTHREAD_START_ROUTINE Address,
  198. IN PVOID Arg
  199. );
  200. //
  201. // Macro expansion definition
  202. //
  203. // None
  204. //
  205. // Unicode/Ansi mappings.
  206. //
  207. #ifdef UNICODE
  208. #define g_BootDrivePath g_BootDrivePathW
  209. #define g_BootDrive g_BootDriveW
  210. #define g_BootDriveLetter g_BootDriveLetterW
  211. #else
  212. #define g_BootDrivePath g_BootDrivePathA
  213. #define g_BootDrive g_BootDriveA
  214. #define g_BootDriveLetter g_BootDriveLetterA
  215. #endif
  216. #ifndef ARRAYSIZE
  217. #define ARRAYSIZE(n) (sizeof(n)/sizeof(n[0]))
  218. #endif