| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | IOCTL_CDROMDISK |
PH> I'd just like to implement a tool for "CDROM /EJECT"
PH> or "CDROM /PLAYAUDIO", etc.
Here's a canned sample that will eject. The cdrom ioctls are fully
documented in the standard ibm warp "Control Program Guide and
Reference",under "Generic Ioctl Commands --> Category 80h
..."
-------------------------------------------------------------
GC> Hello All! I'm having a bit of trouble using DosOpen
GC> to open my CD-ROM drive for access (specifically to
You were close. Your DosOpen() parms were specified a little wrong. You
also called the ioctl with some unintilized len variables. After I fixed
those, the program caused a kernel trap in "cdrom2$"!!. After
about 1/2 hour of digging around the DDK (I should have just looked up the
category 0x80 stuff in the *.inf file, instead of trying to debug the
source to the cdrom driver), I solved the problem. Here you go:
// eject cdrom
#define INCL_DOS
#define INCL_NOPMAPI
#include
#include
#include
VOID main(VOID)
{
HFILE CDHandle;
ULONG action;
APIRET rc;
ULONG ParmLenInOut, DataLenInOut;
rc = DosOpen("I:",
&CDHandle,
&action,
0,
FILE_NORMAL,
FILE_OPEN,
OPEN_ACCESS_READONLY | OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE,
NULL);
if (rc != 0)
{
printf("DosOpen failed (rc = %ld)\n", rc);
exit(EXIT_FAILURE);
}
ParmLenInOut = 4; // setting these to something is important!
DataLenInOut = 0;
rc = DosDevIOCtl(CDHandle,
0x80, // IOCTL_CDROMDISK
0x44, // CDROMDISK_EJECTDISK
"CD01",
4,
&ParmLenInOut,
NULL,
0,
&DataLenInOut);
if (rc != 0)
{
printf("DosDevIOCtl failed (rc = %ld)\n", rc);
exit(EXIT_FAILURE);
}
DosClose(CDHandle);
}
--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 259/414 400 99 229/2 3615/50 396/1 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™.