⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug.c

📁 This is a ReiserFs file system driver for Windows NT/2000/XP/Vista.
💻 C
📖 第 1 页 / 共 5 页
字号:

    switch (IoStackLocation->MajorFunction) {

    case IRP_MJ_CREATE:

        FileName = NULL;

        if (DeviceObject == RfsdGlobal->DeviceObject) {
            FileName = "\\" DRIVER_NAME;
        } else if (IoStackLocation->FileObject->FileName.Length == 0) {
            FileName = "\\Volume";
        }

        if (FileName) {
            RfsdPrintNoIndent((DBG_TRACE, "%s %s %s\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName
            ));
        } else if (IoStackLocation->FileObject->FileName.Buffer) {
            RfsdPrintNoIndent((DBG_TRACE, "%s %s %S\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                IoStackLocation->FileObject->FileName.Buffer
            ));
        } else {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                "Unknown"
            ));
        }

        break;

    case IRP_MJ_CLOSE:

        RfsdPrintNoIndent((
            DBG_TRACE, "%s %s %s\n",
            RfsdGetCurrentProcessName(),
            IrpMjStrings[IoStackLocation->MajorFunction],
            FileName
            ));

        break;

    case IRP_MJ_READ:

        if (IoStackLocation->MinorFunction & IRP_MN_COMPLETE) {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s IRP_MN_COMPLETE\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName
                ));
        } else {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s Offset: %I64xh Length: %xh %s%s%s%s%s%s\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName,
                IoStackLocation->Parameters.Read.ByteOffset.QuadPart,
                IoStackLocation->Parameters.Read.Length,
                (IoStackLocation->MinorFunction & IRP_MN_DPC ? "IRP_MN_DPC " : " "),
                (IoStackLocation->MinorFunction & IRP_MN_MDL ? "IRP_MN_MDL " : " "),
                (IoStackLocation->MinorFunction & IRP_MN_COMPRESSED ? "IRP_MN_COMPRESSED " : " "),
                (Irp->Flags & IRP_PAGING_IO ? "IRP_PAGING_IO " : " "),
                (Irp->Flags & IRP_NOCACHE ? "IRP_NOCACHE " : " "),
                (FileObject->Flags & FO_SYNCHRONOUS_IO ? "FO_SYNCHRONOUS_IO " : " ")
                ));
        }

        break;

    case IRP_MJ_WRITE:

        if (IoStackLocation->MinorFunction & IRP_MN_COMPLETE)  {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s IRP_MN_COMPLETE\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName
                ));
        } else {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s Offset: %I64xh Length: %xh %s%s%s%s%s%s\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName,
                IoStackLocation->Parameters.Read.ByteOffset.QuadPart,
                IoStackLocation->Parameters.Read.Length,
                (IoStackLocation->MinorFunction & IRP_MN_DPC ? "IRP_MN_DPC " : " "),
                (IoStackLocation->MinorFunction & IRP_MN_MDL ? "IRP_MN_MDL " : " "),
                (IoStackLocation->MinorFunction & IRP_MN_COMPRESSED ? "IRP_MN_COMPRESSED " : " "),
                (Irp->Flags & IRP_PAGING_IO ? "IRP_PAGING_IO " : " "),
                (Irp->Flags & IRP_NOCACHE ? "IRP_NOCACHE " : " "),
                (FileObject->Flags & FO_SYNCHRONOUS_IO ? "FO_SYNCHRONOUS_IO " : " ")
                ));
        }

        break;

    case IRP_MJ_QUERY_INFORMATION:

        FileInformationClass =
            IoStackLocation->Parameters.QueryFile.FileInformationClass;

        if (FileInformationClass <= FileMaximumInformation) {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s %s\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName,
                FileInformationClassStrings[FileInformationClass]
                ));
        } else {
            RfsdPrintNoIndent((
                DBG_TRACE,
                "%s %s %s Unknown FileInformationClass %u\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName,
                FileInformationClass
                ));
        }

        break;

    case IRP_MJ_SET_INFORMATION:

        FileInformationClass =
            IoStackLocation->Parameters.SetFile.FileInformationClass;

        if (FileInformationClass <= FileMaximumInformation) {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s %s\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName,
                FileInformationClassStrings[FileInformationClass]
                ));
        } else {
            RfsdPrintNoIndent((
                DBG_TRACE, 
                "%s %s %s Unknown FileInformationClass %u\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName,
                FileInformationClass
                ));
        }

        break;

    case IRP_MJ_QUERY_VOLUME_INFORMATION:

        FsInformationClass =
            IoStackLocation->Parameters.QueryVolume.FsInformationClass;

        if (FsInformationClass <= FileFsMaximumInformation) {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s %s\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName,
                FsInformationClassStrings[FsInformationClass]
                ));
        } else {
            RfsdPrintNoIndent((
                DBG_TRACE, 
                "%s %s %s Unknown FsInformationClass %u\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName,
                FsInformationClass
                ));
        }

        break;

    case IRP_MJ_DIRECTORY_CONTROL:

        if (IoStackLocation->MinorFunction & IRP_MN_QUERY_DIRECTORY) {

#ifndef _GNU_NTIFS_
            FileInformationClass =
                IoStackLocation->Parameters.QueryDirectory.FileInformationClass;
#else
            FileInformationClass = ((PEXTENDED_IO_STACK_LOCATION)
                IoStackLocation)->Parameters.QueryDirectory.FileInformationClass;
#endif

            if (FileInformationClass <= FileMaximumInformation) {
                RfsdPrintNoIndent((
                    DBG_TRACE, "%s %s %s %s\n",
                    RfsdGetCurrentProcessName(),
                    IrpMjStrings[IoStackLocation->MajorFunction],
                    FileName,
                    FileInformationClassStrings[FileInformationClass]
                    ));

                if (
#ifndef _GNU_NTIFS_
                    IoStackLocation->Parameters.QueryDirectory.FileName
#else
                    ((PEXTENDED_IO_STACK_LOCATION)
                    IoStackLocation)->Parameters.QueryDirectory.FileName
#endif
                    ) {
#ifndef _GNU_NTIFS_
                    RfsdPrintNoIndent((
                        DBG_TRACE, "%s FileName: %.*S FileIndex: %x %s%s%s\n",
                        RfsdGetCurrentProcessName(),

                        IoStackLocation->Parameters.QueryDirectory.FileName->Length / 2,
                        IoStackLocation->Parameters.QueryDirectory.FileName->Buffer,
                        IoStackLocation->Parameters.QueryDirectory.FileIndex,
                        (IoStackLocation->Flags & SL_RESTART_SCAN ? "SL_RESTART_SCAN " : ""),
                        (IoStackLocation->Flags & SL_RETURN_SINGLE_ENTRY ? "SL_RETURN_SINGLE_ENTRY " : ""),
                        ((IoStackLocation->Flags & SL_INDEX_SPECIFIED) ? "SL_INDEX_SPECIFIED " : "")
                        ));

#else
                    RfsdPrintNoIndent((
                        DBG_TRACE, "%s FileName: %.*S FileIndex: %x %s%s%s\n",
                        RfsdGetCurrentProcessName(),

                        ((PEXTENDED_IO_STACK_LOCATION)
                        IoStackLocation)->Parameters.QueryDirectory.FileName->Length / 2,
                        ((PEXTENDED_IO_STACK_LOCATION)
                        IoStackLocation)->Parameters.QueryDirectory.FileName->Buffer,
                        ((PEXTENDED_IO_STACK_LOCATION)
                        IoStackLocation)->Parameters.QueryDirectory.FileIndex,
                        (IoStackLocation->Flags & SL_RESTART_SCAN ? "SL_RESTART_SCAN " : ""),
                        (IoStackLocation->Flags & SL_RETURN_SINGLE_ENTRY ? "SL_RETURN_SINGLE_ENTRY " : ""),
                        ((IoStackLocation->Flags & SL_INDEX_SPECIFIED) ? "SL_INDEX_SPECIFIED " : "")
                        ));
#endif
                } else {
#ifndef _GNU_NTIFS_
                    RfsdPrintNoIndent((
                        DBG_TRACE, "%s FileName: FileIndex: %#x %s%s%s\n",
                        RfsdGetCurrentProcessName(),
                        IoStackLocation->Parameters.QueryDirectory.FileIndex,
                        (IoStackLocation->Flags & SL_RESTART_SCAN ? "SL_RESTART_SCAN " : ""),
                        (IoStackLocation->Flags & SL_RETURN_SINGLE_ENTRY ? "SL_RETURN_SINGLE_ENTRY " : ""),
                        (IoStackLocation->Flags & SL_INDEX_SPECIFIED ? "SL_INDEX_SPECIFIED " : "")
                        ));
#else
                    RfsdPrintNoIndent((
                        DBG_TRACE, "%s FileName: FileIndex: %#x %s%s%s\n",
                        RfsdGetCurrentProcessName(),
                        ((PEXTENDED_IO_STACK_LOCATION)
                        IoStackLocation)->Parameters.QueryDirectory.FileIndex,
                        (IoStackLocation->Flags & SL_RESTART_SCAN ? "SL_RESTART_SCAN " : ""),
                        (IoStackLocation->Flags & SL_RETURN_SINGLE_ENTRY ? "SL_RETURN_SINGLE_ENTRY " : ""),
                        (IoStackLocation->Flags & SL_INDEX_SPECIFIED ? "SL_INDEX_SPECIFIED " : "")
                        ));
#endif
                }
            } else {
                RfsdPrintNoIndent((
                    DBG_TRACE, 
                    "%s %s %s Unknown FileInformationClass %u\n",
                    RfsdGetCurrentProcessName(),
                    IrpMjStrings[IoStackLocation->MajorFunction],
                    FileName,
                    FileInformationClass
                    ));
            }
        } else if (IoStackLocation->MinorFunction & IRP_MN_NOTIFY_CHANGE_DIRECTORY) {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s IRP_MN_NOTIFY_CHANGE_DIRECTORY\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName
                ));
        } else {
            RfsdPrintNoIndent((
                DBG_TRACE, "%s %s %s Unknown minor function %#x\n",
                RfsdGetCurrentProcessName(),
                IrpMjStrings[IoStackLocation->MajorFunction],
                FileName,
                IoStackLocation->MinorFunction
                ));
        }

        break;

    case IRP_MJ_FILE_SYSTEM_CONTROL:

        if (IoStackLocation->MinorFunction == IRP_MN_USER_FS_REQUEST) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -