VirtualBox

Changeset 38931 in vbox for trunk/src


Ignore:
Timestamp:
Oct 3, 2011 10:59:12 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74282
Message:

VBoxMouse/win: apply patch from Huihong Luo

Location:
trunk/src/VBox/Additions/WINNT/Mouse/NT5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Mouse/NT5/VBoxMF.h

    r37423 r38931  
    5858
    5959    IO_REMOVE_LOCK RemoveLock;
     60   
     61    DEVICE_POWER_STATE DeviceState;   /* current power state of the device */
    6062} VBOXMOUSE_DEVEXT, *PVBOXMOUSE_DEVEXT;
    6163
     
    7274NTSTATUS VBoxIrpInternalIOCTL(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
    7375NTSTATUS VBoxIrpPnP(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
     76NTSTATUS VBoxIrpPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
    7477
    7578/* Internal functions */
  • trunk/src/VBox/Additions/WINNT/Mouse/NT5/VBoxMFDriver.cpp

    r37423 r38931  
    5050    DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = VBoxIrpInternalIOCTL;
    5151    DriverObject->MajorFunction[IRP_MJ_PNP] = VBoxIrpPnP;
     52        DriverObject->MajorFunction[IRP_MJ_POWER] = VBoxIrpPower;
    5253
    5354    NTSTATUS tmpStatus = VBoxNewProtInit();
     
    121122    pDevExt->pdoSelf   = pDO;
    122123    pDevExt->pdoParent = pDOParent;
     124        pDevExt->DeviceState = PowerDeviceD0;
    123125
    124126    VBoxDeviceAdded(pDevExt);
     
    238240    }
    239241
    240     if (!NT_SUCCESS(rc))
     242    if (!NT_SUCCESS(rc) && rc != STATUS_NOT_SUPPORTED)
    241243    {
    242244        WARN(("rc=%#x", rc));
     
    246248    return rc;
    247249}
     250
     251NTSTATUS VBoxIrpPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
     252{
     253    PIO_STACK_LOCATION  irpSp;   
     254        PVBOXMOUSE_DEVEXT   devExt;
     255    POWER_STATE         powerState;
     256    POWER_STATE_TYPE    powerType;
     257
     258    PAGED_CODE();
     259
     260    devExt = (PVBOXMOUSE_DEVEXT) DeviceObject->DeviceExtension;
     261    irpSp = IoGetCurrentIrpStackLocation(Irp);
     262
     263    powerType = irpSp->Parameters.Power.Type;
     264    powerState = irpSp->Parameters.Power.State;
     265
     266    switch (irpSp->MinorFunction) {
     267    case IRP_MN_SET_POWER:
     268        if (powerType  == DevicePowerState) {
     269            devExt->DeviceState = powerState.DeviceState;
     270        }
     271
     272    case IRP_MN_QUERY_POWER:
     273    case IRP_MN_WAIT_WAKE:
     274    case IRP_MN_POWER_SEQUENCE:
     275    default:
     276        break;
     277    }
     278
     279    PoStartNextPowerIrp(Irp);
     280    IoSkipCurrentIrpStackLocation(Irp);
     281    return PoCallDriver(devExt->pdoParent, Irp);
     282}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette