[wdmaudiodev] Re: [wdm.8723083]Re: [wdmaudiodev]: Calling a user defined function from kernel space

  • From: priv <wdm.8723083@xxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Mon, 9 Apr 2007 05:19:59 -0400

It depends what you want to achieve.  In any aspects, polling is not a
good idea for driver anyway.

You may want to send a message from driver when something in driver
occurs, and setup your application to listen that message.  After
user-mode application receive the message, then you can call your
function in the user space and/or use IOCTL for what you really want
to do.

On 4/9/07, AsHwAtH <itsmeash@xxxxxxxxx> wrote:
Ok, Thank you for the suggestion.

But how are callbacks really implemented then?
If I keep calling DeviceIOControl from my application(like polling), it
drains CPU usage.




 On 4/9/07, Eugene Muzychenko <emuzychenko@xxxxxxxxx> wrote:
> Hello AsHwAtH,
>
> > From my application I am passing the address of the User defined
function to
> > the driver through my own IOCTL call.
> > I store this address in the driver as a function pointer and call it
when a
> > particular condition is met inside the MSVAD.
>
> Before trying to develop (and even modify) a kernel-mode driver, you
> must clearly understand the differences between user and kernel
> execution modes, address space, thread contexts etc. Your attempt to
> directly call a user-mode function from the kernel-mode driver means
> that you have almost no such knowledge. In this situation, your work
> will be very inefficient, resulting many incorrect solutions.
>
> Your driver could inject some code into a requesting
> process, create an auxiliary thread that will watch for some event
> signaled by the driver and call a specified function. But it will be
> very complex for you to implement. So a simplest way is to create a
> thread from your application and not to pass function address to the
> driver.
>
> Regards,
> Eugene
>
> ******************
>
> WDMAUDIODEV addresses:
> Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
> Subscribe:    mailto:
wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
> Unsubscribe:
mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
> Moderator:    mailto:
wdmaudiodev-moderators@xxxxxxxxxxxxx
>
> URL to WDMAUDIODEV page:
> http://www.wdmaudiodev.com/
>
>


******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: