IOCTL_DISK_FIND_NEW_DEVICES on NT4

Hi all,

I have a problem to find new SCSI drives on NT4.
Scenario:
I have some external SCSI CDRom drives which are not powered on system
startup. These drives should be found as soon as I power up the drives.
In order to find the new drives I wrote a simple application which rescan
the SCSI bus and then ask the class driver to find the new drives.
The (simplified) code is below. The rescan works fine as the new drives
show up under the SCSI adapter and are listed in the
HKLM\Hardware\Devicemap\Scsi\ hive of the registry.
However the class driver does not create new devices (\Device\CdRomx)
thougt I get no error return from DeviceIoControl(). I tried
IOCTL_DISK_FIND_NEW_DEVICES, IOCTL_CDROM_FIND_NEW_DEVICES and
IOCTL_STORAGE_FIND_NEW_DEVICES without success. Starting Windisk has no
effect either. Next step was compiling the class driver included in the ddk
(cdrom.sys)to see what happens there, but this gives a BSOD as soon as the
IOCTL_DISK_FIND_NEW_DEVICES is executed. Is something wrong with my code or
do I have to do something else to get my drives recognized?
The same code works fine on W2K.

BTW: The drive letter I’m using to talk to the class driver is one of my
drives which are already there and reside on the same SCSI port and bus.

Kind regards,

Bernd

HANDLE OpenDevice(LPCTSTR lpFileName)
{
return CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);
}


char szDev[30];
char szFormat = “\\.\Scsi%d:”;
wsprintf(szDev, szFormat, m_Port);
HANDLE hDevice = OpenDevice(szDev);
if(hDevice == INVALID_HANDLE_VALUE)
{
CString strOut;
strOut.Format(“Could not open %s”, szDev);
AfxMessageBox(strOut);
return;
}

DWORD dwReturned;
BOOL bRc;
bRc = DeviceIoControl(hDevice, IOCTL_SCSI_RESCAN_BUS,
NULL,
0,
NULL,
0,
&dwReturned,
FALSE);

CloseHandle(hDevice);
if(!bRc)
{
AfxMessageBox(“ReScan failed”);
return;
}
char szFormat1 = “\\.\%C:”;
wsprintf(szDev, szFormat1, m_cDrive);
hDevice = OpenDevice(szDev);
if(hDevice == INVALID_HANDLE_VALUE)
{
CString strOut;
strOut.Format(“Could not open %s”, szDev);
AfxMessageBox(strOut);
return;
}
// call the driver
bRc = DeviceIoControl(hDevice, // device handle
IOCTL_DISK_FIND_NEW_DEVICES,
NULL, // input buffer
0, // input buffer length
NULL, // output buffer
0, // output buffer length
&dwReturned, // # bytes returned
NULL); // synchronous call
if(!bRc)
{
CString strOut;
strOut.Format(“IOCTL_DISK_FIND_NEW_DEVICES failed”);
AfxMessageBox(strOut);
}

bRc = DeviceIoControl(hDevice, // device handle
IOCTL_CDROM_FIND_NEW_DEVICES,
NULL, // input buffer
0, // input buffer length
NULL, // output buffer
0, // output buffer length
&dwReturned, // # bytes returned
NULL); // synchronous call
if(!bRc)
{
CString strOut;
strOut.Format(“IOCTL_CDROM_FIND_NEW_DEVICES failed”);
AfxMessageBox(strOut);
}
bRc = DeviceIoControl(hDevice, // device handle
IOCTL_STORAGE_FIND_NEW_DEVICES,
NULL, // input buffer
0, // input buffer length
NULL, // output buffer
0, // output buffer length
&dwReturned, // # bytes returned
NULL); // synchronous call

if(!bRc)
{
CString strOut;
strOut.Format(“IOCTL_STORAGE_FIND_NEW_DEVICES failed”);
AfxMessageBox(strOut);
}
CloseHandle(hDevice);
return;


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi Bernd,

NT4 is not a plug and play OS like Windows2000. Which would explain why
any devices not connected and powered on during boot up do not get
recognized after.

Regards,
Youssef Barakat – NTDDK Team
Windows Systems Developer Support
Microsoft

-----Original Message-----
From: windolph@hh-zfrk.com [mailto:windolph@hh-zfrk.com]
Sent: Tuesday, May 15, 2001 10:10 PM
To: File Systems Developers
Subject: [ntfsd] IOCTL_DISK_FIND_NEW_DEVICES on NT4

Hi all,

I have a problem to find new SCSI drives on NT4.
Scenario:
I have some external SCSI CDRom drives which are not powered on system
startup. These drives should be found as soon as I power up the drives.
In order to find the new drives I wrote a simple application which
rescan
the SCSI bus and then ask the class driver to find the new drives.
The (simplified) code is below. The rescan works fine as the new drives
show up under the SCSI adapter and are listed in the
HKLM\Hardware\Devicemap\Scsi\ hive of the registry.
However the class driver does not create new devices (\Device\CdRomx)
thougt I get no error return from DeviceIoControl(). I tried
IOCTL_DISK_FIND_NEW_DEVICES, IOCTL_CDROM_FIND_NEW_DEVICES and
IOCTL_STORAGE_FIND_NEW_DEVICES without success. Starting Windisk has no
effect either. Next step was compiling the class driver included in the
ddk
(cdrom.sys)to see what happens there, but this gives a BSOD as soon as
the
IOCTL_DISK_FIND_NEW_DEVICES is executed. Is something wrong with my code
or
do I have to do something else to get my drives recognized?
The same code works fine on W2K.

BTW: The drive letter I’m using to talk to the class driver is one of my

drives which are already there and reside on the same SCSI port and bus.

Kind regards,

Bernd

HANDLE OpenDevice(LPCTSTR lpFileName)
{
return CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);
}


char szDev[30];
char szFormat = “\\.\Scsi%d:”;
wsprintf(szDev, szFormat, m_Port);
HANDLE hDevice = OpenDevice(szDev);
if(hDevice == INVALID_HANDLE_VALUE)
{
CString strOut;
strOut.Format(“Could not open %s”, szDev);
AfxMessageBox(strOut);
return;
}

DWORD dwReturned;
BOOL bRc;
bRc = DeviceIoControl(hDevice, IOCTL_SCSI_RESCAN_BUS,
NULL,
0,
NULL,
0,

&dwReturned,
FALSE);

CloseHandle(hDevice);
if(!bRc)
{
AfxMessageBox(“ReScan failed”);
return;
}
char szFormat1 = “\\.\%C:”;
wsprintf(szDev, szFormat1, m_cDrive);
hDevice = OpenDevice(szDev);
if(hDevice == INVALID_HANDLE_VALUE)
{
CString strOut;
strOut.Format(“Could not open %s”, szDev);
AfxMessageBox(strOut);
return;
}
// call the driver
bRc = DeviceIoControl(hDevice, // device handle
IOCTL_DISK_FIND_NEW_DEVICES,
NULL, // input buffer
0, // input
buffer length
NULL, // output buffer
0, // output buffer length
&dwReturned, // # bytes returned
NULL); // synchronous call
if(!bRc)
{
CString strOut;
strOut.Format(“IOCTL_DISK_FIND_NEW_DEVICES failed”);
AfxMessageBox(strOut);
}

bRc = DeviceIoControl(hDevice, // device handle
IOCTL_CDROM_FIND_NEW_DEVICES,
NULL, // input buffer
0, // input buffer length
NULL, // output buffer
0, // output buffer length
&dwReturned, // # bytes returned
NULL); // synchronous call
if(!bRc)
{
CString strOut;
strOut.Format(“IOCTL_CDROM_FIND_NEW_DEVICES failed”);
AfxMessageBox(strOut);
}
bRc = DeviceIoControl(hDevice, // device handle
IOCTL_STORAGE_FIND_NEW_DEVICES,
NULL, // input buffer
0, // input
buffer length
NULL, // output buffer
0, // output buffer length
&dwReturned, // # bytes returned
NULL); // synchronous call

if(!bRc)
{
CString strOut;
strOut.Format(“IOCTL_STORAGE_FIND_NEW_DEVICES failed”);
AfxMessageBox(strOut);
}
CloseHandle(hDevice);
return;


You are currently subscribed to ntfsd as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

We developed a SCSI port driver that loads after BOOT. It talks to NDIS, so
it must start late. Running DiskAdministrator enumerates my new devices and
shows them in DA. I can then use DA to assign a drive letter.

Drive letters not assigned at boot time are not sticky.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Youssef Barakat
Sent: Wednesday, May 16, 2001 2:05 PM
To: File Systems Developers
Subject: [ntfsd] RE: IOCTL_DISK_FIND_NEW_DEVICES on NT4

Hi Bernd,

NT4 is not a plug and play OS like Windows2000. Which would explain why
any devices not connected and powered on during boot up do not get
recognized after.

Regards,
Youssef Barakat – NTDDK Team
Windows Systems Developer Support
Microsoft

-----Original Message-----
From: windolph@hh-zfrk.com [mailto:windolph@hh-zfrk.com]
Sent: Tuesday, May 15, 2001 10:10 PM
To: File Systems Developers
Subject: [ntfsd] IOCTL_DISK_FIND_NEW_DEVICES on NT4

Hi all,

I have a problem to find new SCSI drives on NT4.
Scenario:
I have some external SCSI CDRom drives which are not powered on system
startup. These drives should be found as soon as I power up the drives.
In order to find the new drives I wrote a simple application which
rescan
the SCSI bus and then ask the class driver to find the new drives.
The (simplified) code is below. The rescan works fine as the new drives
show up under the SCSI adapter and are listed in the
HKLM\Hardware\Devicemap\Scsi\ hive of the registry.
However the class driver does not create new devices (\Device\CdRomx)
thougt I get no error return from DeviceIoControl(). I tried
IOCTL_DISK_FIND_NEW_DEVICES, IOCTL_CDROM_FIND_NEW_DEVICES and
IOCTL_STORAGE_FIND_NEW_DEVICES without success. Starting Windisk has no
effect either. Next step was compiling the class driver included in the
ddk
(cdrom.sys)to see what happens there, but this gives a BSOD as soon as
the
IOCTL_DISK_FIND_NEW_DEVICES is executed. Is something wrong with my code
or
do I have to do something else to get my drives recognized?
The same code works fine on W2K.

BTW: The drive letter I’m using to talk to the class driver is one of my

drives which are already there and reside on the same SCSI port and bus.

Kind regards,

Bernd

HANDLE OpenDevice(LPCTSTR lpFileName)
{
return CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);
}


char szDev[30];
char szFormat = “\\.\Scsi%d:”;
wsprintf(szDev, szFormat, m_Port);
HANDLE hDevice = OpenDevice(szDev);
if(hDevice == INVALID_HANDLE_VALUE)
{
CString strOut;
strOut.Format(“Could not open %s”, szDev);
AfxMessageBox(strOut);
return;
}

DWORD dwReturned;
BOOL bRc;
bRc = DeviceIoControl(hDevice, IOCTL_SCSI_RESCAN_BUS,
NULL,
0,
NULL,
0,

&dwReturned,
FALSE);

CloseHandle(hDevice);
if(!bRc)
{
AfxMessageBox(“ReScan failed”);
return;
}
char szFormat1 = “\\.\%C:”;
wsprintf(szDev, szFormat1, m_cDrive);
hDevice = OpenDevice(szDev);
if(hDevice == INVALID_HANDLE_VALUE)
{
CString strOut;
strOut.Format(“Could not open %s”, szDev);
AfxMessageBox(strOut);
return;
}
// call the driver
bRc = DeviceIoControl(hDevice, // device handle
IOCTL_DISK_FIND_NEW_DEVICES,
NULL, // input buffer
0, // input
buffer length
NULL, // output buffer
0, // output buffer length
&dwReturned, // # bytes returned
NULL); // synchronous call
if(!bRc)
{
CString strOut;
strOut.Format(“IOCTL_DISK_FIND_NEW_DEVICES failed”);
AfxMessageBox(strOut);
}

bRc = DeviceIoControl(hDevice, // device handle
IOCTL_CDROM_FIND_NEW_DEVICES,
NULL, // input buffer
0, // input buffer length
NULL, // output buffer
0, // output buffer length
&dwReturned, // # bytes returned
NULL); // synchronous call
if(!bRc)
{
CString strOut;
strOut.Format(“IOCTL_CDROM_FIND_NEW_DEVICES failed”);
AfxMessageBox(strOut);
}
bRc = DeviceIoControl(hDevice, // device handle
IOCTL_STORAGE_FIND_NEW_DEVICES,
NULL, // input buffer
0, // input
buffer length
NULL, // output buffer
0, // output buffer length
&dwReturned, // # bytes returned
NULL); // synchronous call

if(!bRc)
{
CString strOut;
strOut.Format(“IOCTL_STORAGE_FIND_NEW_DEVICES failed”);
AfxMessageBox(strOut);
}
CloseHandle(hDevice);
return;


You are currently subscribed to ntfsd as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

>NT4 is not a plug and play OS like Windows2000. Which would explain why

any devices not connected and powered on during boot up do not get
recognized after.

At least the DDS tape drive is recognized while being power off at boot in
NT4.
Power it up and run WinDisk to rescan the buses - and it will appear.

Max


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Thus, the problem of the original poster is somewhere in CdRom.sys, not in
SCSI stack.

----- Original Message -----
From: “Jamey Kirby”
To: “File Systems Developers”
Sent: Thursday, May 17, 2001 1:17 AM
Subject: [ntfsd] RE: IOCTL_DISK_FIND_NEW_DEVICES on NT4

> We developed a SCSI port driver that loads after BOOT. It talks to NDIS,
so
> it must start late. Running DiskAdministrator enumerates my new devices
and
> shows them in DA. I can then use DA to assign a drive letter.
>
> Drive letters not assigned at boot time are not sticky.
>
> Jamey
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Youssef Barakat
> > Sent: Wednesday, May 16, 2001 2:05 PM
> > To: File Systems Developers
> > Subject: [ntfsd] RE: IOCTL_DISK_FIND_NEW_DEVICES on NT4
> >
> >
> >
> >
> >
> > Hi Bernd,
> >
> > NT4 is not a plug and play OS like Windows2000. Which would explain why
> > any devices not connected and powered on during boot up do not get
> > recognized after.
> >
> > Regards,
> > Youssef Barakat – NTDDK Team
> > Windows Systems Developer Support
> > Microsoft
> >
> > -----Original Message-----
> > From: windolph@hh-zfrk.com [mailto:windolph@hh-zfrk.com]
> > Sent: Tuesday, May 15, 2001 10:10 PM
> > To: File Systems Developers
> > Subject: [ntfsd] IOCTL_DISK_FIND_NEW_DEVICES on NT4
> >
> > Hi all,
> >
> > I have a problem to find new SCSI drives on NT4.
> > Scenario:
> > I have some external SCSI CDRom drives which are not powered on system
> > startup. These drives should be found as soon as I power up the drives.
> > In order to find the new drives I wrote a simple application which
> > rescan
> > the SCSI bus and then ask the class driver to find the new drives.
> > The (simplified) code is below. The rescan works fine as the new drives
> > show up under the SCSI adapter and are listed in the
> > HKLM\Hardware\Devicemap\Scsi\ hive of the registry.
> > However the class driver does not create new devices (\Device\CdRomx)
> > thougt I get no error return from DeviceIoControl(). I tried
> > IOCTL_DISK_FIND_NEW_DEVICES, IOCTL_CDROM_FIND_NEW_DEVICES and
> > IOCTL_STORAGE_FIND_NEW_DEVICES without success. Starting Windisk has no
> > effect either. Next step was compiling the class driver included in the
> > ddk
> > (cdrom.sys)to see what happens there, but this gives a BSOD as soon as
> > the
> > IOCTL_DISK_FIND_NEW_DEVICES is executed. Is something wrong with my code
> > or
> > do I have to do something else to get my drives recognized?
> > The same code works fine on W2K.
> >
> > BTW: The drive letter I’m using to talk to the class driver is one of my
> >
> > drives which are already there and reside on the same SCSI port and bus.
> >
> >
> > Kind regards,
> >
> > Bernd
> >
> >
> > HANDLE OpenDevice(LPCTSTR lpFileName)
> > {
> > return CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ |
> > FILE_SHARE_WRITE, NULL,
> > OPEN_EXISTING, 0, NULL);
> > }
> >
> > …
> > char szDev[30];
> > char szFormat = “\\.\Scsi%d:”;
> > wsprintf(szDev, szFormat, m_Port);
> > HANDLE hDevice = OpenDevice(szDev);
> > if(hDevice == INVALID_HANDLE_VALUE)
> > {
> > CString strOut;
> > strOut.Format(“Could not open %s”, szDev);
> > AfxMessageBox(strOut);
> > return;
> > }
> >
> > DWORD dwReturned;
> > BOOL bRc;
> > bRc = DeviceIoControl(hDevice, IOCTL_SCSI_RESCAN_BUS,
> > NULL,
> > 0,
> > NULL,
> > 0,
> >
> > &dwReturned,
> > FALSE);
> >
> > CloseHandle(hDevice);
> > if(!bRc)
> > {
> > AfxMessageBox(“ReScan failed”);
> > return;
> > }
> > char szFormat1 = “\\.\%C:”;
> > wsprintf(szDev, szFormat1, m_cDrive);
> > hDevice = OpenDevice(szDev);
> > if(hDevice == INVALID_HANDLE_VALUE)
> > {
> > CString strOut;
> > strOut.Format(“Could not open %s”, szDev);
> > AfxMessageBox(strOut);
> > return;
> > }
> > // call the driver
> > bRc = DeviceIoControl(hDevice, // device handle
> > IOCTL_DISK_FIND_NEW_DEVICES,
> > NULL, // input buffer
> > 0, // input
> > buffer length
> > NULL, // output buffer
> > 0, // output buffer length
> > &dwReturned, // # bytes returned
> > NULL); // synchronous call
> > if(!bRc)
> > {
> > CString strOut;
> > strOut.Format(“IOCTL_DISK_FIND_NEW_DEVICES failed”);
> > AfxMessageBox(strOut);
> > }
> >
> > bRc = DeviceIoControl(hDevice, // device handle
> > IOCTL_CDROM_FIND_NEW_DEVICES,
> > NULL, // input buffer
> > 0, // input buffer length
> > NULL, // output buffer
> > 0, // output buffer length
> > &dwReturned, // # bytes returned
> > NULL); // synchronous call
> > if(!bRc)
> > {
> > CString strOut;
> > strOut.Format(“IOCTL_CDROM_FIND_NEW_DEVICES failed”);
> > AfxMessageBox(strOut);
> > }
> > bRc = DeviceIoControl(hDevice, // device handle
> > IOCTL_STORAGE_FIND_NEW_DEVICES,
> > NULL, // input buffer
> > 0, // input
> > buffer length
> > NULL, // output buffer
> > 0, // output buffer length
> > &dwReturned, // # bytes returned
> > NULL); // synchronous call
> >
> > if(!bRc)
> > {
> > CString strOut;
> > strOut.Format(“IOCTL_STORAGE_FIND_NEW_DEVICES failed”);
> > AfxMessageBox(strOut);
> > }
> > CloseHandle(hDevice);
> > return;
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@microsoft.com
> > To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

