2 * FILE: drivers/filesystems/fastfat/kdbg.c
3 * PURPOSE: KDBG extension.
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS kernel
6 * PROGRAMMER: Pierre Schweitzer (pierre@reactos.org)
9 /* ------------------------------------------------------- INCLUDES */
18 /* -------------------------------------------------------- DEFINES */
21 UNICODE_STRING DebugFile
= {0, 0, NULL
};
32 Len
= strlen(Command
);
33 if (Len
< sizeof("?fat."))
38 if (Command
[0] != '?' || Command
[1] != 'f' ||
39 Command
[2] != 'a' || Command
[3] != 't' ||
45 Command
+= (sizeof("?fat.") - sizeof(ANSI_NULL
));
46 if (strcmp(Command
, "vols") == 0)
49 PLIST_ENTRY ListEntry
;
50 PDEVICE_EXTENSION DeviceExt
;
52 for (ListEntry
= VfatGlobalData
->VolumeListHead
.Flink
;
53 ListEntry
!= &VfatGlobalData
->VolumeListHead
;
54 ListEntry
= ListEntry
->Flink
)
56 DeviceExt
= CONTAINING_RECORD(ListEntry
, DEVICE_EXTENSION
, VolumeListEntry
);
57 DPRINT1("Volume: %p with VCB: %p\n", DeviceExt
->VolumeDevice
, DeviceExt
);
63 DPRINT1("No volume found\n");
66 else if (strcmp(Command
, "files") == 0)
70 DPRINT1("Please provide a volume or a VCB!\n");
74 PLIST_ENTRY ListEntry
;
75 PDEVICE_EXTENSION DeviceExt
;
77 for (ListEntry
= VfatGlobalData
->VolumeListHead
.Flink
;
78 ListEntry
!= &VfatGlobalData
->VolumeListHead
;
79 ListEntry
= ListEntry
->Flink
)
83 DeviceExt
= CONTAINING_RECORD(ListEntry
, DEVICE_EXTENSION
, VolumeListEntry
);
84 sprintf(Volume
, "%p", DeviceExt
);
85 if (strcmp(Volume
, Argv
[1]) == 0)
90 sprintf(Volume
, "%p", DeviceExt
->VolumeDevice
);
91 if (strcmp(Volume
, Argv
[1]) == 0)
99 if (DeviceExt
== NULL
)
101 DPRINT1("No volume %s found!\n", Argv
[1]);
107 for (ListEntry
= DeviceExt
->FcbListHead
.Flink
;
108 ListEntry
!= &DeviceExt
->FcbListHead
;
109 ListEntry
= ListEntry
->Flink
)
111 Fcb
= CONTAINING_RECORD(ListEntry
, VFATFCB
, FcbListEntry
);
112 DPRINT1("FCB %p (ref: %d, oc: %d %s %s %s) for FO %p with path: %.*S\n",
113 Fcb
, Fcb
->RefCount
, Fcb
->OpenHandleCount
,
114 ((Fcb
->Flags
& FCB_CLEANED_UP
) ? "U" : "NU"),
115 ((Fcb
->Flags
& FCB_CLOSED
) ? "C" : "NC"),
116 ((Fcb
->Flags
& FCB_DELAYED_CLOSE
) ? "D" : "ND"),
117 Fcb
->FileObject
, Fcb
->PathNameU
.Length
, Fcb
->PathNameU
.Buffer
);
122 else if (strcmp(Command
, "setdbgfile") == 0)
126 if (DebugFile
.Buffer
!= NULL
)
128 ExFreePool(DebugFile
.Buffer
);
129 DebugFile
.Length
= 0;
130 DebugFile
.MaximumLength
= 0;
133 DPRINT1("Debug file reset\n");
140 if (DebugFile
.Buffer
!= NULL
)
142 ExFreePool(DebugFile
.Buffer
);
143 DebugFile
.Length
= 0;
144 DebugFile
.MaximumLength
= 0;
147 RtlInitAnsiString(&Source
, Argv
[1]);
148 Status
= RtlAnsiStringToUnicodeString(&DebugFile
, &Source
, TRUE
);
149 if (NT_SUCCESS(Status
))
151 DPRINT1("Debug file set to: %.*S\n", DebugFile
.Length
, DebugFile
.Buffer
);
157 DPRINT1("Unknown command: %s\n", Command
);