怎样用程序判断某盘符对应的是真正的光驱还是虚拟光驱?(100分)

L

ltolll

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样用程序判断某盘符对应的是真正的光驱还是虚拟光驱?
最好有源程序,谢了!
 
监测是否是虚拟光驱,没有测试,:(
给你一个函数,(可以区分真实光驱和虚拟光驱):
Function IsCDROM(Drv : Char):BOOLEAN;
Var
CDR : string;
cnt : byte;
Count,First : word;
begin
Result := false;
CDR := '';
asm
mov ax, 1500h
xor bx, bx
int $2f
les di, COUNT
mov es:[di], bx
les di, FIRST
mov es:[di], cx
end;
if Count > 0 then
for cnt := 0 to (Count-1) do
CDR := CDR + char(First + Byte('A') + cnt);
Result := (Pos(upcase(Drv),CDR) > 0);
end;
 
上面的函数我在win2000+delphi5下编译不过阿 !
 
看看以下的API能否判断:

GetDriveType
The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.

UINT GetDriveType(
LPCTSTR lpRootPathName // pointer to root path
);

Parameters
lpRootPathName
Pointer to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName is NULL, the function uses the root of the current directory.
Return Values
The return value specifies the type of drive. It can be one of the following values:

Value Meaning
DRIVE_UNKNOWN The drive type cannot be determined.
DRIVE_NO_ROOT_DIR The root directory does not exist.
DRIVE_REMOVABLE The disk can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the drive.
DRIVE_REMOTE The drive is a remote (network) drive.
DRIVE_CDROM The drive is a CD-ROM drive.
DRIVE_RAMDISK The drive is a RAM disk.
 
发消息让它弹出,如果谈不出就是假的
 
以上方法都行不通
 
顶部