From: Dannel on
The subject says it all, but more specifically, I want to write a virtual
joystick device driver for Vista x64 similar to ppjoy.

If you're not familiar with ppjoy, it basically creates a joystick device
that may/may not physically exist and receives its input through an API from
various sources, allowing the user to basically map out their own joystick
that may not have native drivers or whose drivers may be lacking in
configurability.

I'm new to driver development, but not new to programming. I'm looking for
resources on how to get started. I know I have the DDK disc lying around
somewhere, but that's about as much as I know about driver development at
this point.

Again, I need to support Vista x64, so can anyone suggest a book that may
cover that in particular, or some other resource that discusses creating a
virtual device that I can use as a starting point?

Thanks in advance!

Dannel

From: Tim Roberts on
"Dannel" <dannel(a)aaronexodus.com> wrote:
>
>The subject says it all, but more specifically, I want to write a virtual
>joystick device driver for Vista x64 similar to ppjoy.
>...
>I'm new to driver development, but not new to programming. I'm looking for
>resources on how to get started. I know I have the DDK disc lying around
>somewhere, but that's about as much as I know about driver development at
>this point.

The DDK/WDK has most of the information you need. Up through the Vista
WDK, there is a virtual HID driver sample (src\hid\vhidmini). The lastest
Win 7 WDK has HID samples, although vhidmini is gone.

>Again, I need to support Vista x64, so can anyone suggest a book that may
>cover that in particular, or some other resource that discusses creating a
>virtual device that I can use as a starting point?

The HID stack has changed hardly at all in the last 10 or 15 years, so any
references you find are likely to help. You will probably want to use KMDF
for this, so the Microsoft Press book on "Developing Drivers with the
Windows Driver Foundation" will help.
--
Tim Roberts, timr(a)probo.com
Providenza & Boekelheide, Inc.
From: Dannel on
Thanks Tim!

I eventually did realize vhidmini was a sample I needed to look at and found
out it was missing from the most recent WDK, but I did find a useful sample
hidusbfx2 that I should be able to use, too.

Thank you for the book recommendation. The WDK documentation is great, but
as far as starting out goes, I really don't know where to begin. Hopefully
the book will have more of a step-by-step outline of the workflow, because
quite frankly I've learned a lot by reading through the docs but really
don't know how to put any of it together.

I just wish I could get the book today. I'm excited to get started and
waiting for it to be shipped puts a damper on my energy lol

Dannel

"Tim Roberts" <timr(a)probo.com> wrote in message
news:2306b55702cpkis64iekb65725ldpmeluh(a)4ax.com...
> "Dannel" <dannel(a)aaronexodus.com> wrote:
>>
>>The subject says it all, but more specifically, I want to write a virtual
>>joystick device driver for Vista x64 similar to ppjoy.
>>...
>>I'm new to driver development, but not new to programming. I'm looking for
>>resources on how to get started. I know I have the DDK disc lying around
>>somewhere, but that's about as much as I know about driver development at
>>this point.
>
> The DDK/WDK has most of the information you need. Up through the Vista
> WDK, there is a virtual HID driver sample (src\hid\vhidmini). The lastest
> Win 7 WDK has HID samples, although vhidmini is gone.
>
>>Again, I need to support Vista x64, so can anyone suggest a book that may
>>cover that in particular, or some other resource that discusses creating a
>>virtual device that I can use as a starting point?
>
> The HID stack has changed hardly at all in the last 10 or 15 years, so any
> references you find are likely to help. You will probably want to use
> KMDF
> for this, so the Microsoft Press book on "Developing Drivers with the
> Windows Driver Foundation" will help.
> --
> Tim Roberts, timr(a)probo.com
> Providenza & Boekelheide, Inc.

From: Tim Roberts on
"Dannel" <dannel(a)aaronexodus.com> wrote:
>
>Thank you for the book recommendation. The WDK documentation is great, but
>as far as starting out goes, I really don't know where to begin. Hopefully
>the book will have more of a step-by-step outline of the workflow, because
>quite frankly I've learned a lot by reading through the docs but really
>don't know how to put any of it together.

Drivers spend their entire lives responding to events. First, you're
loaded, and you get a DriverEntry call. Then, your device is found, and
you get an AddDevice call. Then, you get a set of PnP requests (most of
which you can ignore).

After that, your life is a serious of Read, Write, and Ioctl requests from
above, and (depending on the device type) interrupts or completions from
below.

And that, in a nutshell, describes 99% of the drivers on the planet.
--
Tim Roberts, timr(a)probo.com
Providenza & Boekelheide, Inc.
From: alberto on
Hi, Dannel,

I would do it in this order.

