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.

161 lines
4.2 KiB

  1. // from base\ntos\rtl\ntrtlp.h
  2. /*++
  3. Copyright (c) 1989 Microsoft Corporation
  4. Module Name:
  5. ntrtlp.h
  6. Abstract:
  7. Include file for NT runtime routines that are callable by both
  8. kernel mode code in the executive and user mode code in various
  9. NT subsystems, but which are private interfaces.
  10. Author:
  11. David N. Cutler (davec) 15-Aug-1989
  12. Environment:
  13. These routines are dynamically linked in the caller's executable and
  14. are callable in either kernel mode or user mode.
  15. Revision History:
  16. --*/
  17. #ifndef _NTRTLP_
  18. #define _NTRTLP_
  19. #include <ntos.h>
  20. #include <nturtl.h>
  21. #include <zwapi.h>
  22. #include <sxstypes.h>
  23. //#if defined(_AMD64_)
  24. //#include "amd64\ntrtlamd64.h"
  25. //#elif defined(_X86_)
  26. //#include "i386\ntrtl386.h"
  27. //#elif defined(_IA64_)
  28. //#include "ia64\ntrtli64.h"
  29. //#else
  30. //#error "no target architecture"
  31. //#endif
  32. #ifdef BLDR_KERNEL_RUNTIME
  33. #undef try
  34. #define try if(1)
  35. #undef except
  36. #define except(a) else if (0)
  37. #undef finally
  38. #define finally if (1)
  39. #undef GetExceptionCode
  40. #define GetExceptionCode() 1
  41. #define finally if (1)
  42. #endif
  43. #include "string.h"
  44. #include "wchar.h"
  45. #define NUMBER_OF(x) (sizeof(x) / sizeof((x)[0]))
  46. #if !defined(NTOS_KERNEL_RUNTIME) && !defined(BLDR_KERNEL_RUNTIME)
  47. #if DBG
  48. PCUNICODE_STRING RtlpGetImagePathName(VOID);
  49. #define RtlpGetCurrentProcessId() (HandleToUlong(NtCurrentTeb()->ClientId.UniqueProcess))
  50. #define RtlpGetCurrentThreadId() (HandleToUlong(NtCurrentTeb()->ClientId.UniqueThread))
  51. #endif
  52. #endif
  53. #define RTLP_GOOD_DOS_ROOT_PATH 0
  54. #define RTLP_BAD_DOS_ROOT_PATH_WIN32NT_PREFIX 1 /* \\?\ */
  55. #define RTLP_BAD_DOS_ROOT_PATH_WIN32NT_UNC_PREFIX 2 /* \\?\unc */
  56. #define RTLP_BAD_DOS_ROOT_PATH_NT_PATH 3 /* \??\, this is only rough */
  57. #define RTLP_BAD_DOS_ROOT_PATH_MACHINE_NO_SHARE 4 /* \\machine or \\?\unc\machine */
  58. CONST CHAR*
  59. RtlpDbgBadDosRootPathTypeToString(
  60. IN ULONG Flags,
  61. IN ULONG RootType
  62. );
  63. NTSTATUS
  64. RtlpCheckForBadDosRootPath(
  65. IN ULONG Flags,
  66. IN PCUNICODE_STRING RootString,
  67. OUT ULONG* RootType
  68. );
  69. NTSTATUS
  70. NTAPI
  71. RtlpBadDosRootPathToEmptyString(
  72. IN ULONG Flags,
  73. IN OUT PUNICODE_STRING Path
  74. );
  75. #define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_IN_FLAG_OLD (0x00000010)
  76. //
  77. // This bit means to do extra validation on \\? paths, to reject \\?\a\b,
  78. // To only allow \\? followed by the documented forms \\?\unc\foo and \\?\c:
  79. //
  80. #define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_IN_FLAG_STRICT_WIN32NT (0x00000020)
  81. #define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_OUT_TYPE_MASK (0x0000000F)
  82. //
  83. // These bits add more information to RtlPathTypeUncAbsolute, which is what \\?
  84. // is reported as.
  85. //
  86. //
  87. // The path starts "\\?".
  88. //
  89. #define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_OUT_FLAG_WIN32NT (0x00000010)
  90. //
  91. // The path starts "\\?\x:".
  92. //
  93. #define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_OUT_FLAG_WIN32NT_DRIVE_ABSOLUTE (0x00000020)
  94. //
  95. // The path starts "\\?\unc".
  96. //
  97. #define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_OUT_FLAG_WIN32NT_UNC_ABSOLUTE (0x00000040)
  98. //
  99. //future this would indicate \\machine instead of \\machine\share
  100. //define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_OUT_FLAG_WIN32NT_UNC_MACHINE_ONLY (0x00000080)
  101. //future this would indicate \\ or \\?\unc
  102. //define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_OUT_FLAG_WIN32NT_UNC_EMPTY (0x00000100)
  103. //
  104. //
  105. // So far, this means something like \\?\a was seen, instead of \\?\unc or \\?\a:
  106. // You have to request it with RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_IN_FLAG_STRICT_WIN32NT.
  107. //
  108. #define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_OUT_FLAG_INVALID (0x00000200)
  109. //
  110. // stuff like \\ \\? \\?\unc \\?\unc\
  111. //
  112. #define RTLP_DETERMINE_DOS_PATH_NAME_TYPE_EX_OUT_FLAG_INCOMPLETE_ROOT (0x00000400)
  113. NTSTATUS
  114. NTAPI
  115. RtlpDetermineDosPathNameTypeEx(
  116. IN ULONG InFlags,
  117. IN PCUNICODE_STRING DosPath,
  118. OUT RTL_PATH_TYPE* OutType,
  119. OUT ULONG* OutFlags
  120. );
  121. #define RTLP_IMPLIES(x,y) ((x) ? (y) : TRUE)
  122. #endif // _NTRTLP_