Q: Virtual CD/DVDs and Terminal Server

Hi,

We have a product that manages virtual devices (CD/DVDs) with the help of
the monolithic SCSI port driver. We do precreate the pool of devices and
assign symbolic links when we need to “create” devices.

When running under Windows Terminal Server the function GetLogicalDrives()
returns the mask of the devices w/o just created symbolic links (system
does not detect new drive letter appeared). Other Windowses work fine.

Does this look like ours bug or what? How can we “kick the system” to make
it update drives mask?

Regards,
Anton A. Kolomyeytsev

CoolDev.Com - Toolkits for Network & Storage Kernel Software Developers

> Hi,

We have a product that manages virtual devices (CD/DVDs) with the help of
the monolithic SCSI port driver. We do precreate the pool of devices and
assign symbolic links when we need to “create” devices.

When running under Windows Terminal Server the function GetLogicalDrives()
returns the mask of the devices w/o just created symbolic links (system
does not detect new drive letter appeared). Other Windowses work fine.

Does this look like ours bug or what? How can we “kick the system” to make
it update drives mask?

Regards,
Anton A. Kolomyeytsev

What version of terminal services are you using? I think up to and including 2k, you got a snapshot of the available symbolic links when you logged and anything created afterwards in another session was not brought into your session space. I know some work was done on XP to rectify this, but I am not sure to what extent.

d

This posting is provided “AS IS” with no warranties, and confers no rights.


From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]
Sent: Wed 9/4/2002 12:55 AM
To: NT Developers Interest List
Cc:
Subject: [ntdev] Q: Virtual CD/DVDs and Terminal Server

Hi,

We have a product that manages virtual devices (CD/DVDs) with the help of
the monolithic SCSI port driver. We do precreate the pool of devices and
assign symbolic links when we need to “create” devices.

When running under Windows Terminal Server the function GetLogicalDrives()
returns the mask of the devices w/o just created symbolic links (system
does not detect new drive letter appeared). Other Windowses work fine.

Does this look like ours bug or what? How can we “kick the system” to make
it update drives mask?

Regards,
Anton A. Kolomyeytsev

CoolDev.Com - Toolkits for Network & Storage Kernel Software Developers


You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%

btw, small comments:

Links are created in a global namespace. When session has been created
they
appears to be successfully propagated to session namespace, so there ARE
links like ??\V: in a session space that perfectly enumeratable using
QueryDosDevice() BUT GetLogicalDrives() does not return bits set for those
letters.
This is not reproducible under Cytrix or NT4 -> platform is NT5AS.

What version of terminal services are you using? I think up to and =
including 2k, you got a snapshot of the available symbolic links when =
you logged and anything created afterwards in another session was not =
brought into your session space. I know some work was done on XP to =
rectify this, but I am not sure to what extent.
=20
d
=20
This posting is provided “AS IS” with no warranties, and confers no =
rights.=20
=20
_____ =20

From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]=09
Sent: Wed 9/4/2002 12:55 AM=09
To: NT Developers Interest List=09
Cc: =09
Subject: [ntdev] Q: Virtual CD/DVDs and Terminal Server=09
=09
=09

Hi,

We have a product that manages virtual devices (CD/DVDs) with the help =
of
the monolithic SCSI port driver. We do precreate the pool of devices and
assign symbolic links when we need to “create” devices.

When running under Windows Terminal Server the function =
GetLogicalDrives()
returns the mask of the devices w/o just created symbolic links (system
does not detect new drive letter appeared). Other Windowses work fine.

Does this look like ours bug or what? How can we “kick the system” to =
make
it update drives mask?

Regards,
Anton A. Kolomyeytsev

CoolDev.Com - Toolkits for Network & Storage Kernel Software Developers


You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%

You need to broadcasting a message (from a Win32 app) to all components letting them know that a new volume device has arrived (or been removed). You can this with the following code:

// Here’s how you call the function when you’ve removed a drive letter
// In this call, DriveLetter is the drive letter that you removed
BroadcastVolumeDeviceChange(DBT_DEVICEREMOVECOMPLETE, DriveLetter);

// Here’s how you call the function when you’ve added a drive letter
// In this call, DriveLetter is the drive letter that you added
BroadcastVolumeDeviceChange(DBT_DBT_DEVICEARRIVAL, DriveLetter);

// Call this function when you’ve added/removed a drive letter symbolic
// link in kernel mode. When using Win32 alone to create your symbolic
// link (using DefineDosDevice()), you’ll end up with symbolic links in
// the session namespace (which you probably don’t want) rather than
// the global namespace. The solution is to create the drive letter
// symbolic links in kernel mode, but then you’ll discover (as you did)
// that DefineDosDevice() does more than just create symbolic links… it
// also notifies everybody that a drive letter assignment was made. So
// if you create your symbolic links in kernel mode you’ll need to add this
// extra functionality, and as far as I can tell this function is sufficient.
HRESULT BroadcastVolumeDeviceChange(WPARAM notification, WCHAR DriveLetter)
{
static PDEV_BROADCAST_VOLUME pMyDevHdr = NULL;
DWORD dwFlag = BSM_ALLCOMPONENTS;
DWORD volumeMask = 1 << (DriveLetter - L’A’);

// Allocate our broadcast header and keep it around (static)
// We have to keep it around because if we post the broadcast the buffers that we
// pass into the broadcast have to stick around after this call returns.
if (NULL == pMyDevHdr)
{
pMyDevHdr = new DEV_BROADCAST_VOLUME;
}

// Initialize our broadcast header
pMyDevHdr->dbcv_devicetype = DBT_DEVTYP_VOLUME;
pMyDevHdr->dbcv_size = sizeof(DEV_BROADCAST_VOLUME);
pMyDevHdr->dbcv_flags = DBTF_NET;
pMyDevHdr->dbcv_unitmask = volumeMask;

// Broadcast the device change notification
BroadcastSystemMessage(BSF_IGNORECURRENTTASK, &dwFlag, WM_DEVICECHANGE, notification, (LPARAM) pMyDevHdr);

return S_OK;
}

BTW - This only works on W2K and above.

-----Original Message-----
From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]
Sent: Thursday, September 05, 2002 12:43 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Q: Virtual CD/DVDs and Terminal Server

btw, small comments:

Links are created in a global namespace. When session has been created
they
appears to be successfully propagated to session namespace, so there ARE
links like ??\V: in a session space that perfectly enumeratable using
QueryDosDevice() BUT GetLogicalDrives() does not return bits set for those
letters.
This is not reproducible under Cytrix or NT4 -> platform is NT5AS.

What version of terminal services are you using? I think up to and =
including 2k, you got a snapshot of the available symbolic links when =
you logged and anything created afterwards in another session was not =
brought into your session space. I know some work was done on XP to =
rectify this, but I am not sure to what extent.
=20
d
=20
This posting is provided “AS IS” with no warranties, and confers no =
rights.=20
=20
_____ =20

From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]=09
Sent: Wed 9/4/2002 12:55 AM=09
To: NT Developers Interest List=09
Cc: =09
Subject: [ntdev] Q: Virtual CD/DVDs and Terminal Server=09
=09
=09

Hi,

We have a product that manages virtual devices (CD/DVDs) with the help =
of
the monolithic SCSI port driver. We do precreate the pool of devices and
assign symbolic links when we need to “create” devices.

When running under Windows Terminal Server the function =
GetLogicalDrives()
returns the mask of the devices w/o just created symbolic links (system
does not detect new drive letter appeared). Other Windowses work fine.

Does this look like ours bug or what? How can we “kick the system” to =
make
it update drives mask?

Regards,
Anton A. Kolomyeytsev

CoolDev.Com - Toolkits for Network & Storage Kernel Software Developers


You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@powerquest.com
To unsubscribe send a blank email to %%email.unsub%%

You need to broadcast a message (from a Win32 app) to all components letting them know that a new volume device has arrived (or been removed). You can this with the following code:

// Here’s how you call the function when you’ve removed a drive letter
// In this call, DriveLetter is the drive letter that you removed
BroadcastVolumeDeviceChange(DBT_DEVICEREMOVECOMPLETE, DriveLetter);

// Here’s how you call the function when you’ve added a drive letter
// In this call, DriveLetter is the drive letter that you added
BroadcastVolumeDeviceChange(DBT_DBT_DEVICEARRIVAL, DriveLetter);

// Call this function when you’ve added/removed a drive letter symbolic
// link in kernel mode. When using Win32 alone to create your symbolic
// link (using DefineDosDevice()), you’ll end up with symbolic links in
// the session namespace (which you probably don’t want) rather than
// the global namespace. The solution is to create the drive letter
// symbolic links in kernel mode, but then you’ll discover (as you did)
// that DefineDosDevice() does more than just create symbolic links… it
// also notifies everybody that a drive letter assignment was made. So
// if you create your symbolic links in kernel mode you’ll need to add this
// extra functionality, and as far as I can tell this function is sufficient.
HRESULT BroadcastVolumeDeviceChange(WPARAM notification, WCHAR DriveLetter)
{
static PDEV_BROADCAST_VOLUME pMyDevHdr = NULL;
DWORD dwFlag = BSM_ALLCOMPONENTS;
DWORD volumeMask = 1 << (DriveLetter - L’A’);

// Allocate our broadcast header and keep it around (static)
// We have to keep it around because if we post the broadcast the buffers that we
// pass into the broadcast have to stick around after this call returns.
if (NULL == pMyDevHdr)
{
pMyDevHdr = new DEV_BROADCAST_VOLUME;
}

// Initialize our broadcast header
pMyDevHdr->dbcv_devicetype = DBT_DEVTYP_VOLUME;
pMyDevHdr->dbcv_size = sizeof(DEV_BROADCAST_VOLUME);
pMyDevHdr->dbcv_flags = DBTF_NET;
pMyDevHdr->dbcv_unitmask = volumeMask;

// Broadcast the device change notification
BroadcastSystemMessage(BSF_IGNORECURRENTTASK,
&dwFlag,
WM_DEVICECHANGE,
notification,
(LPARAM)pMyDevHdr);

return S_OK;
}

BTW - This only works on W2K and above.

-----Original Message-----
From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]
Sent: Thursday, September 05, 2002 12:43 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Q: Virtual CD/DVDs and Terminal Server

btw, small comments:

Links are created in a global namespace. When session has been created
they
appears to be successfully propagated to session namespace, so there ARE
links like ??\V: in a session space that perfectly enumeratable using
QueryDosDevice() BUT GetLogicalDrives() does not return bits set for those
letters.
This is not reproducible under Cytrix or NT4 -> platform is NT5AS.

What version of terminal services are you using? I think up to and =
including 2k, you got a snapshot of the available symbolic links when =
you logged and anything created afterwards in another session was not =
brought into your session space. I know some work was done on XP to =
rectify this, but I am not sure to what extent.
=20
d
=20
This posting is provided “AS IS” with no warranties, and confers no =
rights.=20
=20
_____ =20

From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]=09
Sent: Wed 9/4/2002 12:55 AM=09
To: NT Developers Interest List=09
Cc: =09
Subject: [ntdev] Q: Virtual CD/DVDs and Terminal Server=09
=09
=09

Hi,

We have a product that manages virtual devices (CD/DVDs) with the help =
of
the monolithic SCSI port driver. We do precreate the pool of devices and
assign symbolic links when we need to “create” devices.

When running under Windows Terminal Server the function =
GetLogicalDrives()
returns the mask of the devices w/o just created symbolic links (system
does not detect new drive letter appeared). Other Windowses work fine.

Does this look like ours bug or what? How can we “kick the system” to =
make
it update drives mask?

Regards,
Anton A. Kolomyeytsev

CoolDev.Com - Toolkits for Network & Storage Kernel Software Developers


You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@powerquest.com
To unsubscribe send a blank email to %%email.unsub%%

Nate,

