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.

230 lines
9.9 KiB

  1. //
  2. // Define flags and specific dump routines for the UDFR/W structures
  3. //
  4. #include "pch.h"
  5. #ifdef UDFS_RW_IN_BUILD
  6. #include "fatkd.h"
  7. #include "..\..\udfsrw\nodetype.h"
  8. #include "..\..\udfsrw\udf.h"
  9. #include "..\..\udfsrw\udfstruc.h"
  10. #include "..\..\udfsrw\udfdata.h"
  11. #include "udfskd.h"
  12. STATE UdfScbFlags[] = {
  13. { SCB_STATE_INITIALIZED, SCB_STATE_INITIALIZED, "Init"},
  14. { SCB_STATE_EMBEDDED_DATA, SCB_STATE_EMBEDDED_DATA, "Embedded"},
  15. { SCB_STATE_MCB_INITIALIZED, SCB_STATE_MCB_INITIALIZED, "MCBInit"},
  16. { SCB_STATE_STREAM_DIRECTORY, SCB_STATE_STREAM_DIRECTORY, "StreamDirectory"},
  17. { SCB_STATE_SECONDARY_STREAM, SCB_STATE_SECONDARY_STREAM, "SecondaryStream"},
  18. { SCB_STATE_SYSTEM_STREAM, SCB_STATE_SYSTEM_STREAM, "SystemStream"},
  19. { SCB_STATE_IN_SCB_TABLE, SCB_STATE_IN_SCB_TABLE, "InSCBTable"},
  20. { SCB_STATE_VMCB_MAPPING, SCB_STATE_VMCB_MAPPING, "VMCB"},
  21. { SCB_STATE_TEMPORARY, SCB_STATE_TEMPORARY, "Temp"},
  22. { SCB_STATE_DELETED, SCB_STATE_DELETED, "Deleted"},
  23. { SCB_STATE_TRUNCATE_ON_CLOSE, SCB_STATE_TRUNCATE_ON_CLOSE, "TruncateOnClose"},
  24. { SCB_STATE_NON_RELOCATABLE, SCB_STATE_NON_RELOCATABLE, "NonRelocatable"},
  25. { SCB_STATE_EXTENDED_FE, SCB_STATE_EXTENDED_FE, "ExtendedFE"},
  26. { SCB_STATE_SPARSE, SCB_STATE_SPARSE, "Sparse"},
  27. { SCB_STATE_MCB_ANR_INITIALIZED, SCB_STATE_MCB_ANR_INITIALIZED, "ANRMCBInit"},
  28. { SCB_STATE_UPDATE_TIMESTAMPS, SCB_STATE_UPDATE_TIMESTAMPS, "UpdateTimestamps"},
  29. { SCB_STATE_ALLOW_ONEGIG_WORKAROUND, SCB_STATE_ALLOW_ONEGIG_WORKAROUND, "OneGigWorkaround"},
  30. { SCB_STATE_DE_EMBED_IN_PROGRESS, SCB_STATE_DE_EMBED_IN_PROGRESS,"DeEmbedInProgress"},
  31. { SCB_STATE_LONG_ADS, SCB_STATE_LONG_ADS, "LongADs"},
  32. { SCB_STATE_FILE_DATA_MODIFIED, SCB_STATE_FILE_DATA_MODIFIED, "FileDataModified"},
  33. { SCB_STATE_MAINTAIN_SHORT_NAMES, SCB_STATE_MAINTAIN_SHORT_NAMES,"ShortNameTree"},
  34. { SCB_STATE_DASD_STREAM, SCB_STATE_DASD_STREAM, "DASD"},
  35. { 0 }
  36. };
  37. STATE UdfRwCcbFlags[] = {
  38. { CCB_FLAG_OPEN_BY_ID, CCB_FLAG_OPEN_BY_ID, "OpenById"},
  39. { CCB_FLAG_OPEN_RELATIVE_BY_ID, CCB_FLAG_OPEN_RELATIVE_BY_ID, "OpenRelById"},
  40. { CCB_FLAG_IGNORE_CASE, CCB_FLAG_IGNORE_CASE, "IgnoreCase"},
  41. { CCB_FLAG_DISMOUNT_ON_CLOSE, CCB_FLAG_DISMOUNT_ON_CLOSE, "DismountOnClose"},
  42. { CCB_FLAG_ALLOW_EXTENDED_DASD_IO, CCB_FLAG_ALLOW_EXTENDED_DASD_IO, "ExtendedDASD"},
  43. { CCB_FLAG_DELETE_ON_CLOSE, CCB_FLAG_DELETE_ON_CLOSE, "DeleteOnClose"},
  44. { CCB_FLAG_READ_ONLY, CCB_FLAG_READ_ONLY, "ReadOnly"},
  45. { CCB_FLAG_OPEN_BY_SHORT_NAME, CCB_FLAG_OPEN_BY_SHORT_NAME, "ShortNameOpen"},
  46. { CCB_FLAG_ENUM_NAME_EXP_HAS_WILD, CCB_FLAG_ENUM_NAME_EXP_HAS_WILD, "EnumNameHasWild"},
  47. { CCB_FLAG_ENUM_MATCH_ALL, CCB_FLAG_ENUM_MATCH_ALL, "EnumMatchAll"},
  48. { CCB_FLAG_ENUM_RETURN_NEXT, CCB_FLAG_ENUM_RETURN_NEXT, "EnumReturnNext"},
  49. { CCB_FLAG_ENUM_INITIALIZED, CCB_FLAG_ENUM_INITIALIZED, "EnumInitialised"},
  50. { CCB_FLAG_ENUM_NOMATCH_CONSTANT_ENTRY, CCB_FLAG_ENUM_NOMATCH_CONSTANT_ENTRY, "NoMatchConstantEntry"},
  51. { 0 }
  52. };
  53. STATE UdfRwIrpContextFlags[] = {
  54. { IRP_CONTEXT_FLAG_ON_STACK, IRP_CONTEXT_FLAG_ON_STACK, "OnStack"},
  55. { IRP_CONTEXT_FLAG_MORE_PROCESSING, IRP_CONTEXT_FLAG_MORE_PROCESSING, "MoreProcessing"},
  56. { IRP_CONTEXT_FLAG_FORCE_POST, IRP_CONTEXT_FLAG_FORCE_POST, "ForcePost"},
  57. { IRP_CONTEXT_FLAG_WAIT, IRP_CONTEXT_FLAG_WAIT, "Wait"},
  58. { IRP_CONTEXT_FLAG_TOP_LEVEL, IRP_CONTEXT_FLAG_TOP_LEVEL, "TopLevel"},
  59. { IRP_CONTEXT_FLAG_TOP_LEVEL_UDFS, IRP_CONTEXT_FLAG_TOP_LEVEL_UDFS, "TopLevelUdfs"},
  60. { IRP_CONTEXT_FLAG_IN_TEARDOWN, IRP_CONTEXT_FLAG_IN_TEARDOWN, "InTeardown"},
  61. { IRP_CONTEXT_FLAG_ALLOC_IO, IRP_CONTEXT_FLAG_ALLOC_IO, "AllocIo"},
  62. { IRP_CONTEXT_FLAG_DISABLE_POPUPS, IRP_CONTEXT_FLAG_DISABLE_POPUPS, "DisablePopups"},
  63. { IRP_CONTEXT_FLAG_IN_FSP, IRP_CONTEXT_FLAG_IN_FSP, "InFsp"},
  64. { IRP_CONTEXT_FLAG_FULL_NAME, IRP_CONTEXT_FLAG_FULL_NAME, "FullName"},
  65. { IRP_CONTEXT_FLAG_TRAIL_BACKSLASH, IRP_CONTEXT_FLAG_TRAIL_BACKSLASH, "TrailBackslash"},
  66. { IRP_CONTEXT_FLAG_DEFERRED_WRITE, IRP_CONTEXT_FLAG_DEFERRED_WRITE, "DeferredWrite"},
  67. { 0 }
  68. };
  69. STATE UdfRwVcbStateFlags[] = {
  70. { VCB_STATE_REMOVABLE_MEDIA, VCB_STATE_REMOVABLE_MEDIA, "Removable"},
  71. { VCB_STATE_LOCKED, VCB_STATE_LOCKED, "Locked"},
  72. { VCB_STATE_NOTIFY_REMOUNT, VCB_STATE_NOTIFY_REMOUNT, "NotifyRemount"},
  73. { VCB_STATE_METHOD_2_FIXUP, VCB_STATE_METHOD_2_FIXUP, "Method2Fixup"},
  74. { VCB_STATE_READ_ONLY, VCB_STATE_READ_ONLY, "ReadOnly"},
  75. { VCB_STATE_MOUNTED_DIRTY, VCB_STATE_MOUNTED_DIRTY, "MountedDirty"},
  76. { VCB_STATE_BITMAP_INIT, VCB_STATE_BITMAP_INIT, "BitmapInit"},
  77. { VCB_STATE_MEDIA_WRITE_PROTECT, VCB_STATE_MEDIA_WRITE_PROTECT, "WriteProtect"},
  78. { VCB_STATE_ECC_ALIGN, VCB_STATE_ECC_ALIGN, "ECCAlign"},
  79. { VCB_STATE_VMCB_INIT, VCB_STATE_VMCB_INIT, "VMCBInit"},
  80. { VCB_STATE_RMW_INIT, VCB_STATE_RMW_INIT, "RMW_Init"},
  81. { VCB_STATE_SEQ_CACHE_INIT, VCB_STATE_SEQ_CACHE_INIT, "SeqCacheInit"},
  82. { VCB_STATE_DEVICE_CANNOT_WRITE, VCB_STATE_DEVICE_CANNOT_WRITE, "DeviceCannotWrite"},
  83. { VCB_STATE_VPB_NOT_ON_DEVICE, VCB_STATE_VPB_NOT_ON_DEVICE, "VPBNotOnDevice"},
  84. { VCB_STATE_VAT_INIT, VCB_STATE_VAT_INIT, "VATInit"},
  85. { VCB_STATE_WRITE_THROUGH, VCB_STATE_WRITE_THROUGH, "WriteThrough"},
  86. { VCB_STATE_HOTPLUG, VCB_STATE_HOTPLUG, "HotPlug"},
  87. { VCB_STATE_SPARING_TABLE_INIT, VCB_STATE_SPARING_TABLE_INIT, "SparingInit"},
  88. { 0 }
  89. };
  90. STATE UdfRwLcbFlags[] = {
  91. { LCB_FLAG_EXACT_INSERTED, LCB_FLAG_EXACT_INSERTED, "ExactLinks"},
  92. { LCB_FLAG_IGNORE_INSERTED, LCB_FLAG_IGNORE_INSERTED, "IgnoreLinks"},
  93. { LCB_FLAG_SHORT_INSERTED, LCB_FLAG_SHORT_INSERTED, "ShortLinks"},
  94. { LCB_FLAG_POOL_ALLOCATED, LCB_FLAG_POOL_ALLOCATED, "PoolAllocated"},
  95. { LCB_FLAG_DELETE_ON_CLEANUP, LCB_FLAG_DELETE_ON_CLEANUP, "DeleteOnCleanup"},
  96. { LCB_FLAG_LINKS_REMOVED, LCB_FLAG_LINKS_REMOVED, "NameLinksRemoved"},
  97. { LCB_FLAG_NAME_FROM_POOL, LCB_FLAG_NAME_FROM_POOL, "NameBufferFromPool"},
  98. { 0 }
  99. };
  100. BOOLEAN
  101. NodeIsUdfsRwIndex( USHORT T)
  102. {
  103. return T == UDFSRW_NTC_SCB_INDEX;
  104. }
  105. BOOLEAN
  106. NodeIsUdfsRwData( USHORT T)
  107. {
  108. return T == UDFSRW_NTC_SCB_DATA;
  109. }
  110. BOOLEAN
  111. LcbDeleted( ULONG F)
  112. {
  113. return (0 != (F & LCB_FLAG_LINKS_REMOVED)) &&
  114. (0 != (F & LCB_FLAG_DELETE_ON_CLEANUP));
  115. }
  116. // OK
  117. DUMP_ROUTINE( DumpUdfScb)
  118. {
  119. ULONG Flags, Offset, Offsetb, ScbState;
  120. UINT64 NonP;
  121. dprintf("[ Option flags: 1 = list children, 2 = List parent links, 4 = dump Mcbs ]\n\n");
  122. ROE( GetFieldValue( Address, InfoNode->TypeName, "ScbState", ScbState));
  123. dprintf("ScbState : ");
  124. PrintState( UdfScbFlags, ScbState );
  125. ROE( GetFieldValue( Address, InfoNode->TypeName, "Flags", Flags));
  126. dprintf("Header.Flags : ");
  127. PrintState( HeaderFlags, Flags );
  128. ROE( GetFieldValue( Address, InfoNode->TypeName, "Flags2", Flags));
  129. dprintf("Header.Flags2: ");
  130. PrintState( HeaderFlags2, Flags );
  131. dprintf("\n");
  132. Dt( InfoNode->TypeName, Address, 0, 0, NULL);
  133. //
  134. // Nonpaged portion
  135. //
  136. ROE( GetFieldValue( Address, InfoNode->TypeName, "ScbNonpaged", NonP));
  137. if (NonP) {
  138. dprintf("\nNonpaged portion @ %I64x\n\n",NonP);
  139. Dt( "Udfs!SCB_NONPAGED", NonP, 1, 0, NULL);
  140. }
  141. if (( Options & 1) && (UDFSRW_NTC_SCB_INDEX == InfoNode->TypeCode)) {
  142. dprintf("\nChild Lcb list\n");
  143. ROE( GetFieldOffset( "udfs!_SCB", "ChildLcbQueue", &Offset));
  144. ROE( GetFieldOffset( "udfs!_LCB", "ParentScbLinks", &Offsetb));
  145. DumpList( Address + Offset,
  146. UdfSummaryLcbDumpRoutine,
  147. Offsetb,
  148. FALSE,
  149. 0 );
  150. }
  151. if (Options & 2) {
  152. dprintf("\nParent Lcb list\n");
  153. ROE( GetFieldOffset( "udfs!_SCB", "ParentLcbQueue", &Offset));
  154. ROE( GetFieldOffset( "udfs!_LCB", "ChildScbLinks", &Offsetb));
  155. DumpList( Address + Offset,
  156. UdfSummaryLcbDumpRoutine,
  157. Offsetb,
  158. FALSE,
  159. 0 );
  160. }
  161. if (Options & 4) {
  162. if (ScbState & SCB_STATE_MCB_INITIALIZED) {
  163. ROE( GetFieldOffset( InfoNode->TypeName, "Mcb", &Offset));
  164. dprintf("\nA+R Mcb\n");
  165. DumpLargeMcb( Address+Offset, 0, NULL);
  166. }
  167. if (ScbState & SCB_STATE_MCB_ANR_INITIALIZED) {
  168. ROE( GetFieldOffset( InfoNode->TypeName, "ANRMcb", &Offset));
  169. dprintf("\nA+NR Mcb\n");
  170. DumpLargeMcb( Address+Offset, 0, NULL);
  171. }
  172. }
  173. dprintf("\n");
  174. }
  175. #endif