none
Shared access to SpbIoTarget RRS feed

  • Question


  • I would like to know is it possible to open a file handle to SpbIoTarget in Shared mode?

    Example from msdn sets openParams.ShareAccess = 0

    // Open the SPB peripheral device as a remote I/O target.
     
    WDF_IO_TARGET_OPEN_PARAMS openParams;
    WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME(&openParams, &szDeviceName, (GENERIC_READ | GENERIC_WRITE));
    
    openParams.ShareAccess = 0;
    openParams.CreateDisposition = FILE_OPEN;
    openParams.FileAttributes = FILE_ATTRIBUTE_NORMAL;
    
    status = WdfIoTargetOpen(SpbIoTarget, &openParams);

    (http://msdn.microsoft.com/en-us/library/windows/hardware/hh698217(v=vs.85).aspx)

    I tried to change ShareAccess to:

    openParams.ShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;

    but attempt to open the same file for the second time results in STATUS_DEVICE_BUSY.

    Is it possible or do I need set something more?

    Thursday, June 27, 2013 2:33 PM

Answers

  • At this level why would you want two drivers accessing a single device?  What you are basically asking for is the equivalent of having two pieces of code reading and writing the same registers with no provision for coordination.  Your best approach here is to have one driver that accesses the device, then either have it provide two interfaces for what you want to do, or for this driver to act as a bus driver that enumerates two devices that can both access the device.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Thursday, June 27, 2013 2:45 PM

All replies

  • At this level why would you want two drivers accessing a single device?  What you are basically asking for is the equivalent of having two pieces of code reading and writing the same registers with no provision for coordination.  Your best approach here is to have one driver that accesses the device, then either have it provide two interfaces for what you want to do, or for this driver to act as a bus driver that enumerates two devices that can both access the device.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Thursday, June 27, 2013 2:45 PM
  • The targets are exclusive access

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, June 27, 2013 5:53 PM
  • How can I know that the targets are exclusive access and it is not possible to have shared access? I'm looking for some reference or function to test against it.

    pbocian

    Friday, June 28, 2013 6:57 AM