0. High priority, really, believe me: do this first. Get yourself a
copy of Rubini's book on Linux device drivers. There's a minimalist do-
nothing starter driver in there that's less than 10 lines of code. Get
yourself a Linux machine, install it, run it. Or download a copy of
VMWare's Client, install it in your machine, and install some Linux
version on top of it. If you have a Linux installed, it's a five
minute job to run that driver, and it's an eye opener too.

Once you do that, there's a Linux parallel port driver on the web,
also a few lines of code, written by a guy called Calbet. You solder a
wire on a parallel port connector, plug it into your printer port, and
presto, you have a device to test a driver against! What you will
achieve with this exercise is, you will now know what a device driver
is, and you will have gone in and out of it with a minimum amount of
sweat. You may have to go through a lot of extra aggravation to get
the same result on Windows, but then you will know the difference
between the driver itself and the driver's support system. Drivers are
simple if you know the underlying hardware; a driver's support system,
on the other hand, can be deadly complex. And believe me, it's way
easier to learn how to write Windows drivers if you already have some
background on Linux drivers.

1. Get yourself a copy of Walter Oney's book. It's still the bible.
Read its first four chapters at least! You need to build some kind of
mental picture of how a Windows driver stack looks like before you
want to try to write any driver code, and this book explains it
nicely.

2. Make sure you have two computers: one's your host, the other's your
target. Make sure both machines have a functional Firewire connection.
No, serial's not good enough, and USB is too complicated for comfort.
Use Firewire for debugging. Also, I would not use a 64 bit operating
system on either machine, specially on your target - and I may be
overconservative, but I would install Windows XP in the target if I
was a beginner.

3. Download the latest WDK from Microsoft and install it in your host
computer.

4. Download the Windows Debugging Tools - which includes the windbg
debugger - and install them in your host computer.

5. Follow the directions in the Windbg documentation to make sure that
both your host and target machines are debugger-ready.

6. Connect that Firewire cable between your two machines.

7. Learn how to use Windbg before you start writing driver code!

8. Download a copy of DbgView from the SysInternals web site and learn
how to use it.

9. I wouldn't start with WDF. Not with WDM either. For starters, I
would write a toy "legacy" driver, they need less code than WDM or WDF
drivers, and they're easier and more straightforward to control. My
first Windows driver was a "Fortune cookie" issuer that would send a
fortune phrase every time the application issued a Read. You may want
to peruse the WDK samples, but Walter Oney's book used to have a
minimal driver (in the attached CD) which was a useful starting point.
In fact, I first wrote my Fortune driver under Linux, and then ported
it to Windows. Or you may feel adventurous, and just convert that
parallel port driver to Windows.

10. Learn how to compile, build and deploy a Windows driver using the
DDK cmd line environments. Learn how to control where you want your
resulting .sys file placed. Learn how to ask for a .pdb file., how to
tell Windbg where it is, and how to tell Windbg where your source code
is. You're going to need it.

11. Learn how to get your .sys file loaded into your target machine.
For starters, a simple machine-to-machine copy command will do. Later
you will learn about INF files, but right now it's too early.

12. Learn how to set up the required Registry entries for your legacy
driver. Learn the "net start" and "net stop" commands. Get your
Registry path variable to point to where your .sys file is.

13. Once you get that driver working, you will have learned (1) the
structure of a Windows driver, (2) how to build and install a driver,
and (3) how to debug it.

14, Now you can learn WDF, Plug and Play, and all the rest! The basis
will have been built. It may look daunting, but the above process
shouldn't take more than one week of your attention.

15. Last but not least, learn *all* you can learn about the underlying
hardware. Machine, buses, joysticks, bridges, you name it. After all,
drivers drive hardware! The more hardware stuff you know the better
you will be.


Hope this helps,


Alberto.



On Sep 16, 1:36 pm, "Dannel" <dan...(a)aaronexodus.com> wrote:
> The subject says it all, but more specifically, I want to write a virtual
> joystick device driver for Vista x64 similar to ppjoy.
>
> If you're not familiar with ppjoy, it basically creates a joystick device
> that may/may not physically exist and receives its input through an API from
> various sources, allowing the user to basically map out their own joystick
> that may not have native drivers or whose drivers may be lacking in
> configurability.
>
> I'm new to driver development, but not new to programming. I'm looking for
> resources on how to get started. I know I have the DDK disc lying around
> somewhere, but that's about as much as I know about driver development at
> this point.
>
> Again, I need to support Vista x64, so can anyone suggest a book that may
> cover that in particular, or some other resource that discusses creating a
> virtual device that I can use as a starting point?
>
> Thanks in advance!
>
> Dannel

/