we have nearly identical code in our Win32 front-side app. I’ve even
replaced our code with yours. It does not help -( Any ideas why can this
happen?

Thanks for help!

Anton Kolomyeytsev

You need to broadcast a message (from a Win32 app) to all components =
letting them know that a new volume device has arrived (or been =
removed). You can this with the following code:

// Here’s how you call the function when you’ve removed a drive letter
// In this call, DriveLetter is the drive letter that you removed
BroadcastVolumeDeviceChange(DBT_DEVICEREMOVECOMPLETE, DriveLetter);

// Here’s how you call the function when you’ve added a drive letter
// In this call, DriveLetter is the drive letter that you added
BroadcastVolumeDeviceChange(DBT_DBT_DEVICEARRIVAL, DriveLetter);

// Call this function when you’ve added/removed a drive letter symbolic
// link in kernel mode. When using Win32 alone to create your symbolic
// link (using DefineDosDevice()), you’ll end up with symbolic links in
// the session namespace (which you probably don’t want) rather than
// the global namespace. The solution is to create the drive letter
// symbolic links in kernel mode, but then you’ll discover (as you did)
// that DefineDosDevice() does more than just create symbolic links… =
it
// also notifies everybody that a drive letter assignment was made. So
// if you create your symbolic links in kernel mode you’ll need to add =
this
// extra functionality, and as far as I can tell this function is =
sufficient.
HRESULT BroadcastVolumeDeviceChange(WPARAM notification, WCHAR =
DriveLetter)
{
static PDEV_BROADCAST_VOLUME pMyDevHdr =3D NULL;
DWORD dwFlag =3D BSM_ALLCOMPONENTS;
DWORD volumeMask =3D 1 << (DriveLetter - L’A’);

// Allocate our broadcast header and keep it around (static)
// We have to keep it around because if we post the broadcast the =
buffers that we
// pass into the broadcast have to stick around after this call =
returns.
if (NULL =3D=3D pMyDevHdr)
{
pMyDevHdr =3D new DEV_BROADCAST_VOLUME;
}

// Initialize our broadcast header
pMyDevHdr->dbcv_devicetype =3D DBT_DEVTYP_VOLUME;
pMyDevHdr->dbcv_size =3D sizeof(DEV_BROADCAST_VOLUME);
pMyDevHdr->dbcv_flags =3D DBTF_NET;
pMyDevHdr->dbcv_unitmask =3D volumeMask;

// Broadcast the device change notification
BroadcastSystemMessage(BSF_IGNORECURRENTTASK,
&dwFlag,
WM_DEVICECHANGE,
notification,
(LPARAM)pMyDevHdr);

return S_OK;
}

BTW - This only works on W2K and above.

-----Original Message-----
From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]
Sent: Thursday, September 05, 2002 12:43 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Q: Virtual CD/DVDs and Terminal Server

btw, small comments:

Links are created in a global namespace. When session has been created
they
appears to be successfully propagated to session namespace, so there ARE
links like ??\V: in a session space that perfectly enumeratable using
QueryDosDevice() BUT GetLogicalDrives() does not return bits set for =
those
letters.
This is not reproducible under Cytrix or NT4 -> platform is NT5AS.

> What version of terminal services are you using? I think up to and =
=3D
> including 2k, you got a snapshot of the available symbolic links when =
=3D
> you logged and anything created afterwards in another session was not =
=3D
> brought into your session space. I know some work was done on XP to =
=3D
> rectify this, but I am not sure to what extent.
> =3D20
> d
> =3D20
> This posting is provided “AS IS” with no warranties, and confers no =
=3D
> rights.=3D20
> =3D20
> _____ =3D20
>=20
> From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]=3D09
> Sent: Wed 9/4/2002 12:55 AM=3D09
> To: NT Developers Interest List=3D09
> Cc: =3D09
> Subject: [ntdev] Q: Virtual CD/DVDs and Terminal Server=3D09
> =3D09
> =3D09
>=20
> Hi,
>=20
> We have a product that manages virtual devices (CD/DVDs) with the help =
=3D
> of
> the monolithic SCSI port driver. We do precreate the pool of devices =
and
> assign symbolic links when we need to “create” devices.
>=20
> When running under Windows Terminal Server the function =3D
> GetLogicalDrives()
> returns the mask of the devices w/o just created symbolic links =
(system
> does not detect new drive letter appeared). Other Windowses work fine.
>=20
> Does this look like ours bug or what? How can we “kick the system” to =
=3D
> make
> it update drives mask?
>=20
> Regards,
> Anton A. Kolomyeytsev
>=20
> CoolDev.Com - Toolkits for Network & Storage Kernel Software =
Developers
>=20
> —
> You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@powerquest.com
To unsubscribe send a blank email to %%email.unsub%%

Anton,

Does your new drive letter for your virtual device show up in IE after you broadcast the update? If so, then at least SOME of the Win32 subsystem is getting updated. I don’t know why GetLogicalDrives() still fails to show your changes after the broadcast. I’ll ask around. Please let me know if you find the solution. Perhaps the broadcast isn’t getting to the component that keeps track of the GetLogicalDrives() info because of a permissions issue… is your Win32 frontend a service, and if so is it using the user’s credentials or admin? That’s just a wild guess though, I really don’t know why it doesn’t update.

-----Original Message-----
From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]
Sent: Friday, September 06, 2002 1:17 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Q: Virtual CD/DVDs and Terminal Server

Nate,

