| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | IOCTL_CDROMDISK |
On Monday September 25 1995 at 02:52, Patrick Haller wrote to All / Peter
Fitzsimmons:
PH> I'd just like to implement a tool for "CDROM /EJECT" or "CDROM
PH> /PLAYAUDIO", etc.
Here's a program that will eject, lock and unlock a CD-ROM (or other modern
removable media) disk:
===CUT===HERE===MEDIA.C
#define INCL_BASE
#define INCL_DOSPROCESS
#define INCL_DOSDEVIOCTL
#define INCL_NOPMAPI
#define INCL_DOSMISC
#include
#include
#include
#include
int main (int argc, char *argv[])
{
struct {
UCHAR Command;
UCHAR Drive;
} C8F40;
APIRET rc;
printf("Media V1.0. Public domain");
if (argc != 3)
{
printf ("The parameter is incorrect.\n\nSyntax:\n\n%s (drive)
{UNLOCK||LOCK||EJECT}\n", argv[0]);
return(1);
}
C8F40.Drive = toupper(argv[1][0]) - 'A';
C8F40.Command = 0xFF;
if (stricmp(argv[2], "UNLOCK") == 0) C8F40.Command = 0;
if (stricmp(argv[2], "LOCK") == 0) C8F40.Command = 1;
if (stricmp(argv[2], "EJECT") == 0) C8F40.Command = 2;
if (C8F40.Command == 0xFF)
{
printf ("Unknown option '%s'.\n", argv[2]);
return(1);
}
rc = DosDevIOCtl(-1, 8, 0x40, &C8F40, sizeof(C8F40), 0, NULL, 0, 0);
if (rc != 0)
{
char buffer[1024];
ULONG msglength;
rc = DosGetMessage(0, 0, buffer, 1024, rc, "OSO001.MSG",
&msglength);
buffer[msglength] = '\0';
printf (buffer);
return(2);
}
switch (C8F40.Command)
{
case 0:
printf("Drive %s unlocked.", argv[1]);
break;
case 1:
printf("Drive %s locked.", argv[1]);
break;
case 2:
printf("Media in drive %s ejected.", argv[1]);
break;
}
printf("\n");
return(0);
}
===CUT===HERE===
--- GoldED/2 2.42.G0615
* Origin: MARIONETTE NETWORK: PUPPETS OF JESUS! (1:250/820)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: 250/820 501 99 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™.