- IoGetDeviceObjectPointer getting STATUS_SHARING_VIOLATION?
- Posted by Josh Dahlby on October 23rd, 2003
I'm using IoGetDeviceObjectPointer to open \??\PhysicalDrive0. This works
fine, unless my application opens it before calling the driver. In which
case I get STATUS_SHARING_VIOLATION (0xC0000043).
I open it from my application using:
CreateFile("\\\\.\\PhysicalDrive0", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
From within my driver I open it using:
IoGetDeviceObjectPointer(L"\\??\\PhysicalDrive0", FILE_READ_DATA, &fileObj,
&deviceObj);
Is this not allowed? I can call CreateFile multiple times from my
application to open the device and that seems to work fine, but using
IoGetDeviceObjectPointer doesn't work.
Thanks,
Josh
- Posted by Mark Roddy on October 24th, 2003
On Thu, 23 Oct 2003 09:55:37 -0700, "Josh Dahlby" <n/a> wrote:
The share access implied by IoGetDeviceObjectPointer is incompatible
with that requested by your application. Essentially
IoGetDeviceObjectPointer is opening the device exclusive (share
nothing) and that can't happen if it is already opened by the
application for share read/write. You could implement your own version
of IoGetDeviceObjectPointer by using ZwOpenFile and specifying
appropriate share access. (Use IoGetRelatedDeviceObject to get the
device object.)
=====================
Mark Roddy
Windows XP/2000/NT Consulting, Microsoft DDK MVP
Hollis Technology Solutions 603-321-1032
www.hollistech.com
markr@hollistech.com
For Windows Device Driver Training: see www.azius.com
- Posted by Josh Dahlby on October 24th, 2003
That did it. Thanks a lot Mark. I was wondering why
IoGetDeviceObjectPointer didn't have a share access parameter...
"Mark Roddy" <mroddy@tellink.net> wrote in message
news:19qgpvcj4ju8c08fvc0hdla9jevthlspuv@4ax.com...
- IoGetDeviceObjectPointer in Win98 (Drivers) by NG
- symbolic link and IoGetDeviceObjectPointer (Drivers) by crimson13

