TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Simeon Cran
from: Vitus Jensen
date: 1995-11-21 22:00:16
subject: Re: CD-ROM control programming

Moin Simeon,

15.11.95 13:19, you wrote a message to All:

...
 SC> So my question is, how can I find out information about reading 
 SC> raw sectors from a CD-ROM by talking to the .ADD. Where should I 
 SC> be looking?
Control Programming: DosOpen, DosRead, DosClose (it's so easy)

I used it to expand my hex-editor, see below:
--------------------------------------
/* *********************************************************************
NAME:	    OpenBinFile
PARAMETER:  name	file specification
	    DoWhat	BIT0: open for read and write
			BIT1: name is "drive:"
			BIT7: tell errors using stderr
RC:	    handle
RC_ERROR:   -1
********************************************************************* */
int OpenBinFile(PSZ name,UCHAR DoWhat,HFILE *new_hd)
{
    APIRET Rc;
    ULONG  ulOsDid;			// what did OS ?
    ULONG  ulNewSize=0; 		// new size of file (/ignored)
    ULONG  ulNewAttr=0; 		// attr. if created (/ignored)
    ULONG  ulOpenFlag;
    ULONG  ulOpenMode;
    PEAOP2 pEABuf=NULL;

    if( DoWhat & 0x01 )
    {
	ulOpenFlag = OPEN_ACTION_FAIL_IF_NEW|OPEN_ACTION_OPEN_IF_EXISTS;
	ulOpenMode = OPEN_FLAGS_WRITE_THROUGH|OPEN_FLAGS_NO_CACHE
	    |OPEN_FLAGS_RANDOMSEQUENTIAL|OPEN_SHARE_DENYREADWRITE
		|OPEN_ACCESS_READWRITE;
    }
    else
    {
	ulOpenFlag = OPEN_ACTION_FAIL_IF_NEW|OPEN_ACTION_OPEN_IF_EXISTS;
	ulOpenMode = OPEN_FLAGS_NO_CACHE|OPEN_FLAGS_RANDOMSEQUENTIAL
	    |OPEN_SHARE_DENYWRITE|OPEN_ACCESS_READONLY;
    }
    if( DoWhat & 0x02 )
    {
	ulOpenMode |= OPEN_FLAGS_DASD;
    }

    if( (Rc=DosOpen(name, new_hd, &ulOsDid,
			ulNewSize, ulNewAttr,
			ulOpenFlag, ulOpenMode, pEABuf)) != 0 )
    {
	LastFileError = Rc;
	if( DoWhat & 0x80 )
	    fprintf( stderr, "DosOpen(%s) returned %lu\n", name, Rc );
	return -1;
    }

    /* If a device should be opened, lock this device
     * No other process can access (read or write) this device.
     */
    if( (DoWhat & 0x02)  &&  (DoWhat & 0x01) )
    {
	ULONG  ulIOCtlParmList=0, ulIOCtlParmSize=1;
	ULONG  ulIOCtlDataList=0, ulIOCtlDataSize=1;

	if( (Rc=DosDevIOCtl(*new_hd, 8, 0,
			    &ulIOCtlParmList, ulIOCtlParmSize,
			    &ulIOCtlParmSize,
			    &ulIOCtlDataList, ulIOCtlDataSize,
			    &ulIOCtlDataSize)) != 0 )
	{
	    if( DoWhat & 0x80 )
		fprintf( stderr, "DosDevIOCtl(%s) returned %lu\n", name, Rc );
	    LastFileError = Rc;
	    DosClose( *new_hd );
	    return -1;
	}
    }
    return 0;
}
-------------------------------------

Tschuesz,
	Vitus 

PIN: 10:1000/100.20
Fido: 2:2474/100.20
Internet: vitus{at}vortex.de

--- Sqed/32 1.00/rc11/r00228
* Origin: Really a Point of BetaBox, Walheim (2:2474/100.20)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 517 628 713/888 800/1 7877/2809
@PATH: 2474/100 0 2433/1200 225 270/101 712/515 711/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™.