none
WDF_REQUEST_PARAMETERS RRS feed

  • Question

  • Hello:

    I have the need to determine whether an open was done as a "overlapped" or "non-overlapped". So, in the EvtDeviceFileCreate handler

    I retrieve the Request parameters:

        WDF_REQUEST_PARAMETERS      ReqParams;

      WDF_REQUEST_PARAMETERS_INIT(&ReqParams);
      WdfRequestGetParameters(Request, &ReqParams);

     Now, does anyone have the bitmap definition of: ReqParams.Parameters.Create.Options ?

    The other fileds are:

    1/ FileAttributes ==> what does this map to in user mode CreateFile's input parameter? Is this maped to lpSecurityAttributes ?

    2/ ShareAccess ==> I believe this one is mapped to dwShareMode in user mode CreateFile

    3/ EaLength ==> probably nothing important here ....

    So, the 2 fields that I see in kernel mode are: Options, and FileAttributes. I need to have a bit map definitions of these each of this field,

    and the corresponding user mode field/bitmap.

    thanks,

    K


    KAL

    Thursday, January 31, 2013 6:58 PM

Answers

  • I would argue that even with knowing if the handle was overlapped or not, you are just masking the underlying problem. you probably need to read data from the port continuously and buffer it in your filter to make sure the port is constantly read from and MUX'ed properly

    read http://msdn.microsoft.com/en-us/library/windows/hardware/ff545834(v=vs.85).aspx on the Flags field in the PFILE_OBJECT itself (it is not a create parameter) and check for the appropriate FO_Xxx flag


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

    Thursday, January 31, 2013 10:12 PM
  • No the Parameters.Create.Options only contains some of the items.


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

    • Marked as answer by Kiet Ly Friday, February 1, 2013 6:41 PM
    Friday, February 1, 2013 11:55 AM
  • Because that is how the OS was implemented . If I were to guess why, the Parameters are applicable only to create processing while the Flags are used on every Io or outside of create


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

    • Marked as answer by Kiet Ly Friday, February 1, 2013 6:40 PM
    Friday, February 1, 2013 3:33 PM

All replies

  • The overlapped flag is consumed by the I/O Manager.  You should never worry about this in a driver, for all drivers consider the value to "overlapped".

    Don


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

    Thursday, January 31, 2013 7:08 PM
  • as a driver, you should never make a runtime choice whether the file handle has been opened as overlapped or not. if you can't complete a request when presented, always put it into a queue, preferably in a cancelable state, and process it later.


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

    • Marked as answer by Doron Holan [MSFT] Thursday, January 31, 2013 7:08 PM
    • Unmarked as answer by Kiet Ly Thursday, January 31, 2013 8:12 PM
    Thursday, January 31, 2013 7:08 PM
  • I have a filter driver that sit on top of  a RS-232 PORT class driver. It creates 2 virtual control devices. One of the control device is created as a custom class/port, this is for our device management service. The other one is internally connected to a virtual bus driver that is responsible to enumerate a mirror of the port it sit on. This port is externally available for application to access as if it access the original rs232 port.

    So the filter driver acts like an adapter/multiplexer, it creates 2 virtual ports from an existing ports. If application 1 opens the first port with one of the mode, say "non-overlapped". And the other application opens the other port with different mode, "overlapped".

    This seems to create inconsistency of the way data is being read from the rs-232 port. Occationally, I see a gap of 3 to 4 sec of no data to the 2nd port, and then a large block of data coming in from the rs-232 driver. Now, remember, the data is sent by the device during the silent gap. Just that the rs232 driver sit below the filter driver did not deliver that data.

    When both applications open both port using the same mode, either both with "overlapped" or "non-overlapped". In other words, the mode is consistent, then the data come in just as expect, the behavior that I describe above goes away.

    Any comments on the above behavior, as to if this is expected or not.

    Also, say:

    1/ app 1 opens port 1 first with "non-overlapped"

    2/ Then app 2 opens port 2 later with "overlapped"

    3/ Both apps start reading data

    4/ which data mode is the rs-232 data coming in? the last one or both?


    KAL

    Thursday, January 31, 2013 7:50 PM
  • Now, on to your question. See my earlier post for the reason why I need read access to this field. Say, if I get stuck with the inconsistent port open. One remedy for this would be having the filter driver keeping track of the open mode for both ports and provide this information to the application so that it can reopen the port so that it would be consistent with the other.

    KAL

    Thursday, January 31, 2013 8:15 PM
  • just have the apps always open non overlapped and be done with it.  no need to make the driver overly complicated.


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

    Thursday, January 31, 2013 9:07 PM
  • You are correct if we write both applications ourselve. The issue is that one of the port (i.e. port 1) which is the mirror of the original port that the filter sits on can be any third party application, and we have no control at. This application may open the port in any mode.

    Now, back to my original question. I just need to know the bit definition of the ReqParams.Parameters.Create.Options. Which bit(s) define the overlapped/non-overlapped mode?


    KAL

    Thursday, January 31, 2013 9:30 PM
  • I would argue that even with knowing if the handle was overlapped or not, you are just masking the underlying problem. you probably need to read data from the port continuously and buffer it in your filter to make sure the port is constantly read from and MUX'ed properly

    read http://msdn.microsoft.com/en-us/library/windows/hardware/ff545834(v=vs.85).aspx on the Flags field in the PFILE_OBJECT itself (it is not a create parameter) and check for the appropriate FO_Xxx flag


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

    Thursday, January 31, 2013 10:12 PM
  • When you create your virtual ports, are you using a symbolic link to the real port device object or are you creating your own pdevice_object that is opened? The only way overlapped and non overlapped would interfere is if they are against the same underlying device object. Even then, Io being presented on each handle will not interfere with each other

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

    Thursday, January 31, 2013 10:24 PM
  • Not sure that I see the connection between the Flags field in the PFILE_OBJECT and what is in the Parameters.Create.Options field ?


    KAL

    Thursday, January 31, 2013 10:33 PM
  • The FO_SYNCHRONOUS_IO flag indicates non-overlapped.


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

    Thursday, January 31, 2013 10:42 PM
  • There is no connection between Flags and Parameters.Create.Options. You need to get the underlying wdm file object and check the Flags field directly

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

    Thursday, January 31, 2013 10:44 PM
  • Why can't one derive the overlapped mode setting from Parameters.Create.Options ? Doesn't this field hold the FlagsAndAttributes field of the corresponding CreateFile() call?

    Just curious as to why you have to go to the FILE_OBJECT route ?


    KAL

    Friday, February 1, 2013 3:13 AM
  • No the Parameters.Create.Options only contains some of the items.


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

    • Marked as answer by Kiet Ly Friday, February 1, 2013 6:41 PM
    Friday, February 1, 2013 11:55 AM
  • Because that is how the OS was implemented . If I were to guess why, the Parameters are applicable only to create processing while the Flags are used on every Io or outside of create


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

    • Marked as answer by Kiet Ly Friday, February 1, 2013 6:40 PM
    Friday, February 1, 2013 3:33 PM
  • Okay, thanks.


    KAL

    Friday, February 1, 2013 6:40 PM