Source code of Windows XP (NT5)
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.

125 lines
3.2 KiB

  1. /******************************************************************************
  2. *
  3. * Copyright (c) 1999 Microsoft Corporation
  4. *
  5. * Module Name:
  6. * hashlist.h
  7. *
  8. * Abstract:
  9. * This file contains the definitions for pathtree.
  10. *
  11. * Revision History:
  12. * Kanwaljit S Marok ( kmarok ) 05/17/99
  13. * created
  14. *
  15. *****************************************************************************/
  16. #ifndef _PATHTREE_H_
  17. #define _PATHTREE_H_
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #include "common.h"
  22. #define ALLVOLUMES_PATH_A "__ALLVOLUMES__"
  23. #define ALLVOLUMES_PATH_W L"__ALLVOLUMES__"
  24. #define ALLVOLUMES_PATH_T TEXT("__ALLVOLUMES__")
  25. #define TREEFLAGS_DISABLE_SUBTREE 0x00000001
  26. //
  27. // Tree specific structures.
  28. //
  29. typedef struct
  30. {
  31. //
  32. // Directory related stuff.
  33. //
  34. INT m_iFather ; // Index to the parent node
  35. INT m_iSon ; // Index to the first son
  36. INT m_iSibling ; // Index to next sibling
  37. DWORD m_dwData ; // Offset for node data
  38. DWORD m_dwFileList; // Offset for file list
  39. DWORD m_dwType ; // Node Type
  40. DWORD m_dwFlags ; // Misc flags
  41. } TreeNode;
  42. typedef struct
  43. {
  44. DEFINE_BLOB_HEADER(); // Define common blob members
  45. //
  46. // Tree related header stuff
  47. //
  48. DWORD m_dwMaxNodes ; // Max number of nodes allowed
  49. DWORD m_dwDataSize ; // Data section size
  50. DWORD m_dwDataOff ; // Current Data Offset
  51. INT m_iFreeNode ; // Next free node
  52. DWORD m_dwDefault ; // Default node type
  53. } TreeHeader;
  54. //
  55. // Tree Related Macros.
  56. //
  57. #define TREE_NODES(pTree) ( (TreeNode*) ((BYTE *)pTree+sizeof(TreeHeader)) )
  58. #define TREE_NODEPTR(pTree, iNode) ( TREE_NODES(pTree) + iNode)
  59. #define TREE_HEADER(pTree) ( (TreeHeader *) pTree )
  60. #define TREE_CURRDATAOFF(pTree) ( ((TreeHeader *)pTree)->m_dwDataOff )
  61. #define TREE_CURRDATAPTR(pTree) ( (BYTE *)pTree + TREE_CURRDATAOFF(pTree) )
  62. #define TREE_DATA(pTree) ( (BYTE *)TREE_NODES(pTree) + \
  63. (sizeof(TreeNode) * \
  64. TREE_HEADER(pTree)->m_dwMaxNodes) \
  65. )
  66. #define TREE_DATA_OFF(pTree) ( sizeof(TreeHeader) + \
  67. (sizeof(TreeNode) * \
  68. TREE_HEADER(pTree)->m_dwMaxNodes) \
  69. )
  70. #define TREE_DRIVENODE( pTree, iDrive ) \
  71. ( TREE_HEADER(pTree)->m_arrDrive[ iDrive ] )
  72. #define TREE_NODELISTOFF( pTree, iNode ) \
  73. TREE_NODEPTR( pTree, iNode )->m_dwFileList
  74. #define DRIVE_INDEX( drive ) ( drive - L'A' )
  75. #define TREE_ROOT_NODE 0 // Root node is always assigned as 0
  76. //
  77. // Function Prototypes.
  78. //
  79. BOOL
  80. MatchPrefix(
  81. BYTE * pTree,
  82. INT iParent,
  83. struct PathElement * ppElem ,
  84. INT * pNode,
  85. INT * pLevel,
  86. INT * pType,
  87. BOOL* pfDisable,
  88. BOOL* pfExactMatch
  89. );
  90. BOOL
  91. ConvertToParsedPath(
  92. LPWSTR lpszPath,
  93. USHORT nPathLen,
  94. PBYTE pPathBuf,
  95. WORD nPathSize
  96. );
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif _PATHTREE_H_