I am new to driver development, so my question might be a bit naive.

The Situation:
I'm developing a USB-based device. A user can connect or disconnect one or
more of these devices at any time.
I provide a dll to interface between a Windows application and my
kernel-mode driver (under construction). Either I or my customer customer
will create his/her own Windows app, in their favorite programming
environment.

The Problem:
I'd like to provide callback functions in my dll that will execute whenever
a device is connected or disconnected.
I can see that there is an SDK Platform function RegisterDeviceNotification
that allows user code to register for a callback to a window or service. But
I don't have either in my dll. This does not therefore seem to meet my
needs.
I also see that the IO Manager exports the IoRegisterPlugPlayNotification
for drivers. It accepts a callback function argument.

The Questions:
Can I use the IoRegisterPlugPlayNotification function and locate the
callback function be in my (user mode) dll?
Or, is there a way to use the RegisterDeviceNotification user-mode
function with my dll?
Or, is there a better way?

Re: Notifications to a DLL by Maxim

Maxim
Tue Jul 20 11:44:16 CDT 2004

> I can see that there is an SDK Platform function RegisterDeviceNotification
> that allows user code to register for a callback to a window or service. But
> I don't have either in my dll.

Create a thread in your DLL, then create a window in it and spin the message
loop. The notifications will be called by this thread.

> Can I use the IoRegisterPlugPlayNotification function and locate the
> callback function be in my (user mode) dll?

You cannot use Ioxxx functions in the user mode DLL.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com



Re: Notifications to a DLL by Dennis

Dennis
Tue Jul 20 12:50:27 CDT 2004

Hello Maxim,
Thank you for the help.
Could you elaborate on what you mean to "spin the message loop"?
Dennis

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:OqOBKjnbEHA.3664@TK2MSFTNGP12.phx.gbl...
> > I can see that there is an SDK Platform function
RegisterDeviceNotification
> > that allows user code to register for a callback to a window or service.
But
> > I don't have either in my dll.
>
> Create a thread in your DLL, then create a window in it and spin the
message
> loop. The notifications will be called by this thread.
>
> > Can I use the IoRegisterPlugPlayNotification function and locate the
> > callback function be in my (user mode) dll?
>
> You cannot use Ioxxx functions in the user mode DLL.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
>



Re: Notifications to a DLL by Maxim

Maxim
Tue Jul 20 12:54:37 CDT 2004

> Could you elaborate on what you mean to "spin the message loop"?

while( GetMessage(...) )
DispatchMessage(...)

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com



Re: Notifications to a DLL by Dennis

Dennis
Tue Jul 20 15:25:05 CDT 2004

Thanks for the help,
Dennis

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:uInDeKobEHA.1004@TK2MSFTNGP11.phx.gbl...
> > Could you elaborate on what you mean to "spin the message loop"?
>
> while( GetMessage(...) )
> DispatchMessage(...)
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
>