user mode ISR--is it okay???

hi all,

I have a dll and a driver for a pci card which need to service the
interrupts…

I need the Application programmer who uses the dll, to write his own
interrupt handler in the user-mode using the user mode functions which I
give in the dll…

Now the thing is how do I attach the Interrupt Handler written in user
mode finally to get attached with the
IoConnectInterrupt() function indirectly…

I can find some list message that the above is not possilble due to NT’s
integrity, but some where I can find, this can be done u;sing APC’s…

Please give me a clear picture,

  1. whether can I use USER-MODE isr and finally attach the function’s
    address along with the IoConnectinterrupt

  2. if so, then give me some tips on how to do this…

3)if not, what is the alternative

thanx,

shiv

Shiva Prasad. T. S.:

I have a dll and a driver for a pci card which need to service the
interrupts…

I need the Application programmer who uses the dll, to write his own
interrupt handler in the user-mode using the user mode functions which I
give in the dll…

Now the thing is how do I attach the Interrupt Handler written in user
mode finally to get attached with the
IoConnectInterrupt() function indirectly…

I can find some list message that the above is not possilble due to NT’s
integrity, but some where I can find, this can be done u;sing APC’s…

Please give me a clear picture,

  1. whether can I use USER-MODE isr and finally attach the function’s
    address along with the IoConnectinterrupt

  2. if so, then give me some tips on how to do this…

3)if not, what is the alternative

Don’t try it, while there are potential kludges that will allow user space
code to run as part of an ISR they are kludges. I would instead use one
the multitude of kernel to user space communication methods to handle
this. Consider have an event that the user space application has a thread
waiting on, and have the DPC routine for the ISR set the event.

Don Burn
Windows NT/2000/XP Filesystem and Device Driver Consulting

Hello from CUBA!

IoConnectInterrupt is intended to be used by kernel mode components to
handle device interrupts. In other words,
“you cannot connect an interrupt to a user-mode ISR”. To notify user
mode applications of interesting kernel mode events, the most effective
way to achieve this is to use user APCs. Because the default behavior of
user APCs is that they are delivered only when the target thread is in
an “alertable wait state”, you have to employ some tricks to force the
APC to be delivered without the thread to be waiting for anything.
Interestingly, after you queue a user APC to some user thread and
explicitly set the “UserApcPending” field in the target thread object,
the APC will be delivered “as soon as the thread runs in user mode
again”. Keep in mind, however, that the offset of the UserApcPending
field may vary from one Windows version to another.

I hope this helps,

Ciao e buona fortuna

Albert Almeida

The others have given you the proper answer, which is that ISRs and users mode shouldn’t mix.

However, depending upon your hardware, you could have a driver that disables interrupts
in its ISR, and waits for the user program to issue one IOCTL that waits for the interupt,
and another IOCTL that causes the interrupt to be re-enabled. You’d have to cleanup
properly on a close.

This would work if there are no timing constraints imposed by the hardware, and low
performance requirements.
“Shiva Prasad. T. S.” wrote in message news:xxxxx@ntdev…
>
> hi all,
>
> I have a dll and a driver for a pci card which need to service the
> interrupts…
>
> I need the Application programmer who uses the dll, to write his own
> interrupt handler in the user-mode using the user mode functions which I
> give in the dll…
>
> Now the thing is how do I attach the Interrupt Handler written in user
> mode finally to get attached with the
> IoConnectInterrupt() function indirectly…
>
> I can find some list message that the above is not possilble due to NT’s
> integrity, but some where I can find, this can be done u;sing APC’s…
>
> Please give me a clear picture,
> 1) whether can I use USER-MODE isr and finally attach the function’s
> address along with the IoConnectinterrupt
>
> 2) if so, then give me some tips on how to do this…
>
> 3)if not, what is the alternative
>
> thanx,
>
> shiv
>
>