Drive letter not changed in windows 2003




Hi,

I’m facing a problem while changing the drive letter assigned to a

remote drive(virtual drive) in windows 2003.

eg : if the original virtual drive letter is e:\ in windows it shows

as e:\ under MyComputer.

If I change the drive letter to some other thing say f:\ , the volume

label changes to Others

and the drive letter remains e:.But this drive is not accessible

through explorer.

But I’m able to see the changed drive letter to f:\ from command

prompt and also able to get

a handle to f:\ through windows program.

My file system driver code is working in windows 2000 and this

problem is seen only in windows 2003 server.

Am I missing out something?Why is the explorer not getting informed

about the change in drive letter?

Can you kindly help me out to solve this issue.

Regards,

Priya


Get your Free E-mail at http://freelancewriting.zzn.com
___________________________________________________________
Get your own Web-based E-mail Service at http://www.zzn.com

Hi,

If I understand you right, you do can access to the f: throw command,

So you did change driver letter, but you missed windows notification message that

there is no e: any more and that there is new driver letter f:

You can simply do it by sending 2 messages in user mode:

  • Device remove complete for “e:”

  • Device arrival for “f:”

ULONG ulAction = DBT_DEVICEARRIVAL;

/or DBT_DEVICEREMOVECOMPLETE;

result = BroadcastSystemMessage(

BSF_FLUSHDISK | BSF_FORCEIFHUNG,

NULL,

WM_DEVICECHANGE,

(WPARAM) ulAction,

(LPARAM)(DEV_BROADCAST_HDR*)pBuf

// see DEV_BROADCAST_VOLUME structure

);

I guess this will help you

Maxim

----- Original Message -----
From: priya priya
To: Windows File Systems Devs Interest List
Sent: Tuesday, December 28, 2004 8:48 AM
Subject: [ntfsd] Drive letter not changed in windows 2003

Hi,

I’m facing a problem while changing the drive letter assigned to a
remote drive(virtual drive) in windows 2003.

eg : if the original virtual drive letter is e:\ in windows it shows
as e:\ under MyComputer.
If I change the drive letter to some other thing say f:\ , the volume
label changes to Others
and the drive letter remains e:.But this drive is not accessible
through explorer.
But I’m able to see the changed drive letter to f:\ from command
prompt and also able to get
a handle to f:\ through windows program.

My file system driver code is working in windows 2000 and this
problem is seen only in windows 2003 server.
Am I missing out something?Why is the explorer not getting informed
about the change in drive letter?

Can you kindly help me out to solve this issue.

Regards,
Priya

Get your Free E-mail at http://freelancewriting.zzn.com


Get your own Web-based E-mail Service at http://www.zzn.com


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@secureol.com
To unsubscribe send a blank email to xxxxx@lists.osr.com




Hi,

Thanks for the information.

I wrote the follwoing code to check out…

#include “stdafx.h”

#include<iostream.h>

#define _WIN32_WINNT 0x0502

#include <windows.h>

#include <winuser.h>

#include <dbt.h> // for broadcast to explorer

HRESULT BroadcastVolumeDeviceChange(WPARAM notification,WCHAR

DriveLetter);

int APIENTRY WinMain(HINSTANCE hInstance,

HINSTANCE hPrevInstance,

LPSTR lpCmdLine,

int nCmdShow)

{

BroadcastVolumeDeviceChange(DBT_DEVICEREMOVECOMPLETE,L’E’);

return 1;

}

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;

}

The code is failing saying BroadcastSystemMessage undeclared

identifier.This call is defined in winuser.h.I added both winuser.h

and windows.h.it is throwing the same error.Can you please explain

what could be the reason?

Regards,

Priya


Get your Free E-mail at http://freelancewriting.zzn.com
___________________________________________________________
Get your own Web-based E-mail Service at http://www.zzn.com

</dbt.h></winuser.h></windows.h></iostream.h>

Hi Priya,

If you look at the header file winuser.h, you will see
something like this: (typing from memory)

#if WINVER>=0x0400

#if _WIN32_WINNT>=0x0400

// definition for BroadcastSystemMessage

#endif

#endif

You have not defined WINVER in your code. Do that and
the problem should go away.

Regards,
Manoj

— priya priya
wrote:

---------------------------------

Hi,

Thanks for the information.

I wrote the follwoing code to check out…

#include “stdafx.h”
#include<iostream.h>

#define _WIN32_WINNT 0x0502

#include <windows.h>
#include <winuser.h>
#include <dbt.h> // for broadcast to explorer

HRESULT BroadcastVolumeDeviceChange(WPARAM
notification,WCHAR
DriveLetter);

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{

BroadcastVolumeDeviceChange(DBT_DEVICEREMOVECOMPLETE,L’E’);
return 1;
}

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;
}

The code is failing saying BroadcastSystemMessage
undeclared
identifier.This call is defined in winuser.h.I added
both winuser.h
and windows.h.it is throwing the same error.Can you
please explain
what could be the reason?

Regards,
Priya

__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail</dbt.h></winuser.h></windows.h></iostream.h>