Hooking Interrupts

“Gregory G. Dyess” wrote in message news:xxxxx@ntdev…
>
> Ladies and Gentleman,
> We have not only beat this horse to death and kept beating a dead
> horse, we have dug up the corps and started beating again! As strong as
my
> views are on this matter, it’s time to end it. We are going to all have
to
> agree to respectfully disagree. I only wish we could force software
> suppliers to provide warning labels on their software that lets the
consumer
> know they haven’t followed the guidelines issued by the OS manufacturer.
As
> much as I hate lawsuits, I see them as the only way to force software
> suppliers to stop these insane practices.
>

I think you will be pleasantly surprised by some of the changes Microsoft is
proposing in exactly this area.

p.s. you can never stop a thread by proclaiming the thread terminated,
especially if you add to the discussion, thus violating your own
proclamation.

unless you are pgv :slight_smile:


===
Mark Roddy
Consultant
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

Stable computers and low level hooks are orthogonal - one doesn’t imply the
absense of the other. If you want reasons for instability, look no further
than a new operating system every semester.

Alberto.

-----Original Message-----
From: PeterB [mailto:xxxxx@inkvine.fluff.org]
Sent: Wednesday, March 13, 2002 4:21 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Hooking Interrupts

On Tue, 12 Mar 2002, Moreira, Alberto wrote:

And no, not every
driver, even production level, is intended to work on mission critical
systems: building a mission-critical driver for a wordly PC home
application
or even for a business application is, as I see, a gross case of
overengineering.
It is fortunate that you don’t write anything that unsuspecting computer
users might have to install.

Everyone deserves a stable computer. It doesn’t matter what they’re
doing. Downtime from hardware failures is tolerable, downtime from
software failures is not.


Peter xxxxx@inkvine.fluff.org
http://www.inkvine.fluff.org/~peter/

logic kicks ass:
(1) Horses have an even number of legs.
(2) They have two legs in back and fore legs in front.
(3) This makes a total of six legs, which certainly is an odd number of
legs for a horse.
(4) But the only number that is both odd and even is infinity.
(5) Therefore, horses must have an infinite number of legs.


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

Gregory,

Sorry, but y ou are taking this problem too far , with "As much as I hate
lawsuits, I see them as the only way to force software … ".
As I recall , some judges ruled that code can be assimilated to “free
speach”. Do you hate so much somebody who dont agree with your way to see
things to denay them the right to free speach and tell me by law how I
should code a driver??? And do you want to me to put a label on my box
“Programmed in concordance with person’s X views” . Lemme remind you why MS
signs drivers, and issues strong warning when one tries to install an
unsigned driver. Exactly to serve the same purpouse as your label. I do
agree with your general point of view above this matter, but why dont you
let everyone judge this issue by itslef ? I bet if I ask you how to
implement an IPI mechanism in NT for my own purposes , youll respond to the
question “DONT TO THAT. Keep that for toy operating systems.”, instead of
responding at the object. But what if my target requires custom IPI service
routines ? Even if you know the right way to implement this on NT, I bet you
wont tell me how to doit on the list. The way as I see things, designing &
choosing best solutions for a certain driver regardless is general purpose
or for a custom , targeted environment, should not be done by average
kernel mode coder, but by a person who know what it does. What is funny on
those lists, I often see messages like “Dont do this and dont do that” but
the person who writes them is often unable to provide themselvs another
solution. Why ppl cant simply reply at SUBJECT , and politly add that this
solution is not recomended , and maybe the design of the product should be
re-evaluated ?

Best regards, Dan

----- Original Message -----
From: “Gregory G. Dyess”
To: “NT Developers Interest List”
Sent: Wednesday, March 13, 2002 3:37 PM
Subject: [ntdev] Re: Hooking Interrupts

> Ladies and Gentleman,
> We have not only beat this horse to death and kept beating a dead
> horse, we have dug up the corps and started beating again! As strong as
my
> views are on this matter, it’s time to end it. We are going to all have
to
> agree to respectfully disagree. I only wish we could force software
> suppliers to provide warning labels on their software that lets the
consumer
> know they haven’t followed the guidelines issued by the OS manufacturer.
As
> much as I hate lawsuits, I see them as the only way to force software
> suppliers to stop these insane practices.
>
> OK, let’s drop this endless debate and get the S/N (Signal to Noise) ratio
> back up above background now.
>
> Greg
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to %%email.unsub%%
>

You miss my point.

As Mihal pointed out, my interest is in teaching techniques. DESIGN
techniques, that is. I’m NOT trying to teach them how to use APIs, even for
something as bizantyne as Windows driver writing. To draw an utopian image,
I’m in the business of shaping up future designers of the OS that’s going to
make Windows obsolete. And I can’t do my job if I can’t do anything outside
the party line.

So, the point is this: an ISR is what hooks out of the IDT, and an OS type
should know how to hook an ISR out of an IDT. The fact that Windows has put
its own ISRs in every IDT slot and provides no API to let you put in your
own ISR is already a restriction, but then, one can live with it if one has
a clear idea of what’s going on. In that respect, teaching a course with
Linux is a far superior proposition - NOT because Linux is any less advanced
than Windows (it ain’t!), but because I have access to the source code, and
I can show my students EXACTLY what’s going on.

Another example: I want to be able to build a task gate on the IDT, and show
my students how to build an interrupt task. I want to be able to show my
students what happens when I put an interrupt gate in the IDT with
protection ring 1 instead of 0.

Better, if I really care to teach them how to hook interrupts safely, I can
give them a homework to add their own ISR handling to the Linux kernel,
recompile it, and go. Can’t do that with Windows !

This is not about “cutting corners” or anything of that sort. What I want is
something very simple: I want to be able to instate my own interrupt routine
by giving two parameters: a pointer to my ISR and an index into the IDT.
Simple, eh ?