To clarify what I said: since NT4 has no concept of FDOs and PDOs, and
since legacy NT4 drivers cannot be ‘stopped’ for resource rebalancing as
in Win2k/ME WDM drivers, its not in the NT4 architecture to support
devices connected or ‘powered on’ except during boot up. I’m not saying
it cannot be done, I’m just saying it’s not supported by the
architecture. If anyone can actually help Bernd with a solution around
the architecture, I think it would be useful to him. I just wanted to
bring that to his attention.

Regards,
Youssef Barakat – NTDDK Team
Windows Systems Developer Support
Tel: (425) 704-3647
Microsoft

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, May 16, 2001 3:46 PM
To: File Systems Developers
Subject: [ntfsd] RE: IOCTL_DISK_FIND_NEW_DEVICES on NT4

Thus, the problem of the original poster is somewhere in CdRom.sys, not
in
SCSI stack.

----- Original Message -----
From: “Jamey Kirby”
To: “File Systems Developers”
Sent: Thursday, May 17, 2001 1:17 AM
Subject: [ntfsd] RE: IOCTL_DISK_FIND_NEW_DEVICES on NT4

> We developed a SCSI port driver that loads after BOOT. It talks to
NDIS,
so
> it must start late. Running DiskAdministrator enumerates my new
devices
and
> shows them in DA. I can then use DA to assign a drive letter.
>
> Drive letters not assigned at boot time are not sticky.
>
> Jamey
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Youssef Barakat
> > Sent: Wednesday, May 16, 2001 2:05 PM
> > To: File Systems Developers
> > Subject: [ntfsd] RE: IOCTL_DISK_FIND_NEW_DEVICES on NT4
> >
> >
> >
> >
> >
> > Hi Bernd,
> >
> > NT4 is not a plug and play OS like Windows2000. Which would explain
why
> > any devices not connected and powered on during boot up do not get
> > recognized after.
> >
> > Regards,
> > Youssef Barakat – NTDDK Team
> > Windows Systems Developer Support
> > Microsoft
> >
> > -----Original Message-----
> > From: windolph@hh-zfrk.com [mailto:windolph@hh-zfrk.com]
> > Sent: Tuesday, May 15, 2001 10:10 PM
> > To: File Systems Developers
> > Subject: [ntfsd] IOCTL_DISK_FIND_NEW_DEVICES on NT4
> >
> > Hi all,
> >
> > I have a problem to find new SCSI drives on NT4.
> > Scenario:
> > I have some external SCSI CDRom drives which are not powered on
system
> > startup. These drives should be found as soon as I power up the
drives.
> > In order to find the new drives I wrote a simple application which
> > rescan
> > the SCSI bus and then ask the class driver to find the new drives.
> > The (simplified) code is below. The rescan works fine as the new
drives
> > show up under the SCSI adapter and are listed in the
> > HKLM\Hardware\Devicemap\Scsi\ hive of the registry.
> > However the class driver does not create new devices
(\Device\CdRomx)
> > thougt I get no error return from DeviceIoControl(). I tried
> > IOCTL_DISK_FIND_NEW_DEVICES, IOCTL_CDROM_FIND_NEW_DEVICES and
> > IOCTL_STORAGE_FIND_NEW_DEVICES without success. Starting Windisk has
no
> > effect either. Next step was compiling the class driver included in
the
> > ddk
> > (cdrom.sys)to see what happens there, but this gives a BSOD as soon
as
> > the
> > IOCTL_DISK_FIND_NEW_DEVICES is executed. Is something wrong with my
code
> > or
> > do I have to do something else to get my drives recognized?
> > The same code works fine on W2K.
> >
> > BTW: The drive letter I’m using to talk to the class driver is one
of my
> >
> > drives which are already there and reside on the same SCSI port and
bus.
> >
> >
> > Kind regards,
> >
> > Bernd
> >
> >
> > HANDLE OpenDevice(LPCTSTR lpFileName)
> > {
> > return CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ |
> > FILE_SHARE_WRITE, NULL,
> > OPEN_EXISTING, 0, NULL);
> > }
> >
> > …
> > char szDev[30];
> > char szFormat = “\\.\Scsi%d:”;
> > wsprintf(szDev, szFormat, m_Port);
> > HANDLE hDevice = OpenDevice(szDev);
> > if(hDevice == INVALID_HANDLE_VALUE)
> > {
> > CString strOut;
> > strOut.Format(“Could not open %s”, szDev);
> > AfxMessageBox(strOut);
> > return;
> > }
> >
> > DWORD dwReturned;
> > BOOL bRc;
> > bRc = DeviceIoControl(hDevice, IOCTL_SCSI_RESCAN_BUS,
> > NULL,
> > 0,
> > NULL,
> > 0,
> >
> > &dwReturned,
> > FALSE);
> >
> > CloseHandle(hDevice);
> > if(!bRc)
> > {
> > AfxMessageBox(“ReScan failed”);
> > return;
> > }
> > char szFormat1 = “\\.\%C:”;
> > wsprintf(szDev, szFormat1, m_cDrive);
> > hDevice = OpenDevice(szDev);
> > if(hDevice == INVALID_HANDLE_VALUE)
> > {
> > CString strOut;
> > strOut.Format(“Could not open %s”, szDev);
> > AfxMessageBox(strOut);
> > return;
> > }
> > // call the driver
> > bRc = DeviceIoControl(hDevice, // device handle
> > IOCTL_DISK_FIND_NEW_DEVICES,
> > NULL, // input buffer
> > 0, // input
> > buffer length
> > NULL, // output buffer
> > 0, // output buffer length
> > &dwReturned, // # bytes returned
> > NULL); // synchronous call
> > if(!bRc)
> > {
> > CString strOut;
> > strOut.Format(“IOCTL_DISK_FIND_NEW_DEVICES failed”);
> > AfxMessageBox(strOut);
> > }
> >
> > bRc = DeviceIoControl(hDevice, // device handle
> > IOCTL_CDROM_FIND_NEW_DEVICES,
> > NULL, // input buffer
> > 0, // input buffer length
> > NULL, // output buffer
> > 0, // output buffer length
> > &dwReturned, // # bytes returned
> > NULL); // synchronous call
> > if(!bRc)
> > {
> > CString strOut;
> > strOut.Format(“IOCTL_CDROM_FIND_NEW_DEVICES failed”);
> > AfxMessageBox(strOut);
> > }
> > bRc = DeviceIoControl(hDevice, // device handle
> > IOCTL_STORAGE_FIND_NEW_DEVICES,
> > NULL, // input buffer
> > 0, // input
> > buffer length
> > NULL, // output buffer
> > 0, // output buffer length
> > &dwReturned, // # bytes returned
> > NULL); // synchronous call
> >
> > if(!bRc)
> > {
> > CString strOut;
> > strOut.Format(“IOCTL_STORAGE_FIND_NEW_DEVICES failed”);
> > AfxMessageBox(strOut);
> > }
> > CloseHandle(hDevice);
> > return;
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@microsoft.com
> > To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntfsd as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

On 05/16/01, ““Youssef Barakat” ” wrote:
> To clarify what I said: since NT4 has no concept of FDOs and PDOs, and
> since legacy NT4 drivers cannot be ‘stopped’ for resource rebalancing as
> in Win2k/ME WDM drivers, its not in the NT4 architecture to support
> devices connected or ‘powered on’ except during boot up. I’m not saying
> it cannot be done, I’m just saying it’s not supported by the
> architecture. If anyone can actually help Bernd with a solution around
> the architecture, I think it would be useful to him. I just wanted to
> bring that to his attention.
>

Arghh! I think you’re only half right. NT4 has no GENERAL PURPOSE
mechanism for adding devices after the system is booted. But it has a
perfectly well defined interface for configuring new SCSI devices that are
added to a bus anytime after a boot. It is IOCTL_SCSI_RESCAN_BUS. That’s
what Windisk uses, and the reason that running Windisk after adding a new
device will make it appear. This has absolutely nothing to do with
plug-and-play. (By the way, it’s also the way that MSCS can make a disk
device appear and disappear during a cluster transition.)

The problem, as someone stated, is that the CD-ROM SCSI class driver,
cdrom.sys, doesn’t “claim” new devices after a bus rescan. Apparently,
only the Disk class driver disk.sys is smart enough to do that in NT4. You
can add any number of SCSI disks to an NT4 system after it’s booted, and
simply running Windisk (or invoking IOCTL_SCSI_RESCAN_BUS yourself) will
make them appear. (BTW, making them disappear is harder.)

