Mount Manager

Hi all,
How can I get all the mount points and symbolic links of a volume given
a symbolic name of the volume(like “\Device\HarddiskVolume”). I need this in
a user mode application. Is there any way to do that. I tried using the
MOUNTMGR IOCTLs. I have passed the unique id of the volume as the parameter
to MOUNTMGR_QUERY_POINTS IOCTL. But it is giving an error “The parameter is
incorrect.”. I tried passing symbolic names such as
“\Device\HarddiskVolume1” to the same IOCTL. Again error says “The parameter
is incorrect.” Can anyone indicate where I am erring

With regards,
Nagesh Bhattu

An reference to example code which demonstrates how MOUNTMGR IOCTLS work
will greatly help me to find where I am wrong.
Thanks in advance,
Nagesh Bhattu

“Nagesh Bhattu” wrote in message
news:xxxxx@ntdev…
>
> Hi all,
> How can I get all the mount points and symbolic links of a volume
given
> a symbolic name of the volume(like “\Device\HarddiskVolume”). I need this
in
> a user mode application. Is there any way to do that. I tried using the
> MOUNTMGR IOCTLs. I have passed the unique id of the volume as the
parameter
> to MOUNTMGR_QUERY_POINTS IOCTL. But it is giving an error “The parameter
is
> incorrect.”. I tried passing symbolic names such as
> “\Device\HarddiskVolume1” to the same IOCTL. Again error says “The
parameter
> is incorrect.” Can anyone indicate where I am erring
>
> With regards,
> Nagesh Bhattu
>
>
>
>

To what device are you issuing this IOCTL. This ioctl needs to be directed
at MountPointManager device. Fill up MOUNTMGR_MOUNT_POINT structure. MPM
maintains record of Device Name, Unique Id and Symbolic Link Names. Given
any information it can return you all the related info.

thanks

-----Original Message-----
From: Nagesh Bhattu [mailto:xxxxx@persistent.co.in]
Sent: Saturday, October 05, 2002 9:33 AM
To: NT Developers Interest List
Subject: [ntdev] Mount Manager

Hi all,
How can I get all the mount points and symbolic links of a volume given
a symbolic name of the volume(like “\Device\HarddiskVolume”). I need this in
a user mode application. Is there any way to do that. I tried using the
MOUNTMGR IOCTLs. I have passed the unique id of the volume as the parameter
to MOUNTMGR_QUERY_POINTS IOCTL. But it is giving an error “The parameter is
incorrect.”. I tried passing symbolic names such as
“\Device\HarddiskVolume1” to the same IOCTL. Again error says “The parameter
is incorrect.” Can anyone indicate where I am erring

With regards,
Nagesh Bhattu


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

RE: [ntdev] Mount ManagerHi ,
The mountmgr device name used is “\\.\MountPointManager”. But I am doubting whether I can do this in a user mode application or not. I am filling in the structures appropriately. The sample code is as shown below