But in the end you guys may be right, I’m seriously considering dropping
Windows from my next course, and doing it all on Linux, or even better, on
Solaris. I guess I already told you this little story: I went through a
whole amount of gyrations to tell them how to put together a toy Windows
driver. Then I spent a grand total of five minutes showing how to do the
same thing under Linux. So, this amazed student asks, "is that it ? "

Yes, I said, that’s IT. It’s called design, excellence. Straight and to the
point. I wish Windows was a bit more like that.

Alberto.

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Tuesday, March 12, 2002 11:19 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Hooking Interrupts

As usual, only few attempts to answer original question and
many kind or not-so-kind attempts to forbid even trying.
Haven’t we had this discussion many times ago? Alberto
clearly expressed the purpose: teach OS techniques. Good
teaching means understanding and for understanding it is
necessary to show how things work. To show it is sometimes
necessary to use non-standard techniques. It doesn’t mean
students should use these techniques in their drivers (if
any), but they can use them for testing or debugging purposes.

I’m sorry, but what Alberto said originally was “I want to write an
example driver that hooks an interrupt, but I’m having a problem doing
it in a well behaved way.” He can’t, as there is no ‘well behaved way’
to ‘hook an interrupt’ in NT, (nor in my opinion should there be.) Hack
away Alberto, teach your students how to hack hastily in the OS too, but
if you ask how to cut corners without cutting corners I will note that
your request is absurd.

=====================
Mark Roddy
Windows XP/2000/NT Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
xxxxx@hollistech.com
For Windows Device Driver Training: see www.azius.com


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

Brian, sorry, that’s a non-sequitur. Linux is at least good a server OS as
Windows, and yet it doesn’t impose a byzantine environment on its driver
writers. Also, I am NOT trying to teach fundamental OS behavior, I’m trying
to teach people HOW TO DESIGN that fundamental OS behavior. So, an integral
part of it is the ability of CHANGING that OS behavior to see where it
leads.

But if you believe that Windows is any more “extremely advanced” than Linux,
heck, maybe you deserve what you get !

Alberto.

-----Original Message-----
From: xxxxx@bsquare.com [mailto:xxxxx@bsquare.com]
Sent: Wednesday, March 13, 2002 1:53 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Hooking Interrupts

I would say you ought not be writing commercial production drivers then,
which you aren’t, so we are okay. This is the totally wrong approach.
The whole push of the industry has been to push server class features and
stability to the home PC and OS. Ask any user of a home PC what
frustrates them most, and you will hear something about “the stupid
machine crashes all the time”, everytime. Not to mention the lines
between server and home PC are getting blurrier every day. So, I don’t
know how you could know what type of system your production driver will go
into in most cases.

All in all, what I think is wrong here, and take my opinions for what they
are worth, is you are using the wrong tool for the job. You are trying to
teach basic operating system behavior with an extremely advanced OS. You
would be much better off using Linux, or CE, or maybe a multi-threaded
RTOS to teach fundamental operating system behavior. With these platforms
you can ‘own the world’. Anyway, NT and its derivatives are not first
semester OSes :slight_smile:

Bill McKenzie


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

Give me a break.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Dan Partelly
Sent: Wednesday, March 13, 2002 9:16 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Hooking Interrupts

Gregory,

Sorry, but y ou are taking this problem too far , with "As much as I hate
lawsuits, I see them as the only way to force software … ".
As I recall , some judges ruled that code can be assimilated to “free
speach”. Do you hate so much somebody who dont agree with your way to see
things to denay them the right to free speach and tell me by law how I
should code a driver??? And do you want to me to put a label on my box
“Programmed in concordance with person’s X views” . Lemme remind you why MS
signs drivers, and issues strong warning when one tries to install an
unsigned driver. Exactly to serve the same purpouse as your label. I do
agree with your general point of view above this matter, but why dont you
let everyone judge this issue by itslef ? I bet if I ask you how to
implement an IPI mechanism in NT for my own purposes , youll respond to the
question “DONT TO THAT. Keep that for toy operating systems.”, instead of
responding at the object. But what if my target requires custom IPI service
routines ? Even if you know the right way to implement this on NT, I bet you
wont tell me how to doit on the list. The way as I see things, designing &
choosing best solutions for a certain driver regardless is general purpose
or for a custom , targeted environment, should not be done by average
kernel mode coder, but by a person who know what it does. What is funny on
those lists, I often see messages like “Dont do this and dont do that” but
the person who writes them is often unable to provide themselvs another
solution. Why ppl cant simply reply at SUBJECT , and politly add that this
solution is not recomended , and maybe the design of the product should be
re-evaluated ?

Best regards, Dan

----- Original Message -----
From: “Gregory G. Dyess”
To: “NT Developers Interest List”
Sent: Wednesday, March 13, 2002 3:37 PM
Subject: [ntdev] Re: Hooking Interrupts

> Ladies and Gentleman,
> We have not only beat this horse to death and kept beating a dead
> horse, we have dug up the corps and started beating again! As strong as
my
> views are on this matter, it’s time to end it. We are going to all have
to
> agree to respectfully disagree. I only wish we could force software
> suppliers to provide warning labels on their software that lets the
consumer
> know they haven’t followed the guidelines issued by the OS manufacturer.
As
> much as I hate lawsuits, I see them as the only way to force software
> suppliers to stop these insane practices.
>
> OK, let’s drop this endless debate and get the S/N (Signal to Noise) ratio
> back up above background now.
>
> Greg
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to %%email.unsub%%
>


You are currently subscribed to ntdev as: xxxxx@pdq.net
To unsubscribe send a blank email to %%email.unsub%%

Alberto, I really do not have any problem at all with teaching students how
to build operating system interrupt handling mechanisms, but that was not
the question you asked initially.

" want to write an example driver that hooks an interrupt, but I’m having a
problem doing it in a well behaved way. I don’t want to do it in the WDM
way, it’s too complicated for a beginner. But the old HalGetInterruptVector
way is no longer documented in the DDK - my students are having problems
finding good documentation. I’m a machine level guy and I feel tempted to
just go and frig the IDT by hand, but I would like to teach them some DDK
techniques. So, here’s the question: if I want, say, to hook a timer
interrupt with my own ISR/DPC pair, in a way that’s blessed at least by the
“legacy” DDK Driver way, what are my choices ? Inquiring minds want to know.
:-)"

You claimed that there was no ‘wdm’ way to do this as the way that
supposedly existed in nt4 had disappeared in w2k/xp. You then asked if there
was a ‘blessed’ way to ‘hook the timer interrupt’. The answer is no there
isn’t. Furthermore, there never was. Finally HalGetInterruptVector remains
documented and supported (although marked obsolete.)

You can ‘frig the interrupt table’ all you want in nt, but perhaps nt is
doing things in its interrupt preamble/postamble constructs that your
‘interrupt table frigging’ is defeating? Maybe there is actually a reason
why nt is constructed the way it is, other than to make your life difficult?

Mark Roddy
Consultant
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032
“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…
>
> You miss my point.
>
> As Mihal pointed out, my interest is in teaching techniques. DESIGN
> techniques, that is. I’m NOT trying to teach them how to use APIs, even
for
> something as bizantyne as Windows driver writing. To draw an utopian
image,
> I’m in the business of shaping up future designers of the OS that’s going
to
> make Windows obsolete. And I can’t do my job if I can’t do anything
outside
> the party line.
>
> So, the point is this: an ISR is what hooks out of the IDT, and an OS type
> should know how to hook an ISR out of an IDT. The fact that Windows has
put
> its own ISRs in every IDT slot and provides no API to let you put in your
> own ISR is already a restriction, but then, one can live with it if one
has
> a clear idea of what’s going on. In that respect, teaching a course with
> Linux is a far superior proposition - NOT because Linux is any less
advanced
> than Windows (it ain’t!), but because I have access to the source code,
and
> I can show my students EXACTLY what’s going on.
>
> Another example: I want to be able to build a task gate on the IDT, and
show
> my students how to build an interrupt task. I want to be able to show my
> students what happens when I put an interrupt gate in the IDT with
> protection ring 1 instead of 0.
>
> Better, if I really care to teach them how to hook interrupts safely, I
can
> give them a homework to add their own ISR handling to the Linux kernel,
> recompile it, and go. Can’t do that with Windows !
>
> This is not about “cutting corners” or anything of that sort. What I want
is
> something very simple: I want to be able to instate my own interrupt
routine
> by giving two parameters: a pointer to my ISR and an index into the IDT.
> Simple, eh ?
>
> But in the end you guys may be right, I’m seriously considering dropping
> Windows from my next course, and doing it all on Linux, or even better, on
> Solaris. I guess I already told you this little story: I went through a
> whole amount of gyrations to tell them how to put together a toy Windows
> driver. Then I spent a grand total of five minutes showing how to do the
> same thing under Linux. So, this amazed student asks, "is that it ? "
>
> Yes, I said, that’s IT. It’s called design, excellence. Straight and to
the
> point. I wish Windows was a bit more like that.
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: Mark Roddy [mailto:xxxxx@hollistech.com]
> Sent: Tuesday, March 12, 2002 11:19 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Hooking Interrupts
> >
> > As usual, only few attempts to answer original question and
> > many kind or not-so-kind attempts to forbid even trying.
> > Haven’t we had this discussion many times ago? Alberto
> > clearly expressed the purpose: teach OS techniques. Good
> > teaching means understanding and for understanding it is
> > necessary to show how things work. To show it is sometimes
> > necessary to use non-standard techniques. It doesn’t mean
> > students should use these techniques in their drivers (if
> > any), but they can use them for testing or debugging purposes.
> >
>
> I’m sorry, but what Alberto said originally was “I want to write an
> example driver that hooks an interrupt, but I’m having a problem doing
> it in a well behaved way.” He can’t, as there is no ‘well behaved way’
> to ‘hook an interrupt’ in NT, (nor in my opinion should there be.) Hack
> away Alberto, teach your students how to hack hastily in the OS too, but
> if you ask how to cut corners without cutting corners I will note that
> your request is absurd.
>
>
> =====================
> Mark Roddy
> Windows XP/2000/NT Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
> xxxxx@hollistech.com
> For Windows Device Driver Training: see www.azius.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to %%email.unsub%%
>
>

> I went through a

whole amount of gyrations to tell them how to put together a toy Windows
driver. Then I spent a grand total of five minutes showing how to do the
same thing under Linux. So, this amazed student asks, "is that it ? "

I bet a non-PNP ‘toy’ driver complexity is about same
for both Windows and Linux. A Win PNP driver is
more complex but you have nothing to compare
in Linux world - there are no PNP at all. I afraid you
have misleaded your amazed student :slight_smile:

Gera.

Actually, I claimed that the wdm way is too complicated for a beginner. And
obviously if I want to hook an interrupt, there’s got to be a good reason
for it eh ? The convoluted but useful HalGetInterruptVector way is no longer
documented in the DDK, at least I don’t call a three-line disclaimer
“documentation”. Also, true, I couldn’t get hold of a timer ISR with it, but
I could get other interrupts, which would have helped me.

You know, you guys could spare me this nonsense about sticking to the party
line. Unfortunately, my several professional hats force me to go look for
the nonstandard and off-the-beaten-track stuff, I specialize in doing things
that need lateral thinking and bending the rules before they can be done !
I’m looking for ways of doing it while minimizing the amount of nonsense I
have to go through. The reason I posted the question was, I’m not that
familiar with the ins and outs of the Microsoft API, and maybe there was
something I overlooked, or maybe some new stuff I don’t as yet know about.
Take it as a compliment - many of you know a whole lot more about the
Windows driver API than I do, every time I post a question here I’m bowing
to your knowledge !

Alberto.

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Wednesday, March 13, 2002 10:57 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Hooking Interrupts

Alberto, I really do not have any problem at all with teaching students how
to build operating system interrupt handling mechanisms, but that was not
the question you asked initially.

" want to write an example driver that hooks an interrupt, but I’m having a
problem doing it in a well behaved way. I don’t want to do it in the WDM
way, it’s too complicated for a beginner. But the old HalGetInterruptVector
way is no longer documented in the DDK - my students are having problems
finding good documentation. I’m a machine level guy and I feel tempted to
just go and frig the IDT by hand, but I would like to teach them some DDK
techniques. So, here’s the question: if I want, say, to hook a timer
interrupt with my own ISR/DPC pair, in a way that’s blessed at least by the
“legacy” DDK Driver way, what are my choices ? Inquiring minds want to know.
:-)"

You claimed that there was no ‘wdm’ way to do this as the way that
supposedly existed in nt4 had disappeared in w2k/xp. You then asked if there
was a ‘blessed’ way to ‘hook the timer interrupt’. The answer is no there
isn’t. Furthermore, there never was. Finally HalGetInterruptVector remains
documented and supported (although marked obsolete.)

You can ‘frig the interrupt table’ all you want in nt, but perhaps nt is
doing things in its interrupt preamble/postamble constructs that your
‘interrupt table frigging’ is defeating? Maybe there is actually a reason
why nt is constructed the way it is, other than to make your life difficult?

Mark Roddy
Consultant
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032
“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…
>
> You miss my point.
>
> As Mihal pointed out, my interest is in teaching techniques. DESIGN
> techniques, that is. I’m NOT trying to teach them how to use APIs, even
for
> something as bizantyne as Windows driver writing. To draw an utopian
image,
> I’m in the business of shaping up future designers of the OS that’s going
to
> make Windows obsolete. And I can’t do my job if I can’t do anything
outside
> the party line.
>
> So, the point is this: an ISR is what hooks out of the IDT, and an OS type
> should know how to hook an ISR out of an IDT. The fact that Windows has
put
> its own ISRs in every IDT slot and provides no API to let you put in your
> own ISR is already a restriction, but then, one can live with it if one
has
> a clear idea of what’s going on. In that respect, teaching a course with
> Linux is a far superior proposition - NOT because Linux is any less
advanced
> than Windows (it ain’t!), but because I have access to the source code,
and
> I can show my students EXACTLY what’s going on.
>
> Another example: I want to be able to build a task gate on the IDT, and
show
> my students how to build an interrupt task. I want to be able to show my
> students what happens when I put an interrupt gate in the IDT with
> protection ring 1 instead of 0.
>
> Better, if I really care to teach them how to hook interrupts safely, I
can
> give them a homework to add their own ISR handling to the Linux kernel,
> recompile it, and go. Can’t do that with Windows !
>
> This is not about “cutting corners” or anything of that sort. What I want
is
> something very simple: I want to be able to instate my own interrupt
routine
> by giving two parameters: a pointer to my ISR and an index into the IDT.
> Simple, eh ?
>
> But in the end you guys may be right, I’m seriously considering dropping
> Windows from my next course, and doing it all on Linux, or even better, on
> Solaris. I guess I already told you this little story: I went through a
> whole amount of gyrations to tell them how to put together a toy Windows
> driver. Then I spent a grand total of five minutes showing how to do the
> same thing under Linux. So, this amazed student asks, "is that it ? "
>
> Yes, I said, that’s IT. It’s called design, excellence. Straight and to
the
> point. I wish Windows was a bit more like that.
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: Mark Roddy [mailto:xxxxx@hollistech.com]
> Sent: Tuesday, March 12, 2002 11:19 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Hooking Interrupts
> >
> > As usual, only few attempts to answer original question and
> > many kind or not-so-kind attempts to forbid even trying.
> > Haven’t we had this discussion many times ago? Alberto
> > clearly expressed the purpose: teach OS techniques. Good
> > teaching means understanding and for understanding it is
> > necessary to show how things work. To show it is sometimes
> > necessary to use non-standard techniques. It doesn’t mean
> > students should use these techniques in their drivers (if
> > any), but they can use them for testing or debugging purposes.
> >
>
> I’m sorry, but what Alberto said originally was “I want to write an
> example driver that hooks an interrupt, but I’m having a problem doing
> it in a well behaved way.” He can’t, as there is no ‘well behaved way’
> to ‘hook an interrupt’ in NT, (nor in my opinion should there be.) Hack
> away Alberto, teach your students how to hack hastily in the OS too, but
> if you ask how to cut corners without cutting corners I will note that
> your request is absurd.
>
>
> =====================
> Mark Roddy
> Windows XP/2000/NT Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
> xxxxx@hollistech.com
> For Windows Device Driver Training: see www.azius.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to %%email.unsub%%
>
>


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

Gera,

No, I didn’t mislead my students !

I was doing NT drivers, not PnP. Consider: by the time you install MSVC,
install the DDK, learn about the difference between checked and free builds,
figure out what to write in your “sources” file, make sure you have a
makefile in your directory, go through the levels of indirection required by
makefile.def and build.exe, copy the files to system32\drivers (or grow some
white hairs trying to make ImagePath say what you want!), spend time
frigging the registry, a lot of water went under the bridge. To me as a
college instructor, all that time is overhead, it contributes nothing to my
bottom line. While in Linux, you go “gcc -S -c source.c”, “mknod /dev/blah m
n”, and “insmod source.o”, and you’re done. That’s IT. No DDK, no build.exe,
no registry, no sources file, no dirs file, no special checked build window
(why the heck can’t I build a driver in a standard dos box, or, why can’t
they give me something in Windows that behaves just like my XTerm ?). All
that you need to develop a driver is already natively installed in the OS,
you just sit down and do it.

