Solved

How can I Check a virtual drive

Posted on 2004-04-06
10
199 Views
Last Modified: 2013-11-15
I Want to ensure :

Is a drive a real (not virtual or device driver) drive? hard disk or cd drive
0
Comment
Question by:khalil_moghaddam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 3

Expert Comment

by:SuperUt
ID: 10772259
In the Windows unit you'll find
function GetDriveType(lpRootPathName: PChar): UINT; stdcall;

The result is one of these:
DRIVE_UNKNOWN  The drive type cannot be determined.
DRIVE_NO_ROOT_DIR  The root path is invalid. For example, no volume is mounted at the path.
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.

Hope this does it.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10772310
unit Unit_Q_20946070;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm_CD = class(TForm)
    Btn_Scan_Devices: TButton;
    Memo_Devices: TMemo;
    procedure Btn_Scan_DevicesClick(Sender: TObject);
  private  { Private declarations }
  public   { Public declarations }
    procedure Scan_Devices;
  end;

var
  Form_CD: TForm_CD;

implementation

{$R *.dfm}

procedure TForm_CD.Scan_Devices;
var
  C:                           Char;
  DriveType:                   DWORD;
  PCRootPathName:              PChar;
  SDriveType:                  string;
  S:                           string;
begin
  Memo_Devices.Clear;
  try
    for C := 'D' to 'Z' do
    begin
      S := C + ':\';
      PCRootPathName := PChar(S);
      DriveType := GetDriveType(PCRootPathName);
      case DriveType of
        0:                   SDriveType := '???'; // 'The drive type cannot be determined.';
        1:                   SDriveType := 'The root directory does not exist';
        DRIVE_REMOVABLE: SDriveType := 'FDD'; // 'The drive can be removed from the drive.';
        DRIVE_FIXED:         SDriveType := 'HDD'; // 'The disk cannot be removed from the drive.';
        DRIVE_REMOTE:         SDriveType := 'NET'; // 'The drive is a remote (network) drive.';
        DRIVE_CDROM:     SDriveType := 'CDD'; // 'The drive is a CD-ROM drive.';
        DRIVE_RAMDISK:   SDriveType := 'RAM'; // 'The drive is a RAM disk.';
      end;
      if (DriveType>1) then
        Memo_Devices.Lines.Add(S + ' is a ' + SDriveType)
      else
        Memo_Devices.Lines.Add(S + SDriveType);
   end;
  except
    on E : Exception do
      ShowMessage(E.Message);
  end;
end;

procedure TForm_CD.Btn_Scan_DevicesClick(Sender: TObject);
begin
  Scan_Devices;
end;

end.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10772320
object Form_CD: TForm_CD
  Left = 219
  Top = 114
  Width = 696
  Height = 480
  Caption = 'Form_CD'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Btn_Scan_Devices: TButton
    Left = 24
    Top = 16
    Width = 96
    Height = 25
    Caption = 'Scan Devices'
    TabOrder = 0
    OnClick = Btn_Scan_DevicesClick
  end
  object Memo_Devices: TMemo
    Left = 134
    Top = 14
    Width = 531
    Height = 407
    TabOrder = 1
  end
end
0
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 
LVL 12

Expert Comment

by:esoftbg
ID: 10772459
ooops, replace
>    for C := 'D' to 'Z' do
with
    for C := 'A' to 'Z' do (Including FDD)
or
    for C := 'C' to 'Z' do
0
 
LVL 1

Author Comment

by:khalil_moghaddam
ID: 10773705
But This Function can't recognize a virtual drive application linke CloneCd (a burning CD app.) it recognize it az an CD drive
0
 
LVL 1

Author Comment

by:khalil_moghaddam
ID: 10773773
But This Function can't recognize a virtual drive like CloneCd (a burning CD app.) it recognize it az an CD drive
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10779230
I think this application does a good camouflage of the virtual drive like CloneCd ;-))

emil
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 13276138
PAQed with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to update Firmware and Bios in Dell Equalogic PS6000 Arrays and Hard Disks firmware update.
A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question