VirtualBox

Changeset 18075 in vbox


Ignore:
Timestamp:
Mar 18, 2009 5:31:20 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
44718
Message:

Windows guest additions: fixed detection of the emulated PS/2 mouse in the VBoxMouse.sys.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/MouseFilter/VBoxMouse.cpp

    r16863 r18075  
    171171    if (!vboxIsHostMouseFound ())
    172172    {
    173         WCHAR wszProperty[512];
    174         ULONG ResultLength = 0;
    175         wszProperty[0] = 0;
    176         NTSTATUS status = IoGetDeviceProperty(devExt->PDO, DevicePropertyDeviceDescription,
    177                                               sizeof (wszProperty),
    178                                               &wszProperty,
    179                                               &ResultLength);
    180         dprintf(("VBoxMouse::vboxDeviceAdded: looking for host mouse: %ls Len is %d, status %x\n",
    181                  wszProperty, ResultLength, status));
     173        NTSTATUS status;
     174        UCHAR Property[512];
     175        ULONG ResultLength;
     176
     177        ResultLength = 0;
     178        status = IoGetDeviceProperty(devExt->PDO, DevicePropertyBootConfiguration,
     179                                     sizeof (Property),
     180                                     &Property,
     181                                     &ResultLength);
     182
     183        dprintf(("VBoxMouse::vboxDeviceAdded: looking for host mouse: Len is %d, status %x\n",
     184                 ResultLength, status));
    182185
    183186        if (status == STATUS_SUCCESS)
    184187        {
    185             UNICODE_STRING MicrosoftPS2Mouse;
    186             RtlInitUnicodeString (&MicrosoftPS2Mouse, L"Microsoft PS/2 Mouse");
    187             UNICODE_STRING DeviceDescription;
    188             RtlInitUnicodeString (&DeviceDescription, wszProperty);
    189 
    190             if (RtlCompareUnicodeString (&DeviceDescription, &MicrosoftPS2Mouse, TRUE) == 0)
     188            /* Check whether the device claims the IO port 0x60. */
     189            BOOLEAN bPort60h = FALSE;
     190
     191            CM_RESOURCE_LIST *pResourceList = (CM_RESOURCE_LIST *)&Property[0];
     192
     193            dprintf(("Configuration: descriptors %d\n",
     194                      pResourceList->Count));
     195
     196            ULONG iDescriptor = 0;
     197            for (; iDescriptor < pResourceList->Count; iDescriptor++)
    191198            {
    192                 /* Mark the PS/2 device as the Host one, that is the emulated mouse.
     199                CM_FULL_RESOURCE_DESCRIPTOR *pFullDescriptor = &pResourceList->List[iDescriptor];
     200
     201                dprintf(("Descriptor %d: InterfaceType %d, BusType %d, list ver %d, list rev %d, count %d\n",
     202                         iDescriptor,
     203                         pFullDescriptor->InterfaceType,
     204                         pFullDescriptor->BusNumber,
     205                         pFullDescriptor->PartialResourceList.Version,
     206                         pFullDescriptor->PartialResourceList.Revision,
     207                         pFullDescriptor->PartialResourceList.Count));
     208
     209                ULONG iPartialDescriptor = 0;
     210                for (; iPartialDescriptor < pFullDescriptor->PartialResourceList.Count; iPartialDescriptor++)
     211                {
     212                    CM_PARTIAL_RESOURCE_DESCRIPTOR *pPartialDescriptor = &pFullDescriptor->PartialResourceList.PartialDescriptors[iPartialDescriptor];
     213
     214                    dprintf(("  PartialDescriptor %d: type %d, ShareDisposition %d, Flags 0x%04X, Start 0x%llx, length 0x%x\n",
     215                             iPartialDescriptor,
     216                             pPartialDescriptor->Type, pPartialDescriptor->ShareDisposition, pPartialDescriptor->Flags,
     217                             pPartialDescriptor->u.Generic.Start.QuadPart, pPartialDescriptor->u.Generic.Length));
     218
     219                    if (pPartialDescriptor->Type == CmResourceTypePort)
     220                    {
     221                        if (pPartialDescriptor->u.Port.Start.QuadPart == 0x60)
     222                        {
     223                            bPort60h = TRUE;
     224                        }
     225                    }
     226                }
     227            }
     228
     229            if (bPort60h)
     230            {
     231                /* It's the emulated 8042 PS/2 mouse/kbd device, so mark it as the Host one.
    193232                 * For this device the filter will query absolute mouse coords from the host.
    194233                 */
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