And I believe Kernel 2.4 has some PnP ? I didn’t dig deep yet, but looks
like it’s there. At least I have changed my network card a couple of times
on my Linux machine here at work, and the system picked it up glitchless.

Alberto.

-----Original Message-----
From: Gera Kazakov [mailto:xxxxx@setengineering.com]
Sent: Wednesday, March 13, 2002 11:00 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Hooking Interrupts

I went through a
whole amount of gyrations to tell them how to put together a toy Windows
driver. Then I spent a grand total of five minutes showing how to do the
same thing under Linux. So, this amazed student asks, "is that it ? "

I bet a non-PNP ‘toy’ driver complexity is about same
for both Windows and Linux. A Win PNP driver is
more complex but you have nothing to compare
in Linux world - there are no PNP at all. I afraid you
have misleaded your amazed student :slight_smile:

Gera.


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

Anytime , if you keep your mouth shut as well.

----- Original Message -----
From: “Gregory G. Dyess”
To: “NT Developers Interest List”
Sent: Wednesday, March 13, 2002 5:41 PM
Subject: [ntdev] Re: Hooking Interrupts

> Give me a break.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Dan Partelly
> Sent: Wednesday, March 13, 2002 9:16 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Hooking Interrupts
>
>
>
> Gregory,
>
> Sorry, but y ou are taking this problem too far , with "As much as I
hate
> lawsuits, I see them as the only way to force software … ".
> As I recall , some judges ruled that code can be assimilated to “free
> speach”. Do you hate so much somebody who dont agree with your way to see
> things to denay them the right to free speach and tell me by law how I
> should code a driver??? And do you want to me to put a label on my box
> “Programmed in concordance with person’s X views” . Lemme remind you why
MS
> signs drivers, and issues strong warning when one tries to install an
> unsigned driver. Exactly to serve the same purpouse as your label. I do
> agree with your general point of view above this matter, but why dont you
> let everyone judge this issue by itslef ? I bet if I ask you how to
> implement an IPI mechanism in NT for my own purposes , youll respond to
the
> question “DONT TO THAT. Keep that for toy operating systems.”, instead of
> responding at the object. But what if my target requires custom IPI
service
> routines ? Even if you know the right way to implement this on NT, I bet
you
> wont tell me how to doit on the list. The way as I see things, designing &
> choosing best solutions for a certain driver regardless is general
purpose
> or for a custom , targeted environment, should not be done by average
> kernel mode coder, but by a person who know what it does. What is funny
on
> those lists, I often see messages like “Dont do this and dont do that” but
> the person who writes them is often unable to provide themselvs another
> solution. Why ppl cant simply reply at SUBJECT , and politly add that this
> solution is not recomended , and maybe the design of the product should
be
> re-evaluated ?
>
> Best regards, Dan
>
>
>
>
> ----- Original Message -----
> From: “Gregory G. Dyess”
> To: “NT Developers Interest List”
> Sent: Wednesday, March 13, 2002 3:37 PM
> Subject: [ntdev] Re: Hooking Interrupts
>
>
> > Ladies and Gentleman,
> > We have not only beat this horse to death and kept beating a dead
> > horse, we have dug up the corps and started beating again! As strong as
> my
> > views are on this matter, it’s time to end it. We are going to all have
> to
> > agree to respectfully disagree. I only wish we could force software
> > suppliers to provide warning labels on their software that lets the
> consumer
> > know they haven’t followed the guidelines issued by the OS manufacturer.
> As
> > much as I hate lawsuits, I see them as the only way to force software
> > suppliers to stop these insane practices.
> >
> > OK, let’s drop this endless debate and get the S/N (Signal to Noise)
ratio
> > back up above background now.
> >
> > Greg
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@pdq.net
> To unsubscribe send a blank email to %%email.unsub%%
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to %%email.unsub%%
>

Everyone is always going on and on, saying “don’t do that,” “that’s
bad,” “you’re stupid to try that.” Why do windows developers reject
exploration so much? What is the harm in me writing something or other that
crashes my system? It isn’t fair to assume that everyone who is doing
kernel stuff in windows is doing it with some particular purpose in mind.
(read: not everyone has devices they need to drive, and not everyone is
writing stuff they plan to release. Some people just want to fool around
and see what they can do. Is that so wrong?) Why can’t we just people have
their fun?

And just to head off what I know the response will be, I know that Linux
is all about exploration and doing kooky stuff with everything. I’ve known
it for years. But that doesn’t change the fact that I like windows better
than Linux. Otherwise I would have happily switched years ago. But I like
win32 (because I know how to get things done with it), and I like the
programs (msdev) and hardware support I can get with windows. So I’m stuck
in an unpleasant place.

I don’t know how useful it will be, or even if its correct, but AFAIK
the interrupt vectors are stored at the start of RAM, and you can use
MmMapIoSapce to see it. We used this trying to achieve blue screen of pong,
but never got anywhere. (We didn’t know what to put in there.) Sticking a
function pointer in there seemed to mess things up pretty quick. If you
ever figure out how to do the hooking, could you clue me in? I’d appreciate
it.

What class are you teaching, and where? I wish VT had a class like
that.

-brian

My holy GOD guys … there is NOTHING wrong with “hooking” an interrupt!!! I
do believe that is why GOD created IoConnectInterrupt, is it not? You do
have to have a valid IRQ, vector and level obtained from a valid source, but
hooking an interrupt will not destabilize a system. Alberto asked a “How do
I …” question and I believe in this case he was letting WDM obfuscate the
issue. So use the NT4 DDK and bedone with it already!!! If the timer IRQ
ain’t available then use a serial port or the parallel port, for crying out
loud.

Shame on us … he asked a valid question and we obliterated it in
pontifical obscurity.


Gary G. Little
xxxxx@broadstor.com
xxxxx@inland.net

“Eric Lee Steadle” wrote in message
news:xxxxx@ntdev…
>
>
>
> >>building a mission-critical driver for a wordly PC home application
> >>or even for a business application is, as I see, a gross case of
> >>overengineering.
>
>
> Why is it that my data and my time are significantly less important to you
when I’m at home than when I’m at work?
>
> Why is it acceptable for my home pc to crash due to a driver bug, and not
for my work desktop to crash due to the same driver bug?
>
>
> I find this attitude unacceptable. Anything that presumes that my time is
unimportant to me is simply unacceptable.
>
>
>
>
>

Actually I find the WDM way the easiest. When my StartDevice is called all
the PCI information I need is delivered in the IRP. It gets difficult only
when that doesn’t happen and I have to go find it.


Gary G. Little
xxxxx@broadstor.com
xxxxx@inland.net

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…
>
> Actually, I claimed that the wdm way is too complicated for a beginner.
And
> obviously if I want to hook an interrupt, there’s got to be a good reason
> for it eh ? The convoluted but useful HalGetInterruptVector way is no
longer
> documented in the DDK, at least I don’t call a three-line disclaimer
> “documentation”. Also, true, I couldn’t get hold of a timer ISR with it,
but
> I could get other interrupts, which would have helped me.
>
> You know, you guys could spare me this nonsense about sticking to the
party
> line. Unfortunately, my several professional hats force me to go look for
> the nonstandard and off-the-beaten-track stuff, I specialize in doing
things
> that need lateral thinking and bending the rules before they can be done !
> I’m looking for ways of doing it while minimizing the amount of nonsense I
> have to go through. The reason I posted the question was, I’m not that
> familiar with the ins and outs of the Microsoft API, and maybe there was
> something I overlooked, or maybe some new stuff I don’t as yet know about.
> Take it as a compliment - many of you know a whole lot more about the
> Windows driver API than I do, every time I post a question here I’m bowing
> to your knowledge !
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: Mark Roddy [mailto:xxxxx@hollistech.com]
> Sent: Wednesday, March 13, 2002 10:57 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Hooking Interrupts
>
>
> Alberto, I really do not have any problem at all with teaching students
how
> to build operating system interrupt handling mechanisms, but that was not
> the question you asked initially.
>
> " want to write an example driver that hooks an interrupt, but I’m having
a
> problem doing it in a well behaved way. I don’t want to do it in the WDM
> way, it’s too complicated for a beginner. But the old
HalGetInterruptVector
> way is no longer documented in the DDK - my students are having problems
> finding good documentation. I’m a machine level guy and I feel tempted to
> just go and frig the IDT by hand, but I would like to teach them some DDK
> techniques. So, here’s the question: if I want, say, to hook a timer
> interrupt with my own ISR/DPC pair, in a way that’s blessed at least by
the
> “legacy” DDK Driver way, what are my choices ? Inquiring minds want to
know.
> :-)"
>
> You claimed that there was no ‘wdm’ way to do this as the way that
> supposedly existed in nt4 had disappeared in w2k/xp. You then asked if
there
> was a ‘blessed’ way to ‘hook the timer interrupt’. The answer is no there
> isn’t. Furthermore, there never was. Finally HalGetInterruptVector remains
> documented and supported (although marked obsolete.)
>
> You can ‘frig the interrupt table’ all you want in nt, but perhaps nt is
> doing things in its interrupt preamble/postamble constructs that your
> ‘interrupt table frigging’ is defeating? Maybe there is actually a reason
> why nt is constructed the way it is, other than to make your life
difficult?
>
> –
> ===
> Mark Roddy
> Consultant
> Hollis Technology Solutions
> xxxxx@hollistech.com
> www.hollistech.com
> 603-321-1032
> “Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
> >
> > You miss my point.
> >
> > As Mihal pointed out, my interest is in teaching techniques. DESIGN
> > techniques, that is. I’m NOT trying to teach them how to use APIs, even
> for
> > something as bizantyne as Windows driver writing. To draw an utopian
> image,
> > I’m in the business of shaping up future designers of the OS that’s
going
> to
> > make Windows obsolete. And I can’t do my job if I can’t do anything
> outside
> > the party line.
> >
> > So, the point is this: an ISR is what hooks out of the IDT, and an OS
type
> > should know how to hook an ISR out of an IDT. The fact that Windows has
> put
> > its own ISRs in every IDT slot and provides no API to let you put in
your
> > own ISR is already a restriction, but then, one can live with it if one
> has
> > a clear idea of what’s going on. In that respect, teaching a course with
> > Linux is a far superior proposition - NOT because Linux is any less
> advanced
> > than Windows (it ain’t!), but because I have access to the source code,
> and
> > I can show my students EXACTLY what’s going on.
> >
> > Another example: I want to be able to build a task gate on the IDT, and
> show
> > my students how to build an interrupt task. I want to be able to show my
> > students what happens when I put an interrupt gate in the IDT with
> > protection ring 1 instead of 0.
> >
> > Better, if I really care to teach them how to hook interrupts safely, I
> can
> > give them a homework to add their own ISR handling to the Linux kernel,
> > recompile it, and go. Can’t do that with Windows !
> >
> > This is not about “cutting corners” or anything of that sort. What I
want
> is
> > something very simple: I want to be able to instate my own interrupt
> routine
> > by giving two parameters: a pointer to my ISR and an index into the IDT.
> > Simple, eh ?
> >
> > But in the end you guys may be right, I’m seriously considering dropping
> > Windows from my next course, and doing it all on Linux, or even better,
on
> > Solaris. I guess I already told you this little story: I went through a
> > whole amount of gyrations to tell them how to put together a toy Windows
> > driver. Then I spent a grand total of five minutes showing how to do the
> > same thing under Linux. So, this amazed student asks, "is that it ? "
> >
> > Yes, I said, that’s IT. It’s called design, excellence. Straight and to
> the
> > point. I wish Windows was a bit more like that.
> >
> >
> > Alberto.
> >
> >
> >
> > -----Original Message-----
> > From: Mark Roddy [mailto:xxxxx@hollistech.com]
> > Sent: Tuesday, March 12, 2002 11:19 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Hooking Interrupts
> > >
> > > As usual, only few attempts to answer original question and
> > > many kind or not-so-kind attempts to forbid even trying.
> > > Haven’t we had this discussion many times ago? Alberto
> > > clearly expressed the purpose: teach OS techniques. Good
> > > teaching means understanding and for understanding it is
> > > necessary to show how things work. To show it is sometimes
> > > necessary to use non-standard techniques. It doesn’t mean
> > > students should use these techniques in their drivers (if
> > > any), but they can use them for testing or debugging purposes.
> > >
> >
> > I’m sorry, but what Alberto said originally was “I want to write an
> > example driver that hooks an interrupt, but I’m having a problem doing
> > it in a well behaved way.” He can’t, as there is no ‘well behaved way’
> > to ‘hook an interrupt’ in NT, (nor in my opinion should there be.) Hack
> > away Alberto, teach your students how to hack hastily in the OS too, but
> > if you ask how to cut corners without cutting corners I will note that
> > your request is absurd.
> >
> >
> > =====================
> > Mark Roddy
> > Windows XP/2000/NT Consulting
> > Hollis Technology Solutions 603-321-1032
> > www.hollistech.com
> > xxxxx@hollistech.com
> > For Windows Device Driver Training: see www.azius.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@compuware.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to %%email.unsub%%
>
>

