IoGetDeviceObjectPointer returns STATUS_SHARING_VIOLATION

I tried to call IoGetDeviceObjectPointer() on “\Device\PointerClass2” with FILE_READ_DATA access. i.e. tried to get a pointer to the mouclass object. But it returns STATUS_SHARING_VIOLATION. What could cause this ? I’ve made 2 previous calls on “\Device\PointerClass0” and “\Device\PointerClass1” and both return the device object successfully.

I am calling this function on VirtualBox running Windows XP where “\Device\PointerClass2” is the dummy USB HID mouse device stack and “\Device\PointerClass0” is the actual, virtual PS2 mouse stack device being used. So the cause should not be the fact that the windows subsystem exclusively opened the mouse device, since otherwise, “\Device\PointerClass0” could not be opened, too.

MSDN document didn’t mention why IoGetDeviceObjectPointer() will return STATUS_SHARING_VIOLATION. What would be the possible causes?

> alec lee wrote:

MSDN document didn’t mention why IoGetDeviceObjectPointer()
will return STATUS_SHARING_VIOLATION.

IRP_MJ_CREATE (Mouclass)
https://msdn.microsoft.com/en-us/library/windows/hardware/ff542136(v=vs.85).aspx

The Microsoft Win32 subsystem opens all mouse devices for its exclusive use
during a system boot or after a new mouse device is installed.

Insert your device in the stack in the AddDevice routine.

I think you are seeing the artifact that hid enforces file share access semantics when it handles the open while the ps2 driver doesn?t care. I am surprised your open succeeds in the ps2 case as it should fail at the mouclass layer. Install yourself as a class lower filter below hidclass and this issue goes away

Sent from my Windows 10 phone

From: xxxxx@hotmail.commailto:xxxxx
Sent: Thursday, February 25, 2016 5:43 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] IoGetDeviceObjectPointer returns STATUS_SHARING_VIOLATION

I tried to call IoGetDeviceObjectPointer() on “\Device\PointerClass2” with FILE_READ_DATA access. i.e. tried to get a pointer to the mouclass object. But it returns STATUS_SHARING_VIOLATION. What could cause this ? I’ve made 2 previous calls on “\Device\PointerClass0” and “\Device\PointerClass1” and both return the device object successfully.

I am calling this function on VirtualBox running Windows XP where “\Device\PointerClass2” is the dummy USB HID mouse device stack and “\Device\PointerClass0” is the actual, virtual PS2 mouse stack device being used. So the cause should not be the fact that the windows subsystem exclusively opened the mouse device, since otherwise, “\Device\PointerClass0” could not be opened, too.

MSDN document didn’t mention why IoGetDeviceObjectPointer() will return STATUS_SHARING_VIOLATION. What would be the possible causes?


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:></mailto:xxxxx></mailto:xxxxx>