🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #9617

How to determine that CD-drive is empty?

#9617
From: Alexander Aliev
Date: Thu, 24 Jun 2004 07:34
28 lines
1543 bytes
Hallo,

could anybody tell how to find out that CD-drive is empty
and suppress system message with "Try again, Continue, Cancel"?

I tried to use DeviceIoControl() with
IOCTL_STORAGE_CHECK_VERIFY, but this function
needs device handle. I use CreateFile() to get the handle.
This function fails and GetLastError() says "Access denied".

Here is a snip of code:

HANDLE hCD = CreateFile(
   "\\\\.\\E:",
    0,
    FILE_SHARE_READ | FILE_SHARE_WRITE,
    NULL,
    OPEN_EXISTING,
    0,
    NULL
   );

I tried the same for A: with the same result.
I have administrative privilege, use OS XP.
What I am doing wrong?

Thank you in advance for any hint.
Alexander
Technical Details
Message-ID: <40da83a0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d00920f15dfe8a59,start
X-Google-Attributes: gid10cc67,public
From: "Alexander Aliev" <ali@isa.ru>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: How to determine that CD-drive is empty?
Date: Thu, 24 Jun 2004 11:34:25 +0400
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 195.208.60.41
Message-ID: <40da83a0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1088062368 195.208.60.41 (24 Jun 2004 00:32:48 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail