zoukankan      html  css  js  c++  java
  • 驱动读写方式

     1 PIO_STACK_LOCATION isl = IoGetCurrentIrpStackLocation(pIrp);
     2 
     3     //Read & Write Length
     4     ULONG dwInSize = isl->Parameters.Read.Length;
     5     ULONG dwOutSize = isl->Parameters.Write.Length;
     6 
     7     //In & Out Buffer DO_BUFFERED_IO
     8     PVOID pInBuffer = pIrp->AssociatedIrp.SystemBuffer;
     9     PVOID pOutBuffer = pIrp->AssociatedIrp.SystemBuffer;
    10 
    11     //In & Out Buffer DO_DIRECT_IO 
    12     pInBuffer = MmGetSystemAddressForMdlSafe(pIrp->MdlAddress, NormalPagePriority);
    13     pOutBuffer = MmGetSystemAddressForMdlSafe(pIrp->MdlAddress, NormalPagePriority);
    14 
    15     //In & Out Buffer DO_DIRECT_IO 
    16     ProbeForRead(pIrp->UserBuffer, dwInSize, 4);
    17     pInBuffer = pIrp->UserBuffer;
    18     ProbeForWrite(pIrp->UserBuffer, dwOutSize, 4);
    19     pOutBuffer = pIrp->UserBuffer;
    20 
    21     //Io control device
    22     ULONG dwCtrlCoder = isl->Parameters.DeviceIoControl.IoControlCode;
    23     //Read & Write Length
    24     dwInSize = isl->Parameters.DeviceIoControl.InputBufferLength;
    25     dwOutSize = isl->Parameters.DeviceIoControl.OutputBufferLength;
    26     
    27     //In & Out Buffer METHOD_BUFFERED || METHOD_IN_DIRECT || METHOD_OUT_DIRECT || METHOD_NEITHER I/O
    28     pInBuffer = pIrp->AssociatedIrp.SystemBuffer;
    29     pOutBuffer = pIrp->AssociatedIrp.SystemBuffer;
    30 
    31     //In & Out Buffer METHOD_IN_DIRECT || METHOD_OUT_DIRECT
    32     pInBuffer = pIrp->AssociatedIrp.SystemBuffer;
    33     pOutBuffer = MmGetSystemAddressForMdlSafe(pIrp->MdlAddress, NormalPagePriority);
    34 
    35     //In & Out Buffer METHOD_NEITHER I/O
    36     
    37     pInBuffer = isl->Parameters.DeviceIoControl.Type3InputBuffer;
    38     ProbeForRead(pInBuffer, dwInSize, 4);
    39     pOutBuffer = pIrp->UserBuffer;
    40     ProbeForRead(pOutBuffer, dwOutSize, 4);
  • 相关阅读:
    “echo >”和“echo >>”的区别
    socket 简介
    Shell 获取当前执行脚本的路径
    input子系统 KeyPad-Touch上报数据格式与机制
    Java垃圾回收-GC
    Java多线程-yield函数&interrupt函数
    Java内存模型-堆和栈的区别
    Java反射
    Java正则表达式
    Java多线程-sleep和wait的区别
  • 原文地址:https://www.cnblogs.com/endenvor/p/11526464.html
Copyright © 2011-2022 走看看