VirtualBox

Changeset 70282 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 21, 2017 2:28:47 PM (7 years ago)
Author:
vboxsync
Message:

VBoxGuest-win.cpp: Refuse to stop or remove the device when there are active sessions.

File:
1 edited

Legend:

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

    r70280 r70282  
    9494    /** Top of the stack. */
    9595    PDEVICE_OBJECT          pNextLowerDriver;
     96
     97    /** @name PCI bus and slot (device+function) set by for legacy NT only.
     98     * @{ */
     99    /** Bus number where the device is located. */
     100    ULONG                   uBus;
     101    /** Slot number where the device is located (PCI_SLOT_NUMBER). */
     102    ULONG                   uSlot;
     103    /** @} */
     104
     105    /** @name Interrupt stuff.
     106     * @{  */
    96107    /** Interrupt object pointer. */
    97108    PKINTERRUPT             pInterruptObject;
    98 
    99     /** Bus number where the device is located. */
    100     ULONG                   uBus;
    101     /** Slot number where the device is located. */
    102     ULONG                   uSlot;
    103109    /** Device interrupt level. */
    104110    ULONG                   uInterruptLevel;
     
    109115    /** LevelSensitive or Latched. */
    110116    KINTERRUPT_MODE         enmInterruptMode;
     117    /** @} */
    111118
    112119    /** Physical address and length of VMMDev memory. */
     
    116123
    117124    /** Device state. */
    118     VGDRVNTDEVSTATE         enmDevState;
     125    VGDRVNTDEVSTATE volatile enmDevState;
    119126    /** The previous device state. */
    120127    VGDRVNTDEVSTATE         enmPrevDevState;
     
    11961203
    11971204/**
     1205 * Checks if the device is idle.
     1206 * @returns STATUS_SUCCESS if idle, STATUS_UNSUCCESSFUL if busy.
     1207 * @param   pDevExt             The device extension.
     1208 * @param   pszQueryNm          The query name.
     1209 */
     1210static NTSTATUS vgdrvNtCheckIdle(PVBOXGUESTDEVEXTWIN pDevExt, const char *pszQueryNm)
     1211{
     1212    uint32_t cSessions = pDevExt->Core.cSessions;
     1213    if (cSessions == 0)
     1214        return STATUS_SUCCESS;
     1215    LogRel(("vgdrvNtCheckIdle/%s: cSessions=%d\n", pszQueryNm, cSessions));
     1216    return STATUS_UNSUCCESSFUL;
     1217}
     1218
     1219
     1220/**
    11981221 * PnP Request handler.
    11991222 *
     
    12861309            rc = STATUS_UNSUCCESSFUL;
    12871310#endif
    1288             /** @todo refuse to remove ourselves when we've got client
    1289              *        sessions attached...  */
    1290 
     1311            if (NT_SUCCESS(rc))
     1312                rc = vgdrvNtCheckIdle(pDevExt, "QUERY_REMOVE_DEVICE");
    12911313            if (NT_SUCCESS(rc))
    12921314            {
     
    14031425        {
    14041426            Log(("vgdrvNtNt5PlusPnP: QUERY_STOP_DEVICE\n"));
    1405 
    1406             /** @todo Check whether we can stop the device.  Similar to
    1407              *        removal above */
    1408             rc = STATUS_SUCCESS;
     1427            VGDRVNTDEVSTATE const enmOldState = pDevExt->enmDevState;
     1428            rc = vgdrvNtCheckIdle(pDevExt, "QUERY_STOP_DEVICE");
    14091429            if (NT_SUCCESS(rc))
    14101430            {
     
    22242244 * Implements RTL_QUERY_REGISTRY_ROUTINE for enumerating our registry key.
    22252245 */
    2226 static NTSTATUS NTAPI vbdrvNtRegistryEnumCallback(PWSTR pwszValueName, ULONG uValueType,
     2246static NTSTATUS NTAPI vgdrvNtRegistryEnumCallback(PWSTR pwszValueName, ULONG uValueType,
    22272247                                                  PVOID pvValue, ULONG cbValue, PVOID pvUser, PVOID pvEntryCtx)
    22282248{
     
    23562376    RTL_QUERY_REGISTRY_TABLE aQuery[2];
    23572377    RT_ZERO(aQuery);
    2358     aQuery[0].QueryRoutine = vbdrvNtRegistryEnumCallback;
     2378    aQuery[0].QueryRoutine = vgdrvNtRegistryEnumCallback;
    23592379    aQuery[0].Flags        = 0;
    23602380    aQuery[0].Name         = NULL;
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