Skip to content

Commit

Permalink
cdaccess: detect CD drive in 'check' command
Browse files Browse the repository at this point in the history
  • Loading branch information
ybendito committed Jul 18, 2018
1 parent 013f3fa commit 985c88a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cdaccess/cdaccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,21 @@ static void ReadVolume(const CString& device, ULONG offset, LPCTSTR filename = N

static void CheckVolume(const CString& device)
{
CStringA s = "Verified: ";
XVolumeFile f(device, false);
CDROM_DISK_DATA data;
if (f.Control(IOCTL_STORAGE_CHECK_VERIFY) &&
f.ControlOut(IOCTL_CDROM_DISK_TYPE, &data, sizeof(data)))
s += (f.Control(IOCTL_STORAGE_CHECK_VERIFY)) ? "Yes" : "No";
if (f.ControlOut(IOCTL_CDROM_DISK_TYPE, &data, sizeof(data)))
{
Log(0, "Present, type %d", data.DiskData);
s.AppendFormat(", type %d", data.DiskData);
}
GET_CONFIGURATION_IOCTL_INPUT cfgIn = { FeatureCdRead, SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL };
GET_CONFIGURATION_HEADER cfgOut;
if (f.Control(IOCTL_CDROM_GET_CONFIGURATION, &cfgIn, sizeof(cfgIn), &cfgOut, sizeof(cfgOut)))
{
s += ", CD feature OK";
}
Log(0, "%s", (LPCSTR)s);
}

static void EjectVolume(const CString& device)
Expand Down
1 change: 1 addition & 0 deletions cdaccess/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <iostream>
#include <winioctl.h>
#include <ntddcdrm.h>
#include <ntddmmc.h>

#define ELEMENTS_IN(x) (sizeof(x)/sizeof(x[0]))

Expand Down

0 comments on commit 985c88a

Please sign in to comment.