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.

106 lines
2.5 KiB

  1. #pragma once
  2. #define IS_PATH_SEPARATOR_U(ch) ((ch == L'\\') || (ch == L'/'))
  3. inline BOOL
  4. SxspIsSListEmpty(
  5. IN const SLIST_HEADER* ListHead
  6. )
  7. {
  8. #if _NTSLIST_DIRECT_
  9. return FirstEntrySList(ListHead) == NULL;
  10. #else
  11. return RtlFirstEntrySList(ListHead) == NULL;
  12. #endif
  13. }
  14. inline VOID
  15. SxspInitializeSListHead(
  16. IN PSLIST_HEADER ListHead
  17. )
  18. {
  19. RtlInitializeSListHead(ListHead);
  20. }
  21. inline PSLIST_ENTRY
  22. SxspPopEntrySList(
  23. IN PSLIST_HEADER ListHead
  24. )
  25. {
  26. return RtlInterlockedPopEntrySList(ListHead);
  27. }
  28. inline PSLIST_ENTRY
  29. SxspInterlockedPopEntrySList(
  30. IN PSLIST_HEADER ListHead
  31. )
  32. {
  33. return RtlInterlockedPopEntrySList(ListHead);
  34. }
  35. inline PSLIST_ENTRY
  36. SxspInterlockedPushEntrySList(
  37. IN PSLIST_HEADER ListHead,
  38. IN PSLIST_ENTRY ListEntry
  39. )
  40. {
  41. return RtlInterlockedPushEntrySList(ListHead, ListEntry);
  42. }
  43. inline RTL_PATH_TYPE
  44. SxspDetermineDosPathNameType(
  45. PCWSTR DosFileName
  46. )
  47. // RtlDetermineDosPathNameType_U is a bit wacky..
  48. {
  49. if ( DosFileName[0] == '\\'
  50. && DosFileName[1] == '\\'
  51. && DosFileName[2] == '?'
  52. && DosFileName[3] == '\\'
  53. )
  54. {
  55. /*
  56. NTRAID#NTBUG9-591192-2002/03/31-JayKrell
  57. path parsing issues, case mapping of "unc"
  58. */
  59. if ( (DosFileName[4] == 'u' || DosFileName[4] == 'U')
  60. && (DosFileName[5] == 'n' || DosFileName[5] == 'N')
  61. && (DosFileName[6] == 'c' || DosFileName[6] == 'C')
  62. && DosFileName[7] == '\\'
  63. )
  64. {
  65. return RtlPathTypeUncAbsolute;
  66. }
  67. if (DosFileName[4] != 0
  68. && DosFileName[5] == ':'
  69. && DosFileName[6] == '\\'
  70. )
  71. {
  72. return RtlPathTypeDriveAbsolute;
  73. }
  74. }
  75. #if FUSION_WIN
  76. return RtlDetermineDosPathNameType_U(DosFileName);
  77. #else
  78. /*
  79. NTRAID#NTBUG9-591192-2002/03/31-JayKrell
  80. path parsing issues, I'm pretty sure when this code was in
  81. unconditionally, that the FUSION_WIN build was busted..but maybe
  82. it's actually ok now...of course this code gets no testing..
  83. */
  84. if ( IS_PATH_SEPARATOR_U(DosFileName[0])
  85. && IS_PATH_SEPARATOR_U(DosFileName[1])
  86. )
  87. {
  88. return RtlPathTypeUncAbsolute;
  89. }
  90. if (DosFileName[0] != 0
  91. && DosFileName[1] == ':'
  92. && IS_PATH_SEPARATOR_U(DosFileName[2])
  93. )
  94. {
  95. return RtlPathTypeDriveAbsolute;
  96. }
  97. return RtlPathTypeRelative;
  98. #endif
  99. }