1. gzyueqian
      18529173453

      USB鼠標(biāo)的上層過(guò)濾型驅(qū)動(dòng)程序

      更新時(shí)間: 2007-05-09 09:08:23來(lái)源: 粵嵌教育瀏覽量:1226


      AddDevice例程內(nèi)容如下:

      NTSTATUS VA_AddDevice
      (
      IN PDRIVER_OBJECT driverObj,
      IN PDEVICE_OBJECT physicalDevObj

      )
      {
      NTSTATUS status;
      PDEVICE_OBJECT filterDevObj = NULL;

      PAGED_CODE();

      DBGOUT(("VA_AddDevice: 驅(qū)動(dòng)對(duì)象=%ph, 物理設(shè)備對(duì)象=%ph", driverObj, physicalDevObj));

      status = IoCreateDevice(
      driverObj,
      sizeof(struct DEVICE_EXTENSION),
      NULL, // name for this device
      FILE_DEVICE_MOUSE,
      0, // device characteristics
      FALSE, // not exclusive
      &filterDevObj); // our device object

      if ( NT_SUCCESS(status) ){
      struct DEVICE_EXTENSION *devExt;

      ASSERT( filterDevObj );

      /*
      * Initialize device extension for new device object
      */
      devExt = ( struct DEVICE_EXTENSION * )filterDevObj->DeviceExtension;
      RtlZeroMemory( devExt, sizeof(struct DEVICE_EXTENSION) );
      devExt->signature = DEVICE_EXTENSION_SIGNATURE;
      devExt->state = STATE_INITIALIZED;
      devExt->filterDevObj = filterDevObj;
      devExt->physicalDevObj = physicalDevObj;



      devExt->pendingActionCount = 0;
      KeInitializeEvent( &devExt->removeEvent, NotificationEvent, FALSE );
      #ifdef HANDLE_DEVICE_USAGE
      KeInitializeEvent(&devExt->deviceUsageNotificationEvent, SynchronizationEvent, TRUE);
      #endif // HANDLE_DEVICE_USAGE

      /*
      * Attach the new device object to the top of the device stack.
      */
      devExt->topDevObj = IoAttachDeviceToDeviceStack(filterDevObj, physicalDevObj);

      ASSERT(devExt->topDevObj);
      DBGOUT(("創(chuàng)建的過(guò)濾設(shè)備對(duì)象: %ph 掛接到設(shè)備對(duì)象堆棧: %ph.", filterDevObj, devExt->topDevObj));


      //
      // As a filter driver, we do not want to change the power or I/O
      // behavior of the driver stack in any way. Recall that a filter
      // driver should "appear" the same (almost) as the underlying device.
      // Therefore we must copy some bits from the device object _directly_
      // below us in the device stack (notice: DON'T copy from the PDO!)
      //


      /* Various I/O-related flags which should be maintained */
      /* (copy from lower device object) */
      filterDevObj->Flags |= DO_BUFFERED_IO;
      filterDevObj->Flags |= (devExt->topDevObj->Flags &
      (DO_POWER_INRUSH | DO_POWER_PAGABLE ));

      #ifdef HANDLE_DEVICE_USAGE

      if ((devExt->topDevObj->Flags & DO_POWER_PAGABLE)){
      }else{
      DBGOUT(( "LOCKing some driver code (non-pageable) (b/c init conditions)" ));
      devExt->initUnlockHandle = MmLockPagableCodeSection( VA_Power ); // some func that's inside the code section that we want to lock
      ASSERT( NULL != devExt->initUnlockHandle );
      }
      devExt->initialFlags = filterDevObj->Flags & ~DO_DEVICE_INITIALIZING;
      #endif // HANDLE_DEVICE_USAGE

      filterDevObj->Flags &= ~DO_DEVICE_INITIALIZING;
      RegistryAccessSample(devExt, devExt->physicalDevObj);
      }

      ASSERT(NT_SUCCESS(status));
      return status;
      }

      用INF內(nèi)容如下:
      ;***************************************************
      ;Zt_Usb_Mouse_Filter Driver's Inf file *
      ;name: ztmouse.inf *
      ;Date: 4/20/2005 *
      ;Composer: ting_Zhang *
      ;version 1.00.0.0 *
      ;***************************************************



      ;=========The "[Version]" begin================>>
      [Version]
      Signature="$Windows NT$"
      SignOS=Windows 2000
      Provider=%ProviderName%
      Class=Mouse
      ClassGUID={4D36E96F-E325-11CE-BFC1-08002BE10318}
      DriverVer=04/20/2005,1.0.0.0
      ;<<=========The "[Version]" end==================


      [DestinationDirs]
      DefaultDestDir = 12


      [Manufacturer]
      %USBDBE%=USBDBEINS

      [USBDBEINS]
      %HID.DeviceDesc% = yyz,HID\VID_ba13&PID_b100

      ;HID\VID_046D&PID_C50B&Mi_01&Col01
      ;===================================
      ; Win2000 Installation sections
      ;===================================
      [yyz.NT]
      Include = msmouse.inf
      Needs = HID_Mouse_Inst.NT
      CopyFiles = yyz.CopyFiles


      [yyz.CopyFiles]
      yyx.sys




      [yyz.NT.Services]
      Addservice = yyx,0x00000002, yyz_Service_Inst
      Include=msmouse.inf
      Needs=HID_Mouse_Inst.NT.Services



      [yyz.NT.HW]
      AddReg = yyz_HW_AddReg
      Include=msmouse.inf
      Needs=HID_Mouse_Inst.NT.HW


      [yyz_Service_Inst]
      DisplayName = %HID.DeviceDesc%
      ServiceType = 1
      StartType = 3
      ErrorControl = 1
      LoadOrderGroup = Pointer Port
      ServiceBinary = %12%\yyx.sys





      [yyz_HW_AddReg]
      ;HKR,,"LowerFilters",0x00010000,"yyx"
      HKR,,"UpperFilters",0x00010000,"yyx"



      [SourceDisksNames]
      1 = %DiskId1%

      [SourceDisksFiles]
      yyx.sys = 1





      ;=================the "[strings]" begin================>>
      [strings]
      USBDBE = "YongRui Electronics Co.,Ltd"
      HID.ClassName = "Human Input Devices (HID)"
      HID.DeviceDesc = "USB Mouse Fliter"
      HID.DefaultDevice = "HID Default Device"

      REG_SZ = 0x00000000
      REG_MULTI_SZ = 0x00010000
      REG_EXPAND_SZ = 0x00020000
      REG_BINARY = 0x00000001
      REG_DWORD = 0x00010001
      ;SERVICEROOT = "System\CurrentControlSet\Services"

      DiskId1 = "Mouse Fliter Installation Disk #1 "
      ProviderName = "YongRui Develop Department"


      ;<<================the "[strings]" end====================

      免費(fèi)預(yù)約試聽(tīng)課

      亚洲另类欧美综合久久图片区_亚洲中文字幕日产无码2020_欧美日本一区二区三区桃色视频_亚洲AⅤ天堂一区二区三区

      
      

      1. 又黄又爽又色无遮挡国产 | 亚洲国产午夜久久久久 | 亚洲无吗大片在线观看 | 亚洲成a人网站在线看 | 偷拍被发现视频一区二区 | 在线观看免费网站看v片 |