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.

241 lines
9.3 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. metabase.hxx
  5. Abstract:
  6. IIS MetaBase defines and declarations.
  7. Author:
  8. Michael W. Thomas 17-May-96
  9. Revision History:
  10. --*/
  11. #ifndef _metabase_
  12. #define _metabase_
  13. #ifdef UNICODE
  14. #define MD_STRCPY(dest,src) wcscpy(dest,src)
  15. #define MD_STRCMP(p1,p2) wcscmp(p1,p2)
  16. #define MD_STRNCMP(p1,p2,count) wcsncmp(p1,p2,count)
  17. #define MD_STRNCPY(p1,p2,count) wcsncpy(p1,p2,count)
  18. #define MD_STRLEN(p) wcslen(p)
  19. #define MD_SPRINTF swprintf
  20. #define MD_STRCAT(dest,src) wcscat(dest,src)
  21. #define MD_ISDIGIT(c) iswdigit(c)
  22. #else
  23. #define MD_STRCPY(dest,src) strcpy(dest,src)
  24. #define MD_STRCMP(p1,p2) strcmp(p1,p2)
  25. #define MD_STRICMP(p1,p2) lstrcmpi(p1,p2)
  26. #define MD_STRNICMP(p1,p2,count) _mbsnicmp((PUCHAR)p1,(PUCHAR)p2,count)
  27. #define MD_STRNCPY(p1,p2,count) strncpy((PUCHAR)p1,(PUCHAR)p2,count)
  28. #define MD_STRLEN(p) _mbslen((PUCHAR)p)
  29. #define MD_STRBYTES(p) strlen(p)
  30. #define MD_SPRINTF wsprintf
  31. #define MD_STRCAT(dest,src) strcat(dest,src)
  32. #define MD_ISDIGIT(c) isdigit((UCHAR)(c))
  33. #define MD_STRCHR(str, c) _mbschr((const UCHAR *)(str), c)
  34. #define MD_STRSTR(str1, str2) (LPSTR)_mbsstr((const UCHAR *)(str1), (const UCHAR *)(str2))
  35. #endif
  36. #ifdef _X86_
  37. #define MD_ALIGN_ADJUST(p) 0
  38. #else
  39. #define MD_ALIGN_ADJUST(p) (PtrToUlong(p) % 4)
  40. #endif
  41. #define MD_COPY(dest,src,length) memcpy(dest,src,length)
  42. #define MD_CMP(dest,src,length) memcmp(dest,src,length)
  43. #define MD_ASSERT(p) DBG_ASSERT(p)
  44. #define MD_REQUIRE(p) DBG_REQUIRE(p)
  45. #define LESSOROF(p1,p2) ((p1) < (p2)) ? (p1) : (p2)
  46. #define GREATEROF(p1,p2) ((p1) > (p2)) ? (p1) : (p2)
  47. enum METADATA_IDS {
  48. MD_ID_NONE,
  49. MD_ID_OBJECT,
  50. MD_ID_ROOT_OBJECT,
  51. MD_ID_DATA,
  52. MD_ID_REFERENCE,
  53. MD_ID_CHANGE_NUMBER,
  54. MD_ID_MAJOR_VERSION_NUMBER,
  55. MD_ID_MINOR_VERSION_NUMBER,
  56. MD_ID_SESSION_KEY
  57. };
  58. #define MD_OBJECT_ID_STRING TEXT("OBJECT")
  59. #define MD_ROOT_OBJECT_ID_STRING TEXT("MASTERROOTOBJECT")
  60. #define MD_DATA_ID_STRING TEXT("DATA")
  61. #define MD_REFERENCE_ID_STRING TEXT("REFERENCE")
  62. #define MD_CHANGE_NUMBER_ID_STRING TEXT("CHANGENUMBER")
  63. #define MD_MAJOR_VERSION_NUMBER_ID_STRING TEXT("MAJORVERSIONNUMBER")
  64. #define MD_MINOR_VERSION_NUMBER_ID_STRING TEXT("MINORVERSIONNUMBER")
  65. #define MD_SESSION_KEY_ID_STRING TEXT("SESSIONKEY")
  66. #define MD_SIGNATURE_ID_STRING TEXT("METADATA_SIGNATURE")
  67. #define MD_BLANK_NAME_ID_STRING TEXT("NONAME")
  68. #define MD_BLANK_PSEUDO_NAME TEXT(")*(&%^BLANK_NAME!$@%#^")
  69. #define MD_TIMESTAMP_ID_STRING TEXT("TIMESTAMP")
  70. #define MD_DT_SUFFIX TEXT("_DATATYPE")
  71. #define MD_UT_SUFFIX TEXT("_USERTYPE")
  72. #define MD_ATTR_SUFFIX TEXT("_ATTR")
  73. #define MD_TERMINATE_BYTE 0xfd
  74. #define MD_ESCAPE_BYTE 0xfe
  75. #define NEEDS_ESCAPE(c) ((c) == MD_ESCAPE_BYTE)
  76. #define FIRSTDATAPTR(pbufLine) ((PBYTE)pbufLine->QueryPtr() + 1)
  77. #define DATAOBJECTBASESIZE (1 + (4 * sizeof(DWORD)))
  78. #define BASEMETAOBJECTLENGTH (1 + sizeof(FILETIME))
  79. #define MD_MAX_PATH_LEN 4096
  80. #define MD_MAX_WHITE_SPACE 20
  81. #define MD_MAX_DWORD_STRING 10
  82. #define MD_UUENCODE_FACTOR 2
  83. #define MD_MASTER_ROOT_NAME TEXT("MasterRoot")
  84. #define MD_DEFAULT_DLL_FILE_NAME TEXT("metadata.dll")
  85. #define MD_DEFAULT_DATA_FILE_NAME TEXT("MetaBase.xml")
  86. #define MD_DEFAULT_DATA_FILE_NAMEW L"MetaBase.xml"
  87. #define MD_SCHEMA_FILE_NAME TEXT("MBSchema.xml")
  88. #define MD_HISTORY_FILE_SUBDIRW L"History\\"
  89. #define MD_CCH_HISTORY_FILE_SUBDIRW ((sizeof(MD_HISTORY_FILE_SUBDIRW)/sizeof(WCHAR))-1)
  90. #define MD_SCHEMA_EXTENSION_FILE_NAMEW L"MBSchExt.xml"
  91. #define MD_CCH_SCHEMA_EXTENSION_FILE_NAMEW ((sizeof(MD_SCHEMA_EXTENSION_FILE_NAMEW)/sizeof(WCHAR))-1)
  92. #define MD_HISTORY_FILE_SEARCH_EXTENSIONW L"_??????????_??????????"
  93. #define MD_CCH_HISTORY_FILE_SEARCH_EXTENSIONW ((sizeof(MD_HISTORY_FILE_SEARCH_EXTENSIONW)/sizeof(WCHAR))-1)
  94. #define MD_ERROR_FILE_NAME_EXTENSIONW L"Error"
  95. #define MD_CCH_ERROR_FILE_NAME_EXTENSIONW ((sizeof(MD_ERROR_FILE_NAME_EXTENSIONW)/sizeof(WCHAR))-1)
  96. #define MD_ERROR_FILE_SEARCH_EXTENSIONW L"_??????????"
  97. #define MD_CCH_ERROR_FILE_SEARCH_EXTENSIONW ((sizeof(MD_ERROR_FILE_SEARCH_EXTENSIONW)/sizeof(WCHAR))-1)
  98. #define MD_TEMP_DATA_FILE_EXT TEXT(".tmp")
  99. #define MD_TEMP_DATA_FILE_EXTW L".tmp"
  100. #define MD_BACKUP_DATA_FILE_EXT TEXT(".bak")
  101. #define MD_DEFAULT_BACKUP_PATH_NAME TEXT("MetaBack")
  102. #define MD_SCHEMA_SUFFIX TEXT(".SC")
  103. #define MD_BACKUP_SUFFIX TEXT(".MD")
  104. #define MD_BACKUP_SUFFIXW L".MD"
  105. #define MD_BACKUP_INVALID_CHARS_W L"/\\*.?\"&!@#$%^()=+|`~"
  106. #define MD_BACKUP_INVALID_CHARS_A "/\\*.?\"&!@#$%^()=+|`~"
  107. #define SETUP_REG_KEY TEXT("SOFTWARE\\Microsoft\\InetStp")
  108. #define INSTALL_PATH_VALUE TEXT("InstallPath")
  109. #define MD_UNSECUREDREAD_VALUE TEXT("MetabaseUnSecuredRead")
  110. #define MD_SETMAJORVERSION_VALUE TEXT("MetabaseSetMajorVersion")
  111. #define MD_SETMINORVERSION_VALUE TEXT("MetabaseSetMinorVersion")
  112. #define MD_CURRENT_INSTALL_STATE TEXT("CurrentInstallState")
  113. #define MD_INSTALL_STATE_INSTALLING 0x00000001
  114. #define MD_PATH_DELIMETER MD_PATH_DELIMETERA
  115. #define MD_ALT_PATH_DELIMETER MD_ALT_PATH_DELIMETERA
  116. #define MD_PATH_DELIMETERA (CHAR)'/'
  117. #define MD_ALT_PATH_DELIMETERA (CHAR)'\\'
  118. #define MD_PATH_DELIMETERW (WCHAR)'/'
  119. #define MD_ALT_PATH_DELIMETERW (WCHAR)'\\'
  120. #define MD_DEFAULT_HISTORY_MAJOR_NUM_DIGITS 10
  121. #define MD_DEFAULT_HISTORY_MINOR_NUM_DIGITS 10
  122. #define SKIP_DELIMETER(p1,p2) if (*p1 == p2) p1++;
  123. #define SKIP_PATH_DELIMETER(p1) SKIP_PATH_DELIMETERA(p1)
  124. #define SKIP_PATH_DELIMETERA(p1) if ((*(LPSTR)p1 == MD_PATH_DELIMETERA) || (*(LPSTR)p1 == MD_ALT_PATH_DELIMETERA)) {(LPSTR)p1++;}
  125. #define SKIP_PATH_DELIMETERW(p1) if ((*(LPWSTR)p1 == MD_PATH_DELIMETERW) || (*(LPWSTR)p1 == MD_ALT_PATH_DELIMETERW)) {((LPWSTR)p1)++;}
  126. //#define MD_BINARY_STRING TEXT("BINARY")
  127. //#define MD_STRING_STRING TEXT("STRING")
  128. //#define MD_DWORD_STRING TEXT("DWORD")
  129. //#define MD_INHERIT_STRING TEXT("INHERIT")
  130. #define MD_SIGNATURE_STRINGA "*&$MetaData$&*"
  131. #define MD_SIGNATURE_STRINGW L##"*&$MetaData$&*"
  132. // iis4=1
  133. // iis5=2
  134. // iis5.1=2
  135. #define MD_MAJOR_VERSION_NUMBER 2
  136. // iis4=0
  137. // iis5=0
  138. // iis5.1=1
  139. #define MD_MINOR_VERSION_NUMBER 1
  140. #define METADATA_MAX_STRING_LEN 4096
  141. #define MAX_RECORD_BUFFER 1024
  142. #define READWRITE_BUFFER_LENGTH 128 * 1024
  143. #define EVENT_ARRAY_LENGTH 2
  144. #define EVENT_READ_INDEX 0
  145. #define EVENT_WRITE_INDEX 1
  146. #define OPEN_WAIT_INTERVAL 1000
  147. #define DATA_HASH_TABLE_LEN 67
  148. #define DATA_HASH(ID) ((ID) % DATA_HASH_TABLE_LEN)
  149. #define MD_SHUTDOWN_WAIT_SECONDS 7
  150. enum MD_SINK_ROUTINES {
  151. MD_SINK_MAIN,
  152. MD_SINK_SHUTDOWN,
  153. MD_SINK_EVENT
  154. };
  155. #define MD_XML_SCHEMA_TIMESTAMPW L"XMLSchemaTimeStamp"
  156. #define MD_BIN_SCHEMA_TIMESTAMPW L"BINSchemaTimeStamp"
  157. #define MD_GLOBAL_LOCATIONW L"."
  158. #define MD_EDIT_WHILE_RUNNING_MAJOR_VERSION_NUMBERW L"HistoryMajorVersionNumber"
  159. #define MD_EDIT_WHILE_RUNNING_TEMP_DATA_FILE_NAMEW L"EditWhileRunning_Metabase.xml"
  160. #define MD_EDIT_WHILE_RUNNING_TEMP_SCHEMA_FILE_NAMEW L"EditWhileRunning_MBSchema.xml"
  161. #define MD_SESSION_KEYW L"SessionKey"
  162. #define MD_ENABLE_EDIT_WHILE_RUNNINGW L"EnableEditWhileRunning"
  163. #define MD_ENABLE_HISTORYW L"EnableHistory"
  164. #define MD_MAX_HISTORY_FILESW L"MaxHistoryFiles"
  165. #define MD_CHANGE_NUMBERW L"ChangeNumber"
  166. #define MD_MAX_ERROR_FILESW L"MaxErrorFiles"
  167. #define MD_GLOBAL_LOCATIONW L"."
  168. #define MD_CH_LOC_NO_PROPERTYW L'#'
  169. #define MD_COUNT_MAX_HISTORY_FILES 10
  170. #define MD_MAX_HISTORY_FILES_ALLOC_SIZE 20 // Max allocations
  171. #define MD_COUNT_MAX_ERROR_FILES 10
  172. #define MD_MAX_CHILD_OBJECTS 8
  173. #define MD_LONG_STRING_PREFIXW L"\\\\?\\"
  174. #define MD_CCH_LONG_STRING_PREFIXW ((sizeof(MD_LONG_STRING_PREFIXW)/sizeof(WCHAR))-1)
  175. #define MD_CCH_MAX_ULONG 10
  176. #define MD_CH_EXTN_SEPERATORW L'.'
  177. #define MD_CH_UNDERSCOREW L'_'
  178. #define MD_UNDERSCOREW L"_"
  179. #define MD_CCH_UNDERSCOREW ((sizeof(MD_UNDERSCOREW)/sizeof(WCHAR))-1)
  180. typedef struct _METABASE_FILE_DATA
  181. {
  182. ULONG ulVersionMinor;
  183. ULONG ulVersionMajor;
  184. FILETIME ftLastWriteTime;
  185. }METABASE_FILE_DATA;
  186. #endif