Need to learn COM for driver development

Hi!

I am starting the development of an audio miniport driver. According to the DDK
section in MSDN, this type of driver is extensively build with COM. Before to
start writing code, i would like to get some basics on COM.

My questions are:

  • Do you know any good introductory books on COM, preferably with an WDM driver
    example? ( I am doing my own searches on Amazon.com but just in case you know a
    better book than those i will find )

  • What is the best way to learn COM?

Thanks for answering my questions!

Chi-Truc Dinh =)

Master Candidate in Computer Engineering
École Polytechnique de Montréal

Chi Truc Dinh wrote:

Hi!

I am starting the development of an audio miniport driver. According to the DDK
section in MSDN, this type of driver is extensively build with COM. Before to
start writing code, i would like to get some basics on COM.

My questions are:

  • Do you know any good introductory books on COM, preferably with an WDM driver
    example? ( I am doing my own searches on Amazon.com but just in case you know a
    better book than those i will find )

Two of the best overall books on COM are “Inside OLE” by Microsoft’s
Kraig Brockschmidt, and “Essential COM” by Don Box.

  • What is the best way to learn COM?

That depends on how you learn. For me, I learn best by example. I
would download several samples, read through the code, compile them and
look at the generated assembler, and trace through them in a debugger.
However, everyone learns differently.

The workings of COM are not a great mystery. A COM interface is nothing
more than a C++ pure virtual base class, and a COM object is just an
instance of a class that implements one or more such interfaces.
There’s some cool stuff involving the registry and marshalling across
different processes, but for audio miniports, you don’t really need to
worry about that.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

A while ago, I wrote an example of a WDM driver that uses WMI/COM. See
http://home.mindspring.com/~antognini/ and look under “WDM filter driver.”
You’ll find this useful especially for the C++/COM user-space techniques,
which are little described when it comes to the driver area.

This Web site is my personal effort, so take it as-is. An improved version
of this example will, however, appear in the upcoming WDK.


James Antognini
Windows DDK and WDK Support

This posting is provided “AS IS” with no warranties, and confers no rights.

“Chi Truc Dinh” wrote in message
news:xxxxx@ntdev…
> Hi!
>
> I am starting the development of an audio miniport driver. According to
> the DDK
> section in MSDN, this type of driver is extensively build with COM.
> Before to
> start writing code, i would like to get some basics on COM.
>
> My questions are:
> - Do you know any good introductory books on COM, preferably with an WDM
> driver
> example? ( I am doing my own searches on Amazon.com but just in case you
> know a
> better book than those i will find )
>
> - What is the best way to learn COM?
>
>
> Thanks for answering my questions!
>
>
> Chi-Truc Dinh =)
>
> Master Candidate in Computer Engineering
> École Polytechnique de Montréal
>

To Toby Opferman, Tim Roberts and James Antognini,

Thanks again for your helpful feedback and references! I will take a
high-interest look to them from now on.

Regards,

Chi-Truc =)


A while ago, I wrote an example of a WDM driver that uses WMI/COM. See
http://home.mindspring.com/~antognini/ and look under “WDM filter driver.”
You’ll find this useful especially for the C++/COM user-space techniques,
which are little described when it comes to the driver area.

This Web site is my personal effort, so take it as-is. An improved version
of this example will, however, appear in the upcoming WDK.


James Antognini
Windows DDK and WDK Support


“COM” is just a method of asking a module to provide you with an interface. The
“COM” part is really just the standard interface of doing just that (as opposed
to writing your own).

So, an interface as a unique GUID and someone calls into your module
“QueryInterface” with the GUID. Then what do you do? If you have that interface
you simply return it to him. He can then use this interface to perform his
actions.

There are a few generic interfaces that need to be supported, then the rest are
your own. QueryInterface to get other interfaces, AddRef and I think release or
something, as COM objects get tomaintain a reference count so they know when to
go away.

There I just saved you 50 bucks.

Also, here’s a short link that tells you what you need to know:
http://msdn.microsoft.com/library/en-us/AudStream/hh/audstream/pcdesign_4284b721-acef-452f-b9f4-6390fda77717.xml.asp

There are actually good examples of audio drivers in the DDK and there are
actually 2 seperate methods of writing an audio driver (worked with audio
drivers last year). There’s one that’s based on streams and another that’s
based on DMA buffering, wave cyclic and wave stream or something, I forget the
exact names right now but both examples can be found in the DDK /src/wdm/audio.
AC97 is one method and the Sound Blaster example has the other. Ac97 is what I
worked with and that was provided sound buffers where I think SB wasn’t provided
the buffers directly. You’ll figure it out.

Thanks,

Toby


Selon Tim Roberts :

> Chi Truc Dinh wrote:
>
> >Hi!
> >
> >I am starting the development of an audio miniport driver. According to the
> DDK
> >section in MSDN, this type of driver is extensively build with COM. Before
> to
> >start writing code, i would like to get some basics on COM.
> >
> >My questions are:
> >- Do you know any good introductory books on COM, preferably with an WDM
> driver
> >example? ( I am doing my own searches on Amazon.com but just in case you
> know a
> >better book than those i will find )
> >
> >
>
> Two of the best overall books on COM are “Inside OLE” by Microsoft’s
> Kraig Brockschmidt, and “Essential COM” by Don Box.
>
> >- What is the best way to learn COM?
> >
> >
>
> That depends on how you learn. For me, I learn best by example. I
> would download several samples, read through the code, compile them and
> look at the generated assembler, and trace through them in a debugger.
> However, everyone learns differently.
>
> The workings of COM are not a great mystery. A COM interface is nothing
> more than a C++ pure virtual base class, and a COM object is just an
> instance of a class that implements one or more such interfaces.
> There’s some cool stuff involving the registry and marshalling across
> different processes, but for audio miniports, you don’t really need to
> worry about that.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@polymtl.ca
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>