TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mike Bilow
from: Vitus Jensen
date: 1997-03-16 19:09:42
subject: Driver: byte count from IOCTL

Moin Mike,

13.03.97 22:18, you wrote a message to Vitus Jensen:

...
 VJ>>   pcbDataLen (PULONG) - in/out 
 VJ>>      Pointer to the length of data. 
 MB> * * *
 VJ>> *HOW* do I return this "length of the data returned"?

 MB> OS/2 is trying to confuse you.  In OS/2 1.x, DosDevIOCtl() has a
 MB> certain defined calling format.  When length information was
 MB> added in OS/2 2.x, the old format had to be preserved, and the
 MB> new format became DosDevIOCtl2().

Not quite but I understand the differences.  A short list:

OS/2 1.0+	DosDevIOCtl(Data,Parm,Func,Cat,Handle)
OS/2 1.2+	DosDevIOCtl2(Data,DataLen,Parm,ParmLen,Func,Cat,Handle)
OS/2 2.0+	DosDevIOCtl(Handle,Cat,Func,Parm,ParmLen,pParamLen,
			Data,DataLen,pDataLen)
...
 MB> You must flag the driver as function level 3 in bits 9-7
 MB> (DEV_FCNLEV) of the Device Attributes (SysDev.SDevAtt), which
 MB> indicates that there is an extra doubleword at the end of the DD
 MB> header, the Device Capabilities Doubleword (SysDev3.SDevCaps).
 MB> You must then set the DEV_IOCTL2 bit (0x00000001) of this
 MB> SDevCaps field to indicate support for the longer IOCtl packet
 MB> format.

Did that as usual, assembler listing:
-----------------------------------------------
 0000 FFFFFFFF	DiskDDHeader	DD	-1
 0004  8980			DW	DEV_CHAR_DEV OR DEV_30 OR DEVLEV_3
 0006  0000 R			DW	OFFSET AsmStrategy
 0008  0000			DW	0
 000A  44 53 4C 45 45 50	DB	"DSLEEPS$"
       53 24
 0012  0000			DW	0
 0014  0000			DW	0
 0016  0000			DW	0
 0018  0000			DW	0
 001A  0000001B			DD	DEV_INITCOMPLETE OR DEV_ADAPTER_DD OR DEV_16MB OR 
DEV_IOCTL2
 001E  0000			DW	0
-------------------------------------------------

...
 MB> In other words, your new format driver will receive this as the
 MB> request packet format, with the extra words added:

 MB>    typedef struct _RP_GENIOCTL  {          /* RPGIO */
 MB>      RPH           rph;
 MB>      UCHAR         Category;
 MB>      UCHAR         Function;
 MB>      PUCHAR        ParmPacket;
 MB>      PUCHAR        DataPacket;
 MB>      USHORT        sfn;
 MB>      USHORT        ParmLen;                /* VPNP */
 MB>      USHORT        DataLen;                /* VPNP */
 MB>    } RP_GENIOCTL, FAR *PRP_GENIOCTL;

 MB> If you modify the RP_GENIOCTL.ParmLen of RP_GENIOCTL.DataLen
 MB> words in the driver before signalling "done," then this
 MB> information should be returned to the caller.  

"Should"   This reminds me of the SCSI-II spec.
I'm seeing the values passed by the application to DosDevIOCtl (32bit) in 
ParmLen and DataLen.  No problem (see original posting).
But when I modify DataLen the caller's idea of DataLen isn't changed.

This leads back to the information from that "Device Driver FAQ" website I 
mentioned: "may be designed that way but doesn't work".


[...length restriction, etc....]

The information about which parameter of DosDevIOCtl does what was very 
interesting, also that the *combined* length of parameter and data buffer may 
not exceed 64KB.

Do you know of a public source of information about this area?  I own a copy 
of "Design of OS/2 2.0" and had once access to Steve Mastrianni's
book (and of course the Physical Device Driver Reference).  Nowhere these
things were mentioned.


C-x C-s
    Vitus [Team OS/2 Germany #835]

--- Sqed/rexx 66:
* Origin: What I like about MS is its loyalty to customers! (2:2474/424)
SEEN-BY: 50/99 54/99 270/101 620/243 625/155 160 711/401 413 430 934 712/311
SEEN-BY: 712/407 505 506 517 623 624 704 713/317 800/1
@PATH: 2474/424 400 0 24/777 888 396/1 270/101 712/624 711/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™.