- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
// https://github.com/microsoft/Windows-driver-samples/blob/d3ec258921cfcef7b053b5a2c866330d43dd3f03/filesys/fastfat/dumpsup.c#L35
#define DumpLabel(Label,Width) { \
size_t i, LastPeriod=0; \
CHAR _Str[20]; \
for(i=0;i<2;i++) { _Str[i] = UCHAR_SP;} \
for(i=0;i<strlen(#Label);i++) {if (#Label[i] == '.') LastPeriod = i;} \
strncpy(&_Str[2],&#Label[LastPeriod],Width); \
for(i=strlen(_Str);i<Width;i++) {_Str[i] = UCHAR_SP;} \
_Str[Width] = '\0'; \
DbgPrint("%s", _Str); \
}
#define DumpField(Field) { \
if ((FatDumpCurrentColumn + 18 + 9 + 9) > 80) {DumpNewLine();} \
FatDumpCurrentColumn += 18 + 9 + 9; \
DumpLabel(Field,18); \
DbgPrint(":%p", Ptr->Field); \
DbgPrint(" "); \
}
#define DumpListEntry(Links) { \
if ((FatDumpCurrentColumn + 18 + 9 + 9) > 80) {DumpNewLine();} \
FatDumpCurrentColumn += 18 + 9 + 9; \
DumpLabel(Links,18); \
DbgPrint(":%p", Ptr->Links.Flink); \
DbgPrint(":%p", Ptr->Links.Blink); \
}
#define DumpName(Field,Width) { \
ULONG i; \
CHAR _String[256]; \
if ((FatDumpCurrentColumn + 18 + Width) > 80) {DumpNewLine();} \
FatDumpCurrentColumn += 18 + Width; \
DumpLabel(Field,18); \
for(i=0;i<Width;i++) {_String[i] = (CHAR)Ptr->Field[i];} \
_String[Width] = '\0'; \
DbgPrint("%s", _String); \
}
#define TestForNull(Name) { \
if (Ptr == NULL) { \
DbgPrint("%s - Cannot dump a NULL pointer\n", Name); \
return; \
} \
}