we have nearly identical code in our Win32 front-side app. I’ve even
replaced our code with yours. It does not help -( Any ideas why can this
happen?

Thanks for help!

Anton Kolomyeytsev

You need to broadcast a message (from a Win32 app) to all components =
letting them know that a new volume device has arrived (or been =
removed). You can this with the following code:

// Here’s how you call the function when you’ve removed a drive letter
// In this call, DriveLetter is the drive letter that you removed
BroadcastVolumeDeviceChange(DBT_DEVICEREMOVECOMPLETE, DriveLetter);

// Here’s how you call the function when you’ve added a drive letter
// In this call, DriveLetter is the drive letter that you added
BroadcastVolumeDeviceChange(DBT_DBT_DEVICEARRIVAL, DriveLetter);

// Call this function when you’ve added/removed a drive letter symbolic
// link in kernel mode. When using Win32 alone to create your symbolic
// link (using DefineDosDevice()), you’ll end up with symbolic links in
// the session namespace (which you probably don’t want) rather than
// the global namespace. The solution is to create the drive letter
// symbolic links in kernel mode, but then you’ll discover (as you did)
// that DefineDosDevice() does more than just create symbolic links… =
it
// also notifies everybody that a drive letter assignment was made. So
// if you create your symbolic links in kernel mode you’ll need to add =
this
// extra functionality, and as far as I can tell this function is =
sufficient.
HRESULT BroadcastVolumeDeviceChange(WPARAM notification, WCHAR =
DriveLetter)
{
static PDEV_BROADCAST_VOLUME pMyDevHdr =3D NULL;
DWORD dwFlag =3D BSM_ALLCOMPONENTS;
DWORD volumeMask =3D 1 << (DriveLetter - L’A’);

// Allocate our broadcast header and keep it around (static)
// We have to keep it around because if we post the broadcast the =
buffers that we
// pass into the broadcast have to stick around after this call =
returns.
if (NULL =3D=3D pMyDevHdr)
{
pMyDevHdr =3D new DEV_BROADCAST_VOLUME;
}

// Initialize our broadcast header
pMyDevHdr->dbcv_devicetype =3D DBT_DEVTYP_VOLUME;
pMyDevHdr->dbcv_size =3D sizeof(DEV_BROADCAST_VOLUME);
pMyDevHdr->dbcv_flags =3D DBTF_NET;
pMyDevHdr->dbcv_unitmask =3D volumeMask;

// Broadcast the device change notification
BroadcastSystemMessage(BSF_IGNORECURRENTTASK,
&dwFlag,
WM_DEVICECHANGE,
notification,
(LPARAM)pMyDevHdr);

return S_OK;
}

BTW - This only works on W2K and above.

-----Original Message-----
From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]
Sent: Thursday, September 05, 2002 12:43 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Q: Virtual CD/DVDs and Terminal Server

btw, small comments:

Links are created in a global namespace. When session has been created
they
appears to be successfully propagated to session namespace, so there ARE
links like ??\V: in a session space that perfectly enumeratable using
QueryDosDevice() BUT GetLogicalDrives() does not return bits set for =
those
letters.
This is not reproducible under Cytrix or NT4 -> platform is NT5AS.

> What version of terminal services are you using? I think up to and =
=3D
> including 2k, you got a snapshot of the available symbolic links when =
=3D
> you logged and anything created afterwards in another session was not =
=3D
> brought into your session space. I know some work was done on XP to =
=3D
> rectify this, but I am not sure to what extent.
> =3D20
> d
> =3D20
> This posting is provided “AS IS” with no warranties, and confers no =
=3D
> rights.=3D20
> =3D20
> _____ =3D20
>=20
> From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]=3D09
> Sent: Wed 9/4/2002 12:55 AM=3D09
> To: NT Developers Interest List=3D09
> Cc: =3D09
> Subject: [ntdev] Q: Virtual CD/DVDs and Terminal Server=3D09
> =3D09
> =3D09
>=20
> Hi,
>=20
> We have a product that manages virtual devices (CD/DVDs) with the help =
=3D
> of
> the monolithic SCSI port driver. We do precreate the pool of devices =
and
> assign symbolic links when we need to “create” devices.
>=20
> When running under Windows Terminal Server the function =3D
> GetLogicalDrives()
> returns the mask of the devices w/o just created symbolic links =
(system
> does not detect new drive letter appeared). Other Windowses work fine.
>=20
> Does this look like ours bug or what? How can we “kick the system” to =
=3D
> make
> it update drives mask?
>=20
> Regards,
> Anton A. Kolomyeytsev
>=20
> CoolDev.Com - Toolkits for Network & Storage Kernel Software =
Developers
>=20
> —
> You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@powerquest.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@powerquest.com
To unsubscribe send a blank email to %%email.unsub%%