Passing MSVAD buffer to user space

Discussion in 'Windows Vista Drivers' started by liquidl@email.com, May 24, 2005.

  1. Guest

    Hi All,

    I am working with the MSVAD from the Win XP DDK. What I'd like to do
    is to share the buffer "m_pDataBuffer" (non-paged pool) with the
    user-space because I'd like to do some further processing on the
    captured data in user space. I have done some research and there's a
    few ways:

    1) Use DeviceIoControl and use METHOD_IN_DIRECT or METHOD_OUT_DIRECT.
    2) Mapping kernel memory to user memory.
    3) Use Shared Memory Object Method (memory-mapped file backed by the
    paging file)

    In case of MSVAD, I just don't see how I can use method 1 because this
    is a "passive" driver and I see no code to handle IOCTLs.

    Method 2 is ok but you have to call MmMapLockedPagesSpecifyCache() from
    the context of the process that will be using the mapping. I am not
    sure that this will work for MSVAD because the app will be run after
    the driver is loaded and the context will be arbitrary.

    Method 3 is not recommended by MS because "the scope of the address is
    limited to the process in which the object is mapped, and it cannot be
    accessed in a DPC or ISR."
    Ref: http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q191840
    I am not sure if Method 3 effects the MSVAD driver. Can anyone explain
    how to use this method to give user-space access?

    Does anyone know how else I can map "m_pDataBuffer" to user-space, with
    MSVAD in particular??

    The stuff I have read references real device drivers and things get
    muddy when you are using MSVAD because it is a virtual device driver.
    Any help appreciated.

    Regards,

    James
     
    , May 24, 2005
    #1
    1. Advertisements

  2. Guest

    Hi,

    The code for allocation of the buffer is:

    m_pDataBuffer = (PBYTE)
    ExAllocatePoolWithTag
    (
    NonPagedPool,
    m_ulBufferSize,
    MSVAD_POOLTAG
    );

    I'd like to share this memory with the user-space. Can I use a named
    section object created by the driver using zwCreateSection() ? Or is
    there a better way to do this? This particular driver doesn't have an
    IOCTL interface that I know of, no device name, and no read function
    implmentation. As such it is a "passive" sort of driver (from how I
    understand it). What's a way to share memory with a user app with this
    sort of driver??

    Any tips are appreciated.

    Regards,

    James
     
    , May 25, 2005
    #2
    1. Advertisements

  3. Tulup Guest

    sorry for misunderstanding, but why you simple can't build capture graph
    (user mode), play it and receive this buffer in (user mode) dshow filter ?

    "" wrote:

    > Hi,
    >
    > The code for allocation of the buffer is:
    >
    > m_pDataBuffer = (PBYTE)
    > ExAllocatePoolWithTag
    > (
    > NonPagedPool,
    > m_ulBufferSize,
    > MSVAD_POOLTAG
    > );
    >
    > I'd like to share this memory with the user-space. Can I use a named
    > section object created by the driver using zwCreateSection() ? Or is
    > there a better way to do this? This particular driver doesn't have an
    > IOCTL interface that I know of, no device name, and no read function
    > implmentation. As such it is a "passive" sort of driver (from how I
    > understand it). What's a way to share memory with a user app with this
    > sort of driver??
    >
    > Any tips are appreciated.
    >
    > Regards,
    >
    > James
    >
    >
     
    Tulup, May 25, 2005
    #3
  4. > I'd like to share this memory with the user-space.

    Shared memory is a bad idea due to several reasons (synchronizing access to it
    and security). Why not use some better data transfer mechanism like the IOCTL
    flow?

    --
    Maxim Shatskih, Windows DDK MVP
    StorageCraft Corporation

    http://www.storagecraft.com
     
    Maxim S. Shatskih, May 25, 2005
    #4
  5. Guest

    Hi,

    Can you expand on this method please? According to my research, MSVAD
    is the way to go in order to capture audio data going out to the sound
    card.

    Thanks,

    James
     
    , May 25, 2005
    #5
  6. Guest

    Hi,

    This is a WDM miniport driver inside an adapter driver. As such, it
    has no IOCTL handling code nor direct read method implementation. I
    only wish it were a "normal" driver so I could apply the IOCTL flow
    method.

    Regards,

    James
     
    , May 25, 2005
    #6
  7. Tulup Guest

    Look. I can fill m_pDataBuffer with silence in CopyTo method call, create
    user mode graph with msvad capture filter play it and hear silence. Isn't it
    sharing m_pDataBuffer with user mode ?

    <> wrote in message
    news:...
    > Hi,
    >
    > Can you expand on this method please? According to my research, MSVAD
    > is the way to go in order to capture audio data going out to the sound
    > card.
    >
    > Thanks,
    >
    > James
    >
     
    Tulup, May 30, 2005
    #7
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Mike

    User-space buffer, what's the difference?

    Mike, Jan 30, 2004, in forum: Windows Vista Drivers
    Replies:
    3
    Views:
    254
    Alexander Grigoriev
    Feb 1, 2004
  2. M  Taha Masood

    user mode sample app for MSVAD ( virtual audio driver ) ?

    M Taha Masood, May 10, 2005, in forum: Windows Vista Drivers
    Replies:
    6
    Views:
    2,057
    M Taha Masood
    May 24, 2005
  3. tsindia

    system.buffer not copied back to user space

    tsindia, Feb 17, 2006, in forum: Windows Vista Drivers
    Replies:
    4
    Views:
    249
    Gary G. Little
    Feb 21, 2006
  4. David

    Enlarge from a buffer to another buffer

    David, Aug 30, 2007, in forum: Windows Vista Drivers
    Replies:
    5
    Views:
    628
    Tim Roberts
    Sep 2, 2007
  5. Jaydeep

    MSVAD buffer size problem.

    Jaydeep, Jan 9, 2008, in forum: Windows Vista Drivers
    Replies:
    0
    Views:
    1,033
    Jaydeep
    Jan 9, 2008
  6. Don Burn

    Re: Map user space buffer into kernel space?

    Don Burn, Aug 21, 2009, in forum: Windows Vista Drivers
    Replies:
    0
    Views:
    916
    Don Burn
    Aug 21, 2009
  7. Maxim S. Shatskih

    Re: Map user space buffer into kernel space?

    Maxim S. Shatskih, Aug 21, 2009, in forum: Windows Vista Drivers
    Replies:
    0
    Views:
    1,057
    Maxim S. Shatskih
    Aug 21, 2009
  8. msnews.microsoft.com
    Replies:
    0
    Views:
    2,726
    msnews.microsoft.com
    Sep 14, 2005
Loading...