Carl Appellof
VERITAS Software Corp.


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> can add any number of SCSI disks to an NT4 system after it’s booted, and

simply running Windisk (or invoking IOCTL_SCSI_RESCAN_BUS yourself) will
make them appear.

You must issue IOCTL_DISK_FIND_NEW_DEVICES after IOCTL_SCSI_RESCAN_BUS.

(BTW, making them disappear is harder.)

Yes, Disk.sys seems to never delete its device objects.
The maximum I have achieved is making them as “Offline” but not disappear.

Max


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Thanks to all who takes the time to reply to my posting.
From the answers I got I think I have to write my own class driver
to get my drives recognized. There should be some hint in the docs.

Thank you.

Bernd


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You don’t have to write your own CD-ROM class driver. In cdrom.c
under CdRomDeviceControl(), just add these few lines and compile.
DriverEntry is re-entrant, so you don’t have to worry about that.

From WinDisk, you should be able to see your SCSI CD-ROM drive
and should be able to assign a drive letter.

case IOCTL_CDROM_FIND_NEW_DEVICES:

//
// Search for devices that have been powered on since the last
// device search or system initialization.
//

DebugPrint((3,“CdRomDeviceControl: Find devices\n”));
status = DriverEntry (DeviceObject->DriverObject, NULL);

Irp->IoStatus.Status = status;
ExFreePool (srb);
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return status;

Hope this helps,
Niraj

-----Original Message-----
From: windolph@hh-zfrk.com [mailto:windolph@hh-zfrk.com]
Sent: Thursday, May 17, 2001 7:47 PM
To: File Systems Developers
Subject: [ntfsd] Re: IOCTL_DISK_FIND_NEW_DEVICES on NT4

Thanks to all who takes the time to reply to my posting.

From the answers I got I think I have to write my own class driver
to get my drives recognized. There should be some hint in the docs.

Thank you.

Bernd


You are currently subscribed to ntfsd as: xxxxx@netapp.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com