> -----Original Message-----

From: Gary G. Little [mailto:xxxxx@broadstor.com]
Sent: Wednesday, March 13, 2002 12:04 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Hooking Interrupts

My holy GOD guys … there is NOTHING wrong with “hooking” an
interrupt!!! I do believe that is why GOD created
IoConnectInterrupt, is it not?

That depends. ‘Hooking an interrupt’ in the original context of this thread
meant as you say using IoConnectInterrupt and HalGetInterruptVector. However
Alberto wished to do this for the timer interrupt, and that won’t happen on
nt3.5 - 5.1 and beyond, as the operating system vendor deliberately would
like there to be no legitimate way to ‘hook the timer interrupt’, and for
good reasons. ‘Hooking an interrupt’ then evolved in meaning in the context
of this thread to ‘sneaking in beneath the OS defined interrupt management
architecture’, and in that sense, there is plenty wrong with hooking an
interrupt. And as I repeat for the nth time, Alberto already knows how to
‘hook an interrupt’ in the pejorative sense, he has the softice source code
in front of him. Rather he asked how to do this legitimately in NT for the
timer interrupt. The answer remains, you can’t.

I think we are beating a dead horse with a dead fish.

PeterGV, please stop us now, we are out of control :slight_smile:

Alberto,

Actually I was talking about drivers themselves,
not about build environment. I agree it is somewhat
less complex to build simple one-source executable
on Linux. But if you have something not so trivial
you face to writing your own makefile for it which
can be more complex than the ‘sources’ file.
By the way, I think that Build environment window
is nothing more that regular DOS prompt window
with some environment variables set. Well, I like
this approach better than setting everything in your
.profile.

regarding PNP support on 2.4… I beleive those
PNP-supporting patches are very far from WDM PNP support.
Once I’ve installed USB OHCI card on my Linux system, and it was
picked up and configured just fine. After playing with it a bit
I removed it and now each time this box boots up it claims
that OHCI kernel module cannot start.

Gera.

----- Original Message -----
From: “Moreira, Alberto”
To: “NT Developers Interest List”
Sent: Wednesday, March 13, 2002 9:28 AM
Subject: [ntdev] Re: Hooking Interrupts

> Gera,
>
> No, I didn’t mislead my students !
>
> I was doing NT drivers, not PnP. Consider: by the time you install MSVC,
> install the DDK, learn about the difference between checked and free builds,
> figure out what to write in your “sources” file, make sure you have a
> makefile in your directory, go through the levels of indirection required by
> makefile.def and build.exe, copy the files to system32\drivers (or grow some
> white hairs trying to make ImagePath say what you want!), spend time
> frigging the registry, a lot of water went under the bridge. To me as a
> college instructor, all that time is overhead, it contributes nothing to my
> bottom line. While in Linux, you go “gcc -S -c source.c”, “mknod /dev/blah m
> n”, and “insmod source.o”, and you’re done. That’s IT. No DDK, no build.exe,
> no registry, no sources file, no dirs file, no special checked build window
> (why the heck can’t I build a driver in a standard dos box, or, why can’t
> they give me something in Windows that behaves just like my XTerm ?). All
> that you need to develop a driver is already natively installed in the OS,
> you just sit down and do it.
>
> And I believe Kernel 2.4 has some PnP ? I didn’t dig deep yet, but looks
> like it’s there. At least I have changed my network card a couple of times
> on my Linux machine here at work, and the system picked it up glitchless.
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: Gera Kazakov [mailto:xxxxx@setengineering.com]
> Sent: Wednesday, March 13, 2002 11:00 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Hooking Interrupts
>
>
> > I went through a
> > whole amount of gyrations to tell them how to put together a toy Windows
> > driver. Then I spent a grand total of five minutes showing how to do the
> > same thing under Linux. So, this amazed student asks, "is that it ? "
>
> I bet a non-PNP ‘toy’ driver complexity is about same
> for both Windows and Linux. A Win PNP driver is
> more complex but you have nothing to compare
> in Linux world - there are no PNP at all. I afraid you
> have misleaded your amazed student :slight_smile:
>
> Gera.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to %%email.unsub%%
>
> —
> You are currently subscribed to ntdev as: xxxxx@setengineering.com
> To unsubscribe send a blank email to %%email.unsub%%

