| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | DEVICE DRIVER CHAIN |
PF>anyone has any glimmer of
PF>an idea of how to find the address of the first
PF>device driver header,please
PF>let me know.
BL> I've been tearing my bedroom apart. I have a torn sheet of paper with
I think i've got all the info I need. For your notes:
Area Os2prog, Msg#810, Jan-07-95 01:50:44
From: Mike Bilow
To: Peter Fitzsimmons
Subject: device driver chain
Yes, but you're treading on very thin ice to do it. You need to get the word
at 0070:0020h, which is the offset of the first device driver header (for the
"NUL" device), also in segment 0070h (which is the "System
Anchor Segment").
You need to have Ring 0 privilege to get access to segment 0070h. I've never
dared to do this inside a device driver, although it has worked consistently
from the kernel debugger since about OS/2 1.2 or so.
If all you want is a list of the character pseudo-devices, and you want it
from Ring 3 code, DosQueryFSAttach() provides a documented method to get it.
------------------------------------------------------------------------------
Area Os2prog, Msg#873, Jan-09-95 05:02:10
From: Nick Mann
To: Peter Fitzsimmons
Subject: device driver chain
I had to think about this one for a few minutes. I knew I had some
code somewhere that did this very thing, but couldn't remember where it
was. (I'm convinced old code is like old pens. Given half a chance
they slope off to a dark corner when you're not watching. (-: )
Anyway, in the October 1990 edition of Dr. Dobb's Journal, the article
"Opening OS/2's Backdoor" described a device-driver/application couplet
which did just what you are looking for.
The device driver basically allows DevHlp functions to be executed by
the application through IOCtl calls. The application produces a list
of installed devices. The loop looking for the start of the chain is
shown below:
// locate the first driver
selDriver = 0x50; // global data segment
usOffsetDriver = 0;
usBytesLeft = 32000; // should be large enough
pchGlobal = MAKEP(MakeSel(selDriver), usOffsetDriver);
do {
PCH pchMatch;
pchMatch = memchr(pchGlobal + 1, 'N', usBytesLeft); // look for first
char
if(pchMatch == NULL) { // if no match
ReleaseSel(SELECTOROF(pchGlobal)); // release the selector
puts("NUL driver not found"); // and give up
exit(1);
} // if no match
// partial match
usBytesLeft -= pchMatch - pchGlobal; // reduce residual count
pchGlobal = pchMatch; // point to start of match
} while(memcmp(pchGlobal, // break out if name matches
szNullDriver, // exactly
sizeof szNullDriver -1) != 0);
------------------------------------------------------------------------------
From the DUDE bbs guys:
You could try the following commands from the Kernel Debugger
.d dev nuldev
This lists the first installable device driver header. The DevNext field
will point to the next device driver and you chain through all the installed
drivers. On executing this command on the debug terminal you have the
following output :
DevNext : 0400:0cd4
.d dev #(0400:cd4)
This yields the Device Header of the next Device. You could chain through
other installed drivers through the DevNext field of the Header.
The other alternative to chain through the device headers would be to us the
following commands from the debug terminal,
##dw 70:20 l1 ;device chain starts at 70:20
0070:00000020 0cb9
##dw 70:cb9
0070:00000cb9 0cd4 0400
##.d dev 400:0cd4 yields the device header
Ensure you have the same level of the Debug Kernel as the Retail Kernel
before trying out the above commands from the Debug Terminal. For Base
device Drivers use .d dev oemdev.
--- Maximus/2 2.01
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430 SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1 7877/2809 @PATH: 259/414 400 99 250/99 3615/50 229/2 12/2442 711/409 808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.