TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mike Bilow
from: Vitus Jensen
date: 1997-02-17 23:58:06
subject: Driver: byte count from IOCTL

Moin Mike,

15.02.97 07:45, you wrote a message to Vitus Jensen:

...
 VJ>> To let the user change timeout values w/o reboot I defined
 VJ>> some IOCtls to get/change the device list.  Application
 VJ>> passes a large buffer (ex. room for 32 devices) and the
 VJ>> driver returns how much it has filled.  The usual design. 

 VJ>> Now: how can the filter modifiy parmlen and/or datalen in
 VJ>> the above call?  No DDK sample uses this possibility and the
 VJ>> is no documentation. :-( 


 MB> You cannot from within the driver modify the length of the
 MB> parameter and data packets passed on the DosDevIOCtl() call.
Aha.

 MB> These packets are owned by the caller, and the callee has no
 MB> business changing their lengths.

? Has no business ?

[...nasty address mapping removed...]

? Did you understand what I meant?  My english is very bad, but I thought
you could made some sense out of it.
I released DSKSleep.flt 0.81 some days ago (the header solution) but let me
provide an example anyway.


-----------------------------------------------
#define MAX	100

DisplayList(HFILE hd)
{
    ULONG    datalen = MAX*sizeof(STRUCT);
    STRUCT * data = malloc(datalen);

    DosDevIOCtl(hd, CAT, FCN, NULL,0,NULL, data, datalen, &datalen);

    /* DosDevIOCtl completed successfully and driver returned
     * 5 items of type STRUCT.  Now 'datalen' should be
     * 5*sizeof(STRUCT). */

    for( i=0; i < datalen/sizeof(STRUCT); ++i )
        DisplayItem( &data[i] );

    free( data );
}
-------------------------------------------------

That's all I want.
From Toolkit 3.0:

-----------------------------------------------
  pcbDataLen (PULONG) - in/out 
     Pointer to the length of data. 

     
     Input        Pointer to the length, in bytes, of the data passed
                  by the application in pData. 

     Output       Pointer to the length, in bytes, of the data returned. 

                  If this function returns ERROR_BUFFER_OVERFLOW, then
                  pcbDataLen points to the size of the buffer required
                  to hold the data returned. 
-------------------------------------------------

*HOW* do I return this "length of the data returned"?


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

PS: code written directly in Sqed/32.

--- Sqed/rexx 113:
* Origin: Coming Soon!! Mouse Support for Edlin!! (2:2474/424)
SEEN-BY: 50/99 54/99 270/101 620/243 625/160 711/401 413 430 934 712/311 407
SEEN-BY: 712/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™.