char buf[BUFSIZE]
hMntManager = CreateFile(“\\.\MountPointManager”, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
hVolume = FindFirstVolume(buf, BUFSIZE);
// iterate over all the volumes getting their GUIDs
do{
// buf contains the volume name in GUID form and mBuf is the input parameter for the IOCTL_MOUNTMGR_QUERY_POINTS
char mBuf[BUFSIZE];
MOUNTMGR_MOUNT_POINT *mPoint = (PMOUNTMGR_MOUNT_POINT) mBuf;
char *ptr = mBuf + sizeof(MOUNTMGR_MOUNT_POINT);
int length = strlen(buf);
// copy the guid volume name right after the structure
// MOUNTMGR_MOUNT_POINT in the mBuf;
memcpy(ptr, buf, length);
// Fill in the Unique ID fields of Mount Point
mPoint->SymbolicLinkNameOffset = 0;
mPoint->SymbolicLinkNameLength = 0;
mPoint->UniqueIdOffset = sizeof(MOUNTMGR_MOUNT_POINT);
mPoint->UniqueIdLength = length;
if( DeviceIoControl( hMntManager,
IOCTL_MOUNTMGR_QUERY_POINTS,
mBuf, length + sizeof(MOUNTMGR_MOUNT_POINT),
output, BUFSIZE,
&bytesWritten, NULL ) )
{
cout << “Yeah” << endl;
}
else
cout << "ERROR " <}while(bFlag = FindNextVolume(hVolume, buf, BUFSIZE));

It’s always printing ERROR and when I am finding the cause of this using GetLastError(), it says Parameter Incorrect.

Thanks,
Nagesh Bhattu
“Pashupati Kumar” wrote in message news:xxxxx@ntdev…
To what device are you issuing this IOCTL. This ioctl needs to be directed at MountPointManager device. Fill up MOUNTMGR_MOUNT_POINT structure. MPM maintains record of Device Name, Unique Id and Symbolic Link Names. Given any information it can return you all the related info.

thanks

-----Original Message-----
From: Nagesh Bhattu [mailto:xxxxx@persistent.co.in]
Sent: Saturday, October 05, 2002 9:33 AM
To: NT Developers Interest List
Subject: [ntdev] Mount Manager

Hi all,
How can I get all the mount points and symbolic links of a volume given
a symbolic name of the volume(like “\Device\HarddiskVolume”). I need this in
a user mode application. Is there any way to do that. I tried using the
MOUNTMGR IOCTLs. I have passed the unique id of the volume as the parameter
to MOUNTMGR_QUERY_POINTS IOCTL. But it is giving an error “The parameter is
incorrect.”. I tried passing symbolic names such as
“\Device\HarddiskVolume1” to the same IOCTL. Again error says “The parameter
is incorrect.” Can anyone indicate where I am erring

With regards,
Nagesh Bhattu


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

Hi
Did you hMntManager return correct handle? You can do it user mode
application.

Vysyaraju Dali Raju


Vysyaraju Daliraju, / Systems Software Engineer
SBS Technologies, 8371C Central Ave. / Newark, CA 94560
Phone: 510-742-2570 / Fax: -2501 / EMail: xxxxx@sbs.com
mailto:xxxxx >

-----Original Message-----
From: Nagesh Bhattu [mailto:xxxxx@persistent.co.in]
Sent: Monday, October 07, 2002 9:44 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Mount Manager

Hi ,
The mountmgr device name used is “\\.\MountPointManager”. But I am
doubting whether I can do this in a user mode application or not. I am
filling in the structures appropriately. The sample code is as shown below

char buf[BUFSIZE]
hMntManager = CreateFile(“\\.\MountPointManager”, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
hVolume = FindFirstVolume(buf, BUFSIZE);
// iterate over all the volumes getting their GUIDs
do{
// buf contains the volume name in GUID form and mBuf is the input parameter
for the IOCTL_MOUNTMGR_QUERY_POINTS
char mBuf[BUFSIZE];
MOUNTMGR_MOUNT_POINT *mPoint = (PMOUNTMGR_MOUNT_POINT) mBuf;
char *ptr = mBuf + sizeof(MOUNTMGR_MOUNT_POINT);
int length = strlen(buf);
// copy the guid volume name right after the structure
// MOUNTMGR_MOUNT_POINT in the mBuf;
memcpy(ptr, buf, length);
// Fill in the Unique ID fields of Mount Point
mPoint->SymbolicLinkNameOffset = 0;
mPoint->SymbolicLinkNameLength = 0;
mPoint->UniqueIdOffset = sizeof(MOUNTMGR_MOUNT_POINT);
mPoint->UniqueIdLength = length;
if( DeviceIoControl( hMntManager,
IOCTL_MOUNTMGR_QUERY_POINTS,
mBuf, length + sizeof(MOUNTMGR_MOUNT_POINT),
output, BUFSIZE,
&bytesWritten, NULL ) )
{
cout << “Yeah” << endl;
}
else
cout << “ERROR " <}while(bFlag = FindNextVolume(hVolume, buf, BUFSIZE));

It’s always printing ERROR and when I am finding the cause of this using
GetLastError(), it says Parameter Incorrect.

Thanks,
Nagesh Bhattu
“Pashupati Kumar” > wrote in
message news:xxxxx@ntdev news:xxxxx
To what device are you issuing this IOCTL. This ioctl needs to be directed
at MountPointManager device. Fill up MOUNTMGR_MOUNT_POINT structure. MPM
maintains record of Device Name, Unique Id and Symbolic Link Names. Given
any information it can return you all the related info.
thanks

-----Original Message-----
From: Nagesh Bhattu [mailto:xxxxx@persistent.co.in
mailto:xxxxx]
Sent: Saturday, October 05, 2002 9:33 AM
To: NT Developers Interest List
Subject: [ntdev] Mount Manager

Hi all,
How can I get all the mount points and symbolic links of a volume given
a symbolic name of the volume(like “\Device\HarddiskVolume”). I need this in

a user mode application. Is there any way to do that. I tried using the
MOUNTMGR IOCTLs. I have passed the unique id of the volume as the parameter
to MOUNTMGR_QUERY_POINTS IOCTL. But it is giving an error “The parameter is
incorrect.”. I tried passing symbolic names such as
”\Device\HarddiskVolume1" to the same IOCTL. Again error says “The parameter

is incorrect.” Can anyone indicate where I am erring
With regards,
Nagesh Bhattu


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

You are currently subscribed to ntdev as: xxxxx@sbs.com
To unsubscribe send a blank email to %%email.unsub%%</mailto:xxxxx></news:xxxxx></mailto:xxxxx>

RE: [ntdev] Mount ManagerThere is an NT Insider article on the MountManager. There is also sample code on the osr web site.

–Mark Cariddi
www.osr.com
“Nagesh Bhattu” wrote in message news:xxxxx@ntdev…
Hi ,
The mountmgr device name used is “\\.\MountPointManager”. But I am doubting whether I can do this in a user mode application or not. I am filling in the structures appropriately. The sample code is as shown below

char buf[BUFSIZE]
hMntManager = CreateFile(“\\.\MountPointManager”, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
hVolume = FindFirstVolume(buf, BUFSIZE);
// iterate over all the volumes getting their GUIDs
do{
// buf contains the volume name in GUID form and mBuf is the input parameter for the IOCTL_MOUNTMGR_QUERY_POINTS
char mBuf[BUFSIZE];
MOUNTMGR_MOUNT_POINT *mPoint = (PMOUNTMGR_MOUNT_POINT) mBuf;
char *ptr = mBuf + sizeof(MOUNTMGR_MOUNT_POINT);
int length = strlen(buf);
// copy the guid volume name right after the structure
// MOUNTMGR_MOUNT_POINT in the mBuf;
memcpy(ptr, buf, length);
// Fill in the Unique ID fields of Mount Point
mPoint->SymbolicLinkNameOffset = 0;
mPoint->SymbolicLinkNameLength = 0;
mPoint->UniqueIdOffset = sizeof(MOUNTMGR_MOUNT_POINT);
mPoint->UniqueIdLength = length;
if( DeviceIoControl( hMntManager,
IOCTL_MOUNTMGR_QUERY_POINTS,
mBuf, length + sizeof(MOUNTMGR_MOUNT_POINT),
output, BUFSIZE,
&bytesWritten, NULL ) )
{
cout << “Yeah” << endl;
}
else
cout << "ERROR " < }while(bFlag = FindNextVolume(hVolume, buf, BUFSIZE));

It’s always printing ERROR and when I am finding the cause of this using GetLastError(), it says Parameter Incorrect.

Thanks,
Nagesh Bhattu
“Pashupati Kumar” wrote in message news:xxxxx@ntdev…
To what device are you issuing this IOCTL. This ioctl needs to be directed at MountPointManager device. Fill up MOUNTMGR_MOUNT_POINT structure. MPM maintains record of Device Name, Unique Id and Symbolic Link Names. Given any information it can return you all the related info.

thanks

-----Original Message-----
From: Nagesh Bhattu [mailto:xxxxx@persistent.co.in]
Sent: Saturday, October 05, 2002 9:33 AM
To: NT Developers Interest List
Subject: [ntdev] Mount Manager

Hi all,
How can I get all the mount points and symbolic links of a volume given
a symbolic name of the volume(like “\Device\HarddiskVolume”). I need this in
a user mode application. Is there any way to do that. I tried using the
MOUNTMGR IOCTLs. I have passed the unique id of the volume as the parameter
to MOUNTMGR_QUERY_POINTS IOCTL. But it is giving an error “The parameter is
incorrect.”. I tried passing symbolic names such as
“\Device\HarddiskVolume1” to the same IOCTL. Again error says “The parameter
is incorrect.” Can anyone indicate where I am erring

With regards,
Nagesh Bhattu


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

Nagesh,
1.Opening MountPointManager is perfect valid in user mode. This is a
symbolic link name created in ??\ directory, see it in winobj.
Just make sure you have valid handle after CreateFile operation.
2. here is some explanation for MOUNTMGR_MOUNT_POINT structures

DeviceNameLength
DeviceNameOffset
This corresponds to device name as created by volume driver.
\Device\HarddiskvolumeN

SymbolicLinkNameLength
SymbolicLinkNameOffset
This corresponds to all symbolic link name used for volume. eg. volume
guid, drive letters and mount point

UniqueIdLength
UniqueIdOffset
This is again given by volume driver

  1. Volume Guid that you get from FindFirstVolume and FindNextVolume, can’t
    be passed to SymbolicLinkName as it is.
    What you get is this \?\ <file:> Volume{GUID}\
    You need to pass this ??\Volume{GUID}

    hope this helps

    -----Original Message-----
    From: Mark Cariddi [mailto:xxxxx@osr.com]
    Sent: Tuesday, October 08, 2002 9:12 AM
    To: NT Developers Interest List
    Subject: [ntdev] Re: Mount Manager

    There is an NT Insider article on the MountManager. There is also sample
    code on the osr web site.

    –Mark Cariddi
    www.osr.com

    “Nagesh Bhattu” < xxxxx@persistent.co.in
    mailto:xxxxx > wrote in message news:xxxxx@ntdev
    news:xxxxx
    Hi ,
    The mountmgr device name used is “\\.\MountPointManager”. But I am
    doubting whether I can do this in a user mode application or not. I am
    filling in the structures appropriately. The sample code is as shown below

    char buf[BUFSIZE]
    hMntManager = CreateFile(“\\.\MountPointManager”, GENERIC_READ,
    FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
    hVolume = FindFirstVolume(buf, BUFSIZE);
    // iterate over all the volumes getting their GUIDs
    do{
    // buf contains the volume name in GUID form and mBuf is the input parameter
    for the IOCTL_MOUNTMGR_QUERY_POINTS
    char mBuf[BUFSIZE];
    MOUNTMGR_MOUNT_POINT *mPoint = (PMOUNTMGR_MOUNT_POINT) mBuf;
    char *ptr = mBuf + sizeof(MOUNTMGR_MOUNT_POINT);
    int length = strlen(buf);
    // copy the guid volume name right after the structure
    // MOUNTMGR_MOUNT_POINT in the mBuf;
    memcpy(ptr, buf, length);
    // Fill in the Unique ID fields of Mount Point
    mPoint->SymbolicLinkNameOffset = 0;
    mPoint->SymbolicLinkNameLength = 0;
    mPoint->UniqueIdOffset = sizeof(MOUNTMGR_MOUNT_POINT);
    mPoint->UniqueIdLength = length;
    if( DeviceIoControl( hMntManager,
    IOCTL_MOUNTMGR_QUERY_POINTS,
    mBuf, length + sizeof(MOUNTMGR_MOUNT_POINT),
    output, BUFSIZE,
    &bytesWritten, NULL ) )
    {
    cout << “Yeah” << endl;
    }
    else
    cout << “ERROR " <}while(bFlag = FindNextVolume(hVolume, buf, BUFSIZE));

    It’s always printing ERROR and when I am finding the cause of this using
    GetLastError(), it says Parameter Incorrect.

    Thanks,
    Nagesh Bhattu

    “Pashupati Kumar” < xxxxx@legato.com mailto:xxxxx > wrote in
    message news:xxxxx@ntdev news:xxxxx

    To what device are you issuing this IOCTL. This ioctl needs to be directed
    at MountPointManager device. Fill up MOUNTMGR_MOUNT_POINT structure. MPM
    maintains record of Device Name, Unique Id and Symbolic Link Names. Given
    any information it can return you all the related info.

    thanks

    -----Original Message-----
    From: Nagesh Bhattu [mailto:xxxxx@persistent.co.in
    mailto:xxxxx]
    Sent: Saturday, October 05, 2002 9:33 AM
    To: NT Developers Interest List
    Subject: [ntdev] Mount Manager

    Hi all,
    How can I get all the mount points and symbolic links of a volume given
    a symbolic name of the volume(like “\Device\HarddiskVolume”). I need this in

    a user mode application. Is there any way to do that. I tried using the
    MOUNTMGR IOCTLs. I have passed the unique id of the volume as the parameter
    to MOUNTMGR_QUERY_POINTS IOCTL. But it is giving an error “The parameter is
    incorrect.”. I tried passing symbolic names such as
    ”\Device\HarddiskVolume1" to the same IOCTL. Again error says “The parameter

    is incorrect.” Can anyone indicate where I am erring

    With regards,
    Nagesh Bhattu


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


    You are currently subscribed to ntdev as: xxxxx@Legato.COM
    To unsubscribe send a blank email to %%email.unsub%%</mailto:xxxxx></news:xxxxx></mailto:xxxxx></news:xxxxx></mailto:xxxxx></file:>