Keystroke Dump

Hai
I am trying to write a Keyboard device filter driver in KMDF.I want to dump the keystroke into a file or i want to log keystroke to a console window…and to trap a hot key.

To write in to a file,I tried to create a file using ZwCreate file function.Its not working…
I don’t know whether KMDF supports Zwcreatefile kind of functions…
Or some other API’s are there for file handling in WDF?

Thanks in advance…

KMDF is a Framework and not a miniport environment. ANYTHING you can do via
the native NT API for drivers can be done in a KMDF driver. There are some
things you shouldn’t do and maybe a few modifications that are required to
interface properly with the PnP/Power management provided by KMDF, but
everything else is as it has been. ZwCreateFile will work just as well as
under the native NT API for drivers. I just have problems calling it WDM
since I know the original meaning of WDM was to refer to a limited subset of
NT that was ported to 9x. The Microsoft types do call it WDM, but I am
still resisting.

wrote in message news:xxxxx@ntdev…
> Hai
> I am trying to write a Keyboard device filter driver in KMDF.I want to
> dump the keystroke into a file or i want to log keystroke to a console
> window…and to trap a hot key.
>
> To write in to a file,I tried to create a file using ZwCreate file
> function.Its not working…
> I don’t know whether KMDF supports Zwcreatefile kind of functions…
> Or some other API’s are there for file handling in WDF?
>
>
> Thanks in advance…
>

What is the failure status for ZwCreateFile? How are you specifying the file name? You can also use a remote WDFIOTARGET and specify the file name when you open the target and then use format & send apis to write to it.

BUT, regardless of if you use ZwCreateFile directly or the WDFIOTARGET, the file system requires that you send io to it at passive level (at least handle based io, which this is). The service callback which receives the keystrokes runs at dispatch level, which means you will need to have a work item which you queue from the callback so that you can write to the file at passive.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of David Craig
Sent: Tuesday, November 04, 2008 12:23 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Keystroke Dump

KMDF is a Framework and not a miniport environment. ANYTHING you can do via
the native NT API for drivers can be done in a KMDF driver. There are some
things you shouldn’t do and maybe a few modifications that are required to
interface properly with the PnP/Power management provided by KMDF, but
everything else is as it has been. ZwCreateFile will work just as well as
under the native NT API for drivers. I just have problems calling it WDM
since I know the original meaning of WDM was to refer to a limited subset of
NT that was ported to 9x. The Microsoft types do call it WDM, but I am
still resisting.

wrote in message news:xxxxx@ntdev…
> Hai
> I am trying to write a Keyboard device filter driver in KMDF.I want to
> dump the keystroke into a file or i want to log keystroke to a console
> window…and to trap a hot key.
>
> To write in to a file,I tried to create a file using ZwCreate file
> function.Its not working…
> I don’t know whether KMDF supports Zwcreatefile kind of functions…
> Or some other API’s are there for file handling in WDF?
>
>
> Thanks in advance…
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Dave,

KMDF is a Framework and not a miniport environment.

Whatever it’s defined or it’s called, it still appears to *me* a fancy miniport environment. It’s a fancy miniport for everything else.

OP, to capture keystroke, you don’t need a driver. I remember one can register message hook back in WinAPI day.


Calvin Guan
Broadcom Corp.
Connecting Everything(r)

— On Tue, 11/4/08, David Craig wrote:

> From: David Craig
> Subject: Re:[ntdev] Keystroke Dump
> To: “Windows System Software Devs Interest List”
> Received: Tuesday, November 4, 2008, 12:22 AM
> KMDF is a Framework and not a miniport environment.
> ANYTHING you can do via
> the native NT API for drivers can be done in a KMDF driver.
> There are some
> things you shouldn’t do and maybe a few modifications
> that are required to
> interface properly with the PnP/Power management provided
> by KMDF, but
> everything else is as it has been. ZwCreateFile will work
> just as well as
> under the native NT API for drivers. I just have problems
> calling it WDM
> since I know the original meaning of WDM was to refer to a
> limited subset of
> NT that was ported to 9x. The Microsoft types do call it
> WDM, but I am
> still resisting.
>
> wrote in message
> news:xxxxx@ntdev…
> > Hai
> > I am trying to write a Keyboard device filter driver
> in KMDF.I want to
> > dump the keystroke into a file or i want to log
> keystroke to a console
> > window…and to trap a hot key.
> >
> > To write in to a file,I tried to create a file using
> ZwCreate file
> > function.Its not working…
> > I don’t know whether KMDF supports Zwcreatefile
> kind of functions…
> > Or some other API’s are there for file handling in
> WDF?
> >
> >
> > Thanks in advance…
> >
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars
> visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online
> at http://www.osronline.com/page.cfm?name=ListServer

__________________________________________________________________
Get a sneak peak at messages with a handy reading pane with All new Yahoo! Mail: http://ca.promos.yahoo.com/newmail/overview2/

I think the point here is a bit subtle. Miniport in windows has traditionally meant that you can only call functions exported by the port driver you are linking against, calling any functions outside of the port driver is either illegal (storport, videoport), an escape to functionality that does not exist in the port (ndis-wdm), or undefined. The of KMDF OTOH readily accepts that you will be making api calls outside of the framework, it was intentionally written not to abstract everything under the sun and that you should be making api calls outside of the framework when you need to

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Calvin Guan
Sent: Tuesday, November 04, 2008 11:15 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Keystroke Dump

Dave,

KMDF is a Framework and not a miniport environment.

Whatever it’s defined or it’s called, it still appears to *me* a fancy miniport environment. It’s a fancy miniport for everything else.

OP, to capture keystroke, you don’t need a driver. I remember one can register message hook back in WinAPI day.


Calvin Guan
Broadcom Corp.
Connecting Everything(r)

— On Tue, 11/4/08, David Craig wrote:

> From: David Craig
> Subject: Re:[ntdev] Keystroke Dump
> To: “Windows System Software Devs Interest List”
> Received: Tuesday, November 4, 2008, 12:22 AM
> KMDF is a Framework and not a miniport environment.
> ANYTHING you can do via
> the native NT API for drivers can be done in a KMDF driver.
> There are some
> things you shouldn’t do and maybe a few modifications
> that are required to
> interface properly with the PnP/Power management provided
> by KMDF, but
> everything else is as it has been. ZwCreateFile will work
> just as well as
> under the native NT API for drivers. I just have problems
> calling it WDM
> since I know the original meaning of WDM was to refer to a
> limited subset of
> NT that was ported to 9x. The Microsoft types do call it
> WDM, but I am
> still resisting.
>
> wrote in message
> news:xxxxx@ntdev…
> > Hai
> > I am trying to write a Keyboard device filter driver
> in KMDF.I want to
> > dump the keystroke into a file or i want to log
> keystroke to a console
> > window…and to trap a hot key.
> >
> > To write in to a file,I tried to create a file using
> ZwCreate file
> > function.Its not working…
> > I don’t know whether KMDF supports Zwcreatefile
> kind of functions…
> > Or some other API’s are there for file handling in
> WDF?
> >
> >
> > Thanks in advance…
> >
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars
> visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online
> at http://www.osronline.com/page.cfm?name=ListServer

__________________________________________________________________
Get a sneak peak at messages with a handy reading pane with All new Yahoo! Mail: http://ca.promos.yahoo.com/newmail/overview2/


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer