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

📄 fileinfo.c

📁 winddk src目录下的文件系统驱动源码压缩!
💻 C
📖 第 1 页 / 共 2 页
字号:
}

NTSTATUS
NulMRxSetVolumeInformation(
      IN OUT PRX_CONTEXT              pRxContext
      )
/*++

Routine Description:

   This routine sets the volume information

Arguments:

    pRxContext - the RDBSS context

    FsInformationClass - the kind of Fs information desired.

    pBuffer            - the buffer for copying the information

    BufferLength       - the buffer length

Return Value:

    NTSTATUS - The return status for the operation

--*/
{
    NTSTATUS Status = STATUS_NOT_IMPLEMENTED;

    DbgPrint("NulMRxSetVolumeInformation \n");
    return(Status);
}


NTSTATUS
NulMRxQueryFileInformation(
      IN PRX_CONTEXT            RxContext
      )
/*++

Routine Description:

   This routine does a query file info. Only the NT-->NT path is implemented.

   The NT-->NT path works by just remoting the call basically without further ado.

Arguments:

    RxContext - the RDBSS context

Return Value:

    NTSTATUS - The return status for the operation

--*/
{
    NTSTATUS Status = STATUS_INVALID_PARAMETER;
    ULONG RemainingLength = RxContext->Info.LengthRemaining;
    RxCaptureFcb;
    FILE_INFORMATION_CLASS FunctionalityRequested = 
            RxContext->Info.FileInformationClass;
    PFILE_STANDARD_INFORMATION pFileStdInfo = 
            (PFILE_STANDARD_INFORMATION) RxContext->Info.Buffer;

    RxTraceEnter("NulMRxQueryFileInformation");

    switch( FunctionalityRequested ) {
        case FileBasicInformation:
            if(RemainingLength < sizeof(FILE_BASIC_INFORMATION)) {
                break;
            }
            RemainingLength -= sizeof(FILE_BASIC_INFORMATION);
            Status = STATUS_SUCCESS;
            break;
    
        case FileInternalInformation:
            if(RemainingLength < sizeof(FILE_INTERNAL_INFORMATION)) {
                break;
            }
            RemainingLength -= sizeof(FILE_INTERNAL_INFORMATION);
            Status = STATUS_SUCCESS;
            break;
            
        case FileEaInformation:
            if(RemainingLength < sizeof(FILE_EA_INFORMATION)) {
                break;
            }
            RemainingLength -= sizeof(FILE_EA_INFORMATION);
            Status = STATUS_SUCCESS;
            break;
            
        case FileStandardInformation:

            if(RemainingLength < sizeof(FILE_STANDARD_INFORMATION)) {
                break;
            }
            
            RxDbgTrace(0, Dbg, ("FileSize is %d AllocationSize is %d\n",
                pFileStdInfo->EndOfFile.LowPart,pFileStdInfo->AllocationSize.LowPart));
            //(RxContext->CurrentIrp)->IoStatus.Information = sizeof(FILE_STANDARD_INFORMATION);
            RemainingLength -= sizeof(FILE_STANDARD_INFORMATION);
            Status = STATUS_SUCCESS;
            break;
        
        default:
            break;
    }

    RxContext->Info.LengthRemaining = RemainingLength;
    
    RxTraceLeave(Status);
    return(Status);
}

NTSTATUS
NulMRxSetFileInformation(
      IN PRX_CONTEXT            RxContext
      )
