Newsgroups: comp.os.ms-windows.programmer,comp.os.ms-windows.programmer.drivers,comp.os.ms-windows.programmer.misc,comp.os.ms-windows.programmer.nt.kernel-mode
From: smiller@synergy.net (Scott L. Miller)
Subject: CD-R Status Codes - help!
Keywords: CDR, status, NT
X-Newsreader: News Xpress 2.01
Date: Mon, 15 Dec 1997 16:47:41 GMT
NNTP-Posting-Host: newscene.newscene.com
Message-ID: <34955ce1.0@newscene>
Organization: Newscene Public Access Usenet News Service (http://www.newscene.com/)
Lines: 52
Path: news.mitre.org!blanket.mitre.org!news.tufts.edu!cam-news-feed5.bbnplanet.com!cam-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!newsfeed.internetmci.com!208.149.121.252!novia!newscene!strip_path
Xref: news.mitre.org comp.os.ms-windows.programmer.misc:134841 comp.os.ms-windows.programmer.nt.kernel-mode:5853

Hello, someone out there must have the knowledge that can help me.

High level:  I need to check if there is a blank CD in the CDR drive
before running an automated burn session.  I am using Win NT 3.51.
SCSI CDR, Adaptec ATAPI driver (I think...)

I wrote a quick and dirty 16 bit dos app to issue int 21 calls 
complete with critical error handling to try to check for this, but
the problem is that every call I've attempted so far, an empty tray
looks exactly the same as a blank CD.  (same error codes etc)

I think I have found part of the answer with int 21, 4402 CDRom
status function.  Here is the info straight from Ralf Brown's
interupt list:

INT 21 4402 - CD-ROM device driver - IOCTL INPUT


Category: d - disk I/O enhancements

Inp.:
        AX = 4402h
        BX = file handle referencing character device for CD-ROM driver
        CX = number of bytes to read
        DS:DX -> control block (see #1102)
Return: CF clear if successful
            AX = number of bytes actually read
        CF set on error
            AX = error code (01h,05h,06h,0Dh) (see #1332 at AH=59h/BX=0000h)
Note:   the data returned depends on the first byte of the control block
          (two bytes for function 07h, see #1102); the remainder of the
          control block is filled by the driver

In the control block, you can specify a sub-function, and one of them will
return the CD Status.  The problem is that I don't know how to go about
getting the file handle needed for the BX register.

If anyone can shed some light on how to get this to work, or if there is
already a nice tool that I can use, let me know where it is, or send it
to me, I would be very grateful.

Email is prefered, as I don't get to the news groups often enough...
-- 
Scott L. Miller         smiller@synergy.net
Oasis Technologies
Omaha, NE, USA
v.(402)530-6600         fax(402)530-6644

Scott L. Miller         smiller@synergy.net
Oasis Technologies
Omaha, NE, USA
v.(402)530-6600         fax(402)530-6644