Path: news.mitre.org!blanket.mitre.org!agate!newsgate.duke.edu!nntprelay.mathworks.com!news-peer-east.sprintlink.net!news-peer.sprintlink.net!news.sprintlink.net!Sprint!newsfeed.internetmci.com!192.220.251.22!netnews.nwnet.net!news.microsoft.com!news
From: "Paul Sanders" <paulsan@microsoft.com>
Newsgroups: comp.os.ms-windows.nt,comp.os.ms-windows.nt.admin,comp.os.ms-windows.programmer.nt.kernel-mode,comp.os.ms-windows.programmer.misc,comp.os.ms-windows.misc
Subject: Re: How can I find Drive Letter of SCSI CD-ROM at run-time (I know it's SCSI_ID)
Date: Thu, 18 Dec 1997 10:51:50 -0800
Organization: Microsoft
Lines: 70
Message-ID: <67brcf$s4s@news.microsoft.com>
References: <3497939F.85396CD6@armtcom.com>
NNTP-Posting-Host: 157.54.178.80
X-Newsreader: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Xref: news.mitre.org comp.os.ms-windows.programmer.nt.kernel-mode:5952 comp.os.ms-windows.programmer.misc:135027 comp.os.ms-windows.misc:133320

In addition to Ming's response (GetDriveType), you can get a listing of all
symbolic links via QueryDosDevices.  Check out \ddk\src\general\dosdev.
Once you have the drive letters, get a handle to each one and use
GetDriveType on it.  Once you know which drive letters are symbolic links,
call DeviceIoControl with a control code of IOCTL-SCSI_GET_ADDRESS.

SCSI_ADDRESS scsiAddress;

scsiAddress.Length = sizeof ( SCSI_ADDRESS );
rc = DeviceIoControl (
     handle,
     IOCTL_SCSI_GET_ADDRESS,
     NULL,   // no input buffer
     0,
     scsiAddress,
     sizeof (SCSI_ADDRESS),
     &bytesWritten,
     NULL
     );

SCSI_ADDRESS is defined in NTDDSCSI.H as
typedef struct _SCSI_ADDRESS {
    ULONG Length;   // must be sizeof SCSI_ADDRESS
    UCHAR PortNumber;  // which host adapter, \Device\ScsiPortX
    UCHAR PathId;   // which SCSI bus on the adapter
    UCHAR TargetId;  // Target ID, typically 0 to 7 (or 15)
    UCHAR Lun;   // Logical Unit Number (0 to 255)
}SCSI_ADDRESS, *PSCSI_ADDRESS;

This IOCtl will fill in the PortNumber, PathId, TargetId and Lun for the
handle in question.  You have the source code to this IOCtl.  It can be
found at \ddk\src\storage\class\class\class.c.  Look at
ScsiClassDeviceControl().

-Paul

Tomer Yahav wrote in message <3497939F.85396CD6@armtcom.com>...
>I have CD_ROMs connected Externally with SCSI.
>
>I need to Know the mapping to Drive Letters that occured in Boot time
>( I know that after the user (adminstrator)  has control in NT -
>    he can change the  Drive letters as he like with the Disk
>Administrator Utility)
>
>this knowledge should be obtained in run time-
>  because I dont know in advance - to what SCSI controller or SCSI-ID
>the
>  CD-ROMS will be connected, and other disks that will be connected to
>the PC.
>
>I can get for each CD-ROM - it's SCSI ID
>I assume that the mapping (Scsi-ID - Drive Letter) exist in the Registry
>
>but I don't know what entries in it are the ones
>
>any suggestion will be welcomed
>------------------------------------------------------
>Tomer Yahav <tyahav@armtcom.com>
>R&D in
>A.R.M.T.
>Multimedia & telecommunications Ltd.
>Fax  : 972-3-9305485
>Phone: 972-3-9305594
>
>
>
>
>