/*++

Routine Description:

   This routine does a set file info. Only the NT-->NT path is implemented.

   The NT-->NT path works by just remoting the call basically without further ado.

Arguments:

    RxContext - the RDBSS context

Return Value:

    NTSTATUS - The return status for the operation

--*/
{
    NTSTATUS Status = STATUS_INVALID_PARAMETER;
    RxCaptureFcb;
    ULONG BufferLength = RxContext->Info.Length;
    FILE_INFORMATION_CLASS FunctionalityRequested = 
            RxContext->Info.FileInformationClass;
    PFILE_END_OF_FILE_INFORMATION pEndOfFileInfo = 
            (PFILE_END_OF_FILE_INFORMATION) RxContext->Info.Buffer;
    LARGE_INTEGER NewAllocationSize;

    RxTraceEnter("NulMRxSetFileInformation");

    switch( FunctionalityRequested ) {
    case FileBasicInformation:
            
        RxDbgTrace(0, Dbg, ("FileBasicInformation\n"));
        
        if(BufferLength < sizeof(FILE_BASIC_INFORMATION)) 
        {
            break;
        }
        Status = STATUS_SUCCESS;
        break;
    
        
    case FileDispositionInformation:
        
        RxDbgTrace(0, Dbg, ("FileDispositionInformation\n"));
        
        if(BufferLength < sizeof(FILE_DISPOSITION_INFORMATION)) 
        {
            break;
        }
        Status = STATUS_SUCCESS;
        break;
    
        
    case FilePositionInformation:
        
        RxDbgTrace(0, Dbg, ("FilePositionInformation\n"));
        
        if(BufferLength < sizeof(FILE_POSITION_INFORMATION)) 
        {
            break;
        }
        Status = STATUS_SUCCESS;
        break;
    
        
    case FileAllocationInformation:
        
        RxDbgTrace(0, Dbg, ("FileAllocationInformation\n"));
        RxDbgTrace(0, Dbg, ("AllocSize is %d AllocSizeHigh is %d\n",
            pEndOfFileInfo->EndOfFile.LowPart,pEndOfFileInfo->EndOfFile.HighPart));
        
        if(BufferLength < sizeof(FILE_ALLOCATION_INFORMATION)) 
        {
            break;
        }
        
        Status = STATUS_SUCCESS;
        break;
    
    case FileEndOfFileInformation:

        RxDbgTrace(0, Dbg, ("FileSize is %d FileSizeHigh is %d\n",
            capFcb->Header.AllocationSize.LowPart,capFcb->Header.AllocationSize.HighPart));
        if(BufferLength < sizeof(FILE_END_OF_FILE_INFORMATION)) 
        {
            break;
        }

        if( pEndOfFileInfo->EndOfFile.QuadPart > 
               capFcb->Header.AllocationSize.QuadPart ) {
            
            Status = NulMRxExtendFile(
                            RxContext,
                            &pEndOfFileInfo->EndOfFile,
                            &NewAllocationSize
                            );

            RxDbgTrace(0, Dbg, ("AllocSize is %d AllocSizeHigh is %d\n",
                       NewAllocationSize.LowPart,NewAllocationSize.HighPart));

            //
            //  Change the file allocation
            //
            capFcb->Header.AllocationSize.QuadPart = NewAllocationSize.QuadPart;
        } else {
            Status = NulMRxTruncateFile(
                            RxContext,
                            &pEndOfFileInfo->EndOfFile,
                            &NewAllocationSize
                            );
        }

        break;
    
        
    case FileRenameInformation:
        
        RxDbgTrace(0, Dbg, ("FileRenameInformation\n"));
        if(BufferLength < sizeof(FILE_RENAME_INFORMATION)) 
        {
            break;
        }
        Status = STATUS_SUCCESS;
        break;
    
    default:
        break;
    }
    
    RxTraceLeave(Status);
    return Status;
}

NTSTATUS
NulMRxSetFileInformationAtCleanup(
      IN PRX_CONTEXT            RxContext
      )
/*++

Routine Description:

   This routine sets the file information on cleanup. the old rdr just swallows this operation (i.e.
   it doesn't generate it). we are doing the same..........

Arguments:

    pRxContext           - the RDBSS context

Return Value:

    NTSTATUS - The return status for the operation

--*/
{
    NTSTATUS Status = STATUS_NOT_IMPLEMENTED;

    return(Status);
}


⌨️ 快捷键说明

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