VirtualBox

Changeset 44986 in vbox


Ignore:
Timestamp:
Mar 11, 2013 1:49:43 PM (12 years ago)
Author:
vboxsync
Message:

VBoxGuest-win-pnp.cpp: More cleaning up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp

    r44985 r44986  
    6969static NTSTATUS vbgdNtSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict)
    7070{
    71     KEVENT event;
    72 
    73     KeInitializeEvent(&event, SynchronizationEvent, FALSE);
     71    KEVENT Event;
     72
     73    KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
    7474
    7575    IoCopyCurrentIrpStackLocationToNext(pIrp);
    7676    IoSetCompletionRoutine(pIrp, (PIO_COMPLETION_ROUTINE)vbgdNtPnpIrpComplete,
    77                            &event, TRUE, TRUE, TRUE);
     77                           &Event, TRUE, TRUE, TRUE);
    7878
    7979    NTSTATUS rc = IoCallDriver(pDevObj, pIrp);
     
    8181    if (rc == STATUS_PENDING)
    8282    {
    83         KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
     83        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
    8484        rc = pIrp->IoStatus.Status;
    8585    }
     
    108108
    109109#ifdef LOG_ENABLED
    110     static char* aszFnctName[] =
     110    static char *s_apszFnctName[] =
    111111    {
    112112        "IRP_MN_START_DEVICE",
     
    124124        "IRP_MN_QUERY_DEVICE_TEXT",
    125125        "IRP_MN_FILTER_RESOURCE_REQUIREMENTS",
    126         "",
     126        "IRP_MN_0xE",
    127127        "IRP_MN_READ_CONFIG",
    128128        "IRP_MN_WRITE_CONFIG",
     
    136136    };
    137137    Log(("VBoxGuest::vbgdNtGuestPnp: MinorFunction: %s\n",
    138            pStack->MinorFunction < (sizeof(aszFnctName) / sizeof(aszFnctName[0]))
    139          ? aszFnctName[pStack->MinorFunction]
    140          : "Unknown"));
     138         pStack->MinorFunction < RT_ELEMENTS(s_apszFnctName)) ? s_apszFnctName[pStack->MinorFunction] : "Unknown"));
    141139#endif
    142140
     
    225223            Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_REMOVE_DEVICE: Device cannot be removed without a reboot.\n"));
    226224            rc = STATUS_UNSUCCESSFUL;
    227 #endif /* VBOX_REBOOT_ON_UNINSTALL */
     225#endif
    228226
    229227            if (NT_SUCCESS(rc))
     
    320318            Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_STOP_DEVICE: Device cannot be stopped without a reboot!\n"));
    321319            pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
    322 #endif /* VBOX_REBOOT_ON_UNINSTALL */
     320#endif
    323321
    324322            if (NT_SUCCESS(rc))
     
    436434NTSTATUS vbgdNtPower(PDEVICE_OBJECT pDevObj, PIRP pIrp)
    437435{
    438     PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp);
    439     PVBOXGUESTDEVEXT   pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension;
    440     POWER_STATE_TYPE   powerType;
    441     POWER_STATE        powerState;
    442     POWER_ACTION       powerAction;
     436    PIO_STACK_LOCATION pStack   = IoGetCurrentIrpStackLocation(pIrp);
     437    PVBOXGUESTDEVEXT   pDevExt  = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension;
     438    POWER_STATE_TYPE   enmPowerType   = pStack->Parameters.Power.Type;
     439    POWER_STATE        PowerState     = pStack->Parameters.Power.State;
     440    POWER_ACTION       enmPowerAction = pStack->Parameters.Power.ShutdownType;
    443441
    444442    Log(("VBoxGuest::vbgdNtGuestPower\n"));
    445 
    446     powerType   = pStack->Parameters.Power.Type;
    447     powerAction = pStack->Parameters.Power.ShutdownType;
    448     powerState  = pStack->Parameters.Power.State;
    449443
    450444    switch (pStack->MinorFunction)
     
    452446        case IRP_MN_SET_POWER:
    453447        {
    454             Log(("VBoxGuest::vbgdNtGuestPower: IRP_MN_SET_POWER, type= %d\n", powerType));
    455             switch (powerType)
     448            Log(("VBoxGuest::vbgdNtGuestPower: IRP_MN_SET_POWER, type= %d\n", enmPowerType));
     449            switch (enmPowerType)
    456450            {
    457451                case SystemPowerState:
    458452                {
    459                     Log(("VBoxGuest::vbgdNtGuestPower: SystemPowerState, action = %d, state = %d\n", powerAction, powerState));
    460 
    461                     switch (powerAction)
     453                    Log(("VBoxGuest::vbgdNtGuestPower: SystemPowerState, action = %d, state = %d/%d\n",
     454                         enmPowerAction, PowerState.SystemState, PowerState.DeviceState));
     455
     456                    switch (enmPowerAction)
    462457                    {
    463458                        case PowerActionSleep:
    464459
    465460                            /* System now is in a working state. */
    466                             if (powerState.SystemState == PowerSystemWorking)
     461                            if (PowerState.SystemState == PowerSystemWorking)
    467462                            {
    468463                                if (   pDevExt
     
    484479                            /* Tell the VMM that we no longer support mouse pointer integration. */
    485480                            VMMDevReqMouseStatus *pReq = NULL;
    486                             int vrc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof (VMMDevReqMouseStatus), VMMDevReq_SetMouseStatus);
     481                            int vrc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof (VMMDevReqMouseStatus),
     482                                                  VMMDevReq_SetMouseStatus);
    487483                            if (RT_SUCCESS(vrc))
    488484                            {
     
    510506                        {
    511507                            Log(("VBoxGuest::vbgdNtGuestPower: Power action shutdown!\n"));
    512                             if (powerState.SystemState >= PowerSystemShutdown)
     508                            if (PowerState.SystemState >= PowerSystemShutdown)
    513509                            {
    514510                                Log(("VBoxGuest::vbgdNtGuestPower: Telling the VMMDev to close the VM ...\n"));
     
    524520                                }
    525521                                if (RT_FAILURE(vrc))
    526                                 {
    527                                     Log(("VBoxGuest::PowerStateRequest: Error communicating new power status to VMMDev. "
    528                                              "vrc = %Rrc\n", vrc));
    529                                 }
     522                                    Log(("VBoxGuest::PowerStateRequest: Error communicating new power status to VMMDev. vrc = %Rrc\n", vrc));
    530523
    531524                                /* No need to do cleanup here; at this point we should've been
     
    546539                     */
    547540                    if (pDevExt)
    548                         pDevExt->win.s.LastSystemPowerAction = powerAction;
     541                        pDevExt->win.s.LastSystemPowerAction = enmPowerAction;
    549542
    550543                    break;
     
    560553
    561554    /*
    562      *  Whether we are completing or relaying this power IRP,
    563      *  we must call PoStartNextPowerIrp.
     555     * Whether we are completing or relaying this power IRP,
     556     * we must call PoStartNextPowerIrp.
    564557     */
    565558    PoStartNextPowerIrp(pIrp);
    566559
    567560    /*
    568      *  Send the IRP down the driver stack,
    569      *  using PoCallDriver (not IoCallDriver, as for non-power irps).
     561     * Send the IRP down the driver stack, using PoCallDriver
     562     * (not IoCallDriver, as for non-power irps).
    570563     */
    571564    IoCopyCurrentIrpStackLocationToNext(pIrp);
     
    578571    return PoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp);
    579572}
     573
Note: See TracChangeset for help on using the changeset viewer.

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