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.

256 lines
8.3 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. base.h
  5. Abstract:
  6. This include file defines the type and constant definitions that are
  7. shared by the client and server portions of the BASE portion of the
  8. Windows subsystem.
  9. Author:
  10. Steve Wood (stevewo) 25-Oct-1990
  11. Revision History:
  12. --*/
  13. #if !defined(_WINDOWS_BASE)
  14. #define _WINDOWS_BASE 1
  15. #ifndef RC_INVOKED
  16. #include <nt.h>
  17. #include <ntrtl.h>
  18. #include <nturtl.h>
  19. #endif
  20. #include <windows.h>
  21. #include <winbasep.h>
  22. #include <string.h>
  23. #include <stdarg.h>
  24. //
  25. // Define debugging flag as false if not defined already.
  26. //
  27. #ifndef DBG
  28. #define DBG 0
  29. #endif
  30. //
  31. // Define IF_DEBUG macro that can be used to enable debugging code that is
  32. // optimized out if the debugging flag is false.
  33. //
  34. #if DBG
  35. #define IF_DEBUG if (TRUE)
  36. #else
  37. #define IF_DEBUG if (FALSE)
  38. #endif
  39. //
  40. // Include Windows Subsystem common definitions
  41. //
  42. #include <conroute.h>
  43. //
  44. // Include definitions for the runtime DLL shared between the client and
  45. // server portions of the Base portion of the Windows subsystem
  46. //
  47. #define WIN32_SS_PIPE_FORMAT_STRING "\\Device\\NamedPipe\\Win32Pipes.%08x.%08x"
  48. //
  49. // Macros for interoperability between 32bit and 64bit code.
  50. #if defined(BUILD_WOW6432)
  51. #define BASE_SHARED_PTR(TYPE_NAME) ULONGLONG
  52. #define BASE_SHARED_STRING UNICODE_STRING64
  53. #define UStr64ToUStr(dst, src) ( (dst)->Length = (src)->Length, \
  54. (dst)->MaximumLength = (src)->MaximumLength, \
  55. (dst)->Buffer = (PWSTR) ((src)->Buffer), \
  56. (dst) \
  57. )
  58. #define UStrToUStr64(dst, src) ( (dst)->Length = (src)->Length, \
  59. (dst)->MaximumLength = (src)->MaximumLength, \
  60. (dst)->Buffer = (ULONGLONG) ((src)->Buffer), \
  61. (dst) \
  62. )
  63. // In the 32BIT kernel32, on NT64 multiple the index by 2 since pointer
  64. // are twice are large.
  65. #define BASE_SHARED_SERVER_DATA (NtCurrentPeb()->ReadOnlyStaticServerData[BASESRV_SERVERDLL_INDEX*2])
  66. #define BASE_SERVER_STR_TO_LOCAL_STR(d,s) UStr64ToUStr(d,s)
  67. #define BASE_READ_REMOTE_STR_TEMP(temp) UNICODE_STRING temp
  68. #define BASE_READ_REMOTE_STR(str,temp) (UStr64ToUStr(&(temp),&(str)))
  69. #else
  70. #define BASE_SHARED_PTR(TYPE_NAME) TYPE_NAME
  71. #define BASE_SHARED_STRING UNICODE_STRING
  72. #define BASE_SHARED_SERVER_DATA (NtCurrentPeb()->ReadOnlyStaticServerData[BASESRV_SERVERDLL_INDEX])
  73. #define BASE_SERVER_STR_TO_LOCAL_STR(d,s) *(d)=*(s)
  74. #define BASE_READ_REMOTE_STR_TEMP(temp)
  75. #define BASE_READ_REMOTE_STR(str,temp) (&(str))
  76. #endif
  77. #if defined(BUILD_WOW6432) || defined(_WIN64)
  78. #define BASE_SYSINFO (SysInfo)
  79. #else
  80. #define BASE_SYSINFO (BaseStaticServerData->SysInfo)
  81. #endif
  82. //
  83. // These structures are kept in the global shared memory section created
  84. // in the server and mapped readonly into each client address space when
  85. // they connect to the server.
  86. //
  87. typedef struct _INIFILE_MAPPING_TARGET {
  88. BASE_SHARED_PTR(struct _INIFILE_MAPPING_TARGET *) Next;
  89. BASE_SHARED_STRING RegistryPath;
  90. } INIFILE_MAPPING_TARGET, *PINIFILE_MAPPING_TARGET;
  91. typedef struct _INIFILE_MAPPING_VARNAME {
  92. BASE_SHARED_PTR(struct _INIFILE_MAPPING_VARNAME *) Next;
  93. BASE_SHARED_STRING Name;
  94. ULONG MappingFlags;
  95. BASE_SHARED_PTR(PINIFILE_MAPPING_TARGET) MappingTarget;
  96. } INIFILE_MAPPING_VARNAME, *PINIFILE_MAPPING_VARNAME;
  97. #define INIFILE_MAPPING_WRITE_TO_INIFILE_TOO 0x00000001
  98. #define INIFILE_MAPPING_INIT_FROM_INIFILE 0x00000002
  99. #define INIFILE_MAPPING_READ_FROM_REGISTRY_ONLY 0x00000004
  100. #define INIFILE_MAPPING_APPEND_BASE_NAME 0x10000000
  101. #define INIFILE_MAPPING_APPEND_APPLICATION_NAME 0x20000000
  102. #define INIFILE_MAPPING_SOFTWARE_RELATIVE 0x40000000
  103. #define INIFILE_MAPPING_USER_RELATIVE 0x80000000
  104. typedef struct _INIFILE_MAPPING_APPNAME {
  105. BASE_SHARED_PTR(struct _INIFILE_MAPPING_APPNAME *) Next;
  106. BASE_SHARED_STRING Name;
  107. BASE_SHARED_PTR(PINIFILE_MAPPING_VARNAME) VariableNames;
  108. BASE_SHARED_PTR(PINIFILE_MAPPING_VARNAME) DefaultVarNameMapping;
  109. } INIFILE_MAPPING_APPNAME, *PINIFILE_MAPPING_APPNAME;
  110. typedef CONST INIFILE_MAPPING_APPNAME* PCINIFILE_MAPPING_APPNAME;
  111. typedef struct _INIFILE_MAPPING_FILENAME {
  112. BASE_SHARED_PTR(struct _INIFILE_MAPPING_FILENAME *) Next;
  113. BASE_SHARED_STRING Name;
  114. BASE_SHARED_PTR(PINIFILE_MAPPING_APPNAME) ApplicationNames;
  115. BASE_SHARED_PTR(PINIFILE_MAPPING_APPNAME) DefaultAppNameMapping;
  116. } INIFILE_MAPPING_FILENAME, *PINIFILE_MAPPING_FILENAME;
  117. typedef CONST INIFILE_MAPPING_FILENAME* PCINIFILE_MAPPING_FILENAME;
  118. typedef struct _INIFILE_MAPPING {
  119. BASE_SHARED_PTR(PINIFILE_MAPPING_FILENAME) FileNames;
  120. BASE_SHARED_PTR(PINIFILE_MAPPING_FILENAME) DefaultFileNameMapping;
  121. BASE_SHARED_PTR(PINIFILE_MAPPING_FILENAME) WinIniFileMapping;
  122. ULONG Reserved;
  123. } INIFILE_MAPPING, *PINIFILE_MAPPING;
  124. typedef CONST INIFILE_MAPPING* PCINIFILE_MAPPING;
  125. //
  126. // NLS Information.
  127. //
  128. #define NLS_INVALID_INFO_CHAR 0xffff /* marks cache string as invalid */
  129. #define MAX_REG_VAL_SIZE 80 /* max size of registry value */
  130. #define NLS_CACHE_MUTANT_NAME L"NlsCacheMutant" /* Name of NLS mutant cache */
  131. typedef struct _NLS_USER_INFO {
  132. WCHAR sAbbrevLangName[MAX_REG_VAL_SIZE];
  133. WCHAR iCountry[MAX_REG_VAL_SIZE];
  134. WCHAR sCountry[MAX_REG_VAL_SIZE];
  135. WCHAR sList[MAX_REG_VAL_SIZE];
  136. WCHAR iMeasure[MAX_REG_VAL_SIZE];
  137. WCHAR iPaperSize[MAX_REG_VAL_SIZE];
  138. WCHAR sDecimal[MAX_REG_VAL_SIZE];
  139. WCHAR sThousand[MAX_REG_VAL_SIZE];
  140. WCHAR sGrouping[MAX_REG_VAL_SIZE];
  141. WCHAR iDigits[MAX_REG_VAL_SIZE];
  142. WCHAR iLZero[MAX_REG_VAL_SIZE];
  143. WCHAR iNegNumber[MAX_REG_VAL_SIZE];
  144. WCHAR sNativeDigits[MAX_REG_VAL_SIZE];
  145. WCHAR iDigitSubstitution[MAX_REG_VAL_SIZE];
  146. WCHAR sCurrency[MAX_REG_VAL_SIZE];
  147. WCHAR sMonDecSep[MAX_REG_VAL_SIZE];
  148. WCHAR sMonThouSep[MAX_REG_VAL_SIZE];
  149. WCHAR sMonGrouping[MAX_REG_VAL_SIZE];
  150. WCHAR iCurrDigits[MAX_REG_VAL_SIZE];
  151. WCHAR iCurrency[MAX_REG_VAL_SIZE];
  152. WCHAR iNegCurr[MAX_REG_VAL_SIZE];
  153. WCHAR sPosSign[MAX_REG_VAL_SIZE];
  154. WCHAR sNegSign[MAX_REG_VAL_SIZE];
  155. WCHAR sTimeFormat[MAX_REG_VAL_SIZE];
  156. WCHAR sTime[MAX_REG_VAL_SIZE];
  157. WCHAR iTime[MAX_REG_VAL_SIZE];
  158. WCHAR iTLZero[MAX_REG_VAL_SIZE];
  159. WCHAR iTimeMarkPosn[MAX_REG_VAL_SIZE];
  160. WCHAR s1159[MAX_REG_VAL_SIZE];
  161. WCHAR s2359[MAX_REG_VAL_SIZE];
  162. WCHAR sShortDate[MAX_REG_VAL_SIZE];
  163. WCHAR sDate[MAX_REG_VAL_SIZE];
  164. WCHAR iDate[MAX_REG_VAL_SIZE];
  165. WCHAR sYearMonth[MAX_REG_VAL_SIZE];
  166. WCHAR sLongDate[MAX_REG_VAL_SIZE];
  167. WCHAR iCalType[MAX_REG_VAL_SIZE];
  168. WCHAR iFirstDay[MAX_REG_VAL_SIZE];
  169. WCHAR iFirstWeek[MAX_REG_VAL_SIZE];
  170. WCHAR sLocale[MAX_REG_VAL_SIZE];
  171. LCID UserLocaleId;
  172. LUID InteractiveUserLuid;
  173. ULONG ulCacheUpdateCount;
  174. } NLS_USER_INFO, *PNLS_USER_INFO;
  175. typedef struct _BASE_STATIC_SERVER_DATA {
  176. BASE_SHARED_STRING WindowsDirectory;
  177. BASE_SHARED_STRING WindowsSystemDirectory;
  178. BASE_SHARED_STRING NamedObjectDirectory;
  179. USHORT WindowsMajorVersion;
  180. USHORT WindowsMinorVersion;
  181. USHORT BuildNumber;
  182. USHORT CSDNumber;
  183. USHORT RCNumber;
  184. WCHAR CSDVersion[ 128 ];
  185. #if (!defined(BUILD_WOW6432) && !defined(_WIN64))
  186. SYSTEM_BASIC_INFORMATION SysInfo;
  187. #endif
  188. SYSTEM_TIMEOFDAY_INFORMATION TimeOfDay;
  189. BASE_SHARED_PTR(PINIFILE_MAPPING) IniFileMapping;
  190. NLS_USER_INFO NlsUserInfo;
  191. BOOLEAN DefaultSeparateVDM;
  192. BOOLEAN ForceDos;
  193. BASE_SHARED_STRING WindowsSys32x86Directory;
  194. BOOLEAN fTermsrvAppInstallMode;
  195. TIME_ZONE_INFORMATION tziTermsrvClientTimeZone;
  196. KSYSTEM_TIME ktTermsrvClientBias;
  197. ULONG TermsrvClientTimeZoneId;
  198. BOOLEAN LUIDDeviceMapsEnabled;
  199. } BASE_STATIC_SERVER_DATA, *PBASE_STATIC_SERVER_DATA;
  200. //
  201. //Hydra Specific globals and prototypes
  202. //
  203. #define MAX_SESSION_PATH 256
  204. #define SESSION_ROOT L"\\Sessions"
  205. ULONG SessionId;
  206. #endif