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.

139 lines
4.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: DIRSTK.CXX
  7. //
  8. // Contents: Directory entry stack
  9. //
  10. // History: 07-Aug-92 KyleP Added header
  11. //
  12. //--------------------------------------------------------------------------
  13. #include <pch.cxx>
  14. #pragma hdrstop
  15. #include <dirstk.hxx>
  16. //+-------------------------------------------------------------------------
  17. //
  18. // Member: CDirStackEntry::CDirStackEntry
  19. //
  20. // Synopsis: CDirStackEntry constructor
  21. //
  22. // Arguments: [str] -- Unicode string (null terminated) for path
  23. // [ccStr[ -- Size in chars of [str]
  24. // [numHighValue] -- numerator's high watermark
  25. // [numLowValue] -- numerator's low watermark
  26. // [fDeep] -- TRUE for additional dir recursion
  27. // [pwcsVRoot] -- Virtual root (or zero if none)
  28. // [ccVRoot] -- Size in chars of [pwcsVRoot]
  29. // [ccReplaceVRoot] -- Number of chars in phys root to replace
  30. //
  31. // History: 20-Jun-95 SitaramR Created
  32. // 11-Feb-96 KyleP Add support for virtual roots
  33. //
  34. //--------------------------------------------------------------------------
  35. CDirStackEntry::CDirStackEntry ( const CFunnyPath & funnyPath,
  36. ULONG numHighValue,
  37. ULONG numLowValue,
  38. BOOL fDeep,
  39. WCHAR const * pwcsVRoot,
  40. unsigned ccVRoot,
  41. unsigned ccReplacePRoot )
  42. : _numHighValue( numHighValue ),
  43. _numLowValue( numLowValue ),
  44. _fDeep( fDeep ),
  45. _xwcsVirtualRoot( 0 )
  46. {
  47. _funnyPath = funnyPath;
  48. if ( 0 != pwcsVRoot )
  49. {
  50. _ccVirtualRoot = ccVRoot;
  51. _ccReplacePhysRoot = ccReplacePRoot;
  52. _xwcsVirtualRoot.Set( new WCHAR[_ccVirtualRoot] );
  53. RtlCopyMemory( _xwcsVirtualRoot.GetPointer(), pwcsVRoot,
  54. _ccVirtualRoot * sizeof(WCHAR) );
  55. }
  56. }
  57. CDirStackEntry::CDirStackEntry ( const WCHAR * pwcPath,
  58. unsigned ccStr,
  59. ULONG numHighValue,
  60. ULONG numLowValue,
  61. BOOL fDeep,
  62. WCHAR const * pwcsVRoot,
  63. unsigned ccVRoot,
  64. unsigned ccReplacePRoot )
  65. : _numHighValue( numHighValue ),
  66. _numLowValue( numLowValue ),
  67. _fDeep( fDeep ),
  68. _xwcsVirtualRoot( 0 )
  69. {
  70. _funnyPath.SetPath( pwcPath, ccStr );
  71. if ( 0 != pwcsVRoot )
  72. {
  73. _ccVirtualRoot = ccVRoot;
  74. _ccReplacePhysRoot = ccReplacePRoot;
  75. _xwcsVirtualRoot.Set( new WCHAR[_ccVirtualRoot] );
  76. RtlCopyMemory( _xwcsVirtualRoot.GetPointer(), pwcsVRoot,
  77. _ccVirtualRoot * sizeof(WCHAR) );
  78. }
  79. }
  80. //+-------------------------------------------------------------------------
  81. //
  82. // Member: CDirStackEntry::CDirStackEntry
  83. //
  84. // Synopsis: CDirStackEntry constructor
  85. //
  86. // Arguments: [path] -- Nt string of path sans final directory name
  87. // [name] -- Nt string of final directory name
  88. // [numHighValue] -- numerator's high watermark
  89. // [numLowValue] -- numerator's low watermark
  90. // [fDeep] -- TRUE for additional dir recursion
  91. // [pParent] -- Parent of this scope (for virtual root copy)
  92. //
  93. // History: 20-Jun-95 SitaramR Created
  94. //
  95. //--------------------------------------------------------------------------
  96. CDirStackEntry::CDirStackEntry ( UNICODE_STRING const * path,
  97. UNICODE_STRING const * name,
  98. ULONG numHighValue,
  99. ULONG numLowValue,
  100. BOOL fDeep,
  101. CDirStackEntry * pParent )
  102. : _numHighValue( numHighValue ),
  103. _numLowValue( numLowValue ),
  104. _fDeep( fDeep ),
  105. _xwcsVirtualRoot( 0 )
  106. {
  107. //
  108. // Copy physical path
  109. //
  110. WCHAR* pwcsActualFileName;
  111. _funnyPath.SetPath( path->Buffer, path->Length/sizeof(WCHAR) );
  112. _funnyPath.AppendBackSlash();
  113. _funnyPath.AppendPath( name->Buffer, name->Length/sizeof(WCHAR) );
  114. if ( 0 != pParent && 0 != pParent->GetVirtualRoot() )
  115. {
  116. _ccVirtualRoot = pParent->VirtualRootLength();
  117. _ccReplacePhysRoot = pParent->ReplaceLength();
  118. _xwcsVirtualRoot.Set( new WCHAR[_ccVirtualRoot] );
  119. RtlCopyMemory( _xwcsVirtualRoot.GetPointer(),
  120. pParent->GetVirtualRoot(), _ccVirtualRoot * sizeof(WCHAR) );
  121. }
  122. }