> Windows, and yet it doesn’t impose a byzantine environment on its driver

writers.

In fact, it does not impose any environment at all. No encapsulation, for instance.
Such drivers do survive only due to too many people reading the source code.
Also I’m not thinking that Linus will allow any driver which tweaks the IDT directly to the main OS source tree.
Also - have you ever read Linux’s SCSI stack? Sorry, I prefer byzantine environment to such a source.

But if you believe that Windows is any more “extremely advanced” than Linux,
heck, maybe you deserve what you get !

Did they get rid of lock_kernel() after all? Compare this to NT SMP design.
Or maybe they got capable of running DMA over user app’s buffer which NT could do for years?

I have both NT and Linux. I prefer NT (w2k for now) to Linux on the desktop. Yes, it is more stable - I mean the Linux GUI. The core
OS BSODs only once per 2-3 months and thus has a good stability too. NT4SPx core OS could run a loaded webserver for 2 weeks uptime
with ease. Again a good stability.
If I will need a firewall - I will prefer FreeBSD for it, again not Linux. If I will need a webserver - recent holes in PHP
demonstrated that “UNIX is more stable” is a myth, and sorry, I would prefer ASP to PHP (ASP is still more advanced - yes, a good
old problem with threads in UNIXen lead to PHP being a step back). Or maybe there is a full-screen debugger for PHP scripts? ASP has
this for years.

Surely MS’s webserver requires some manual tweaking (mainly exterminating all non-necessary additional stuff like IDQ.DLL, .printer,
sample sites or such) before being used in a production environment, but it can be used there.

Max

> Linux is a far superior proposition - NOT because Linux is any less advanced

than Windows (it ain’t!)

It is. Did they get rid of lock_kernel()?
Or maybe there is COM+ or DCOM on Linux?
Or maybe good thread support?

Also remember then Linux is the most puny (design-wise) of all UNIXen. I prefer FreeBSD to it.
Also it is absolutely unsuitable for a desktop for a person which is not a Linux geek or IT professional at all.
It is nearly unusable, and the mass attitudes of the Linux community are much worse then MS’s marketing machine in this respect - to
help people (not computer professionals) use their computers. Linux geeks will answer - “go teach yourself” or something like. MS
will at least provide people with good quality documentation. Linux lacks one.
Also Linux’s windowing system is much less stable then NT’s one, at least it was so in RedHat 6.2. XMMS trying to access the absent
CD disk hangs the whole X with all GUI apps. Sorry, I never saw this on NT. Speeches on “this nasty NT has video in the kernel, this
reduces the stability” is junk. Do you often see BSODs on production NT machines related to video?

The whole idea of “Linux replacing Windows” is a sect-like mass attitude which is based mainly on hatred to Microsoft (after all -
you do not like Microsoft? Why not FreeBSD which is a much better OS design-wise then Linux?). It can only be real if Linux
community will provide some help to non-computer-related-people in using Linux on their desktops. For now, it is very, very far from
this.
Also - don’t forget the game market, which is nearly dominated by DirectX/D3D and such.

Max

> bottom line. While in Linux, you go “gcc -S -c source.c”, "mknod /dev/blah m

n", and “insmod source.o”, and you’re done. That’s IT.

For trivial sample - yes.
For anything non-trivial - no. At least you will need the CONFIG_xxx macros to be defined in the environment.

No DDK, no build.exe,

GNU make instead.

no registry

Just lots of cryptic and unstructured files in /etc instead.

(why the heck can’t I build a driver in a standard dos box

Run SETENV there and you will be able to do this.

Max

> Everyone is always going on and on, saying “don’t do that,” "that’s

bad," “you’re stupid to try that.” Why do windows developers reject
exploration so much?

Imagine a production-quality driver which is written by the over-creative mind who hooks IDT directly.
Now imagine your machine has several cards of several vendors with such drivers.
The result will be predictable. Poor result.

Oh yes… people will blame MS for this :slight_smile:

crashes my system? It isn’t fair to assume that everyone who is doing
kernel stuff in windows is doing it with some particular purpose in mind.

Yes, with stability purpose, for instance. Going beyond MS-recommended things can be done with extreme care only, understanding the
possible consequences, and only if there is no ways of doing this in usual ways or these ways are irrationally hard (like NDIS hooks
vs. IM driver).
I see no need in any product except SoftICE (which is a very special thing) to hook IDT entries.

(read: not everyone has devices they need to drive, and not everyone is
writing stuff they plan to release. Some people just want to fool around
and see what they can do. Is that so wrong?) Why can’t we just people have
their fun?

So why not? There are books on NT kernel’s undocumented details.

And just to head off what I know the response will be, I know that Linux
is all about exploration and doing kooky stuff with everything.

Sorry, I’m here for business and not “doing kooky stuff with everything”.
Sometimes the business requires some “kookiness”, but it must be reduced as much as possible to avoid having problems on different
machines and different installations.
“Kookiness” is a main source of bugs the clients complain of.

I don’t know how useful it will be, or even if its correct, but AFAIK
the interrupt vectors are stored at the start of RAM, and you can use

Wrong, they are in IDT. Your statement is right for real mode only, and in NT, the CPU is in protected mode.

Max