How to Get Mount Point from Device Name

device driver

    Sponsored Links

    Next

  • 1. SMARTCARD_EXTENSION & OsData
    Hi, The SMARTCARD_EXTENSION structure has a member OsData->DeviceObject. What purpose does DeviceObject server here? Why woul'd smclib need the drivers DeviceObject.
  • 2. KMDF driver for XP
    Hello All, I am using Windows XP SP1. I have downloaded the WDK 6001 with KMDF version 1.7. when I tried to load the sample driver "echo" or "toaster", the following error message is generated "The specified resource name cannot be found in the image file" Release notes says that, the sample drivers provided with KMDF 1.7 can run on Windows Server 2003 / Vista. Even a simple driver with DriverEntry with only KdPrint() on KMDF with CoInstaller of 1.7, same error message is coming. Please let me know how to solve this problem. Also, whether can I use this WDK / KMDF version for XP driver development? -Kans.
  • 3. Authenticode driver signing on Windows 2003
    Hi, I 'm using the signtool in Win2003 R2 DDK to sign a network driver for Win2003 with authenticode using a valid VerigSign class 3 certificate. The sys file and CAT file have been embedded a vaild signature in "Trusted root Certification Authory" and "Trusted Published" store. When I install the driver, it show a "unsigned driver" warning, and appear as "Not digital signed" in Device Manager. Is there any additional requirement for the certificate or driver to use authenticode driver signing on Windows 2003? Thanks
  • 4. Question regarding COM ports
    I'm trying to use a call to: l = ComDBGetCurrentPortUsage( HComDB, bufBits, 256, CDB_REPORT_BITS, pMaxPortsReported ); to determine if a USB serial port device is plugged in. Before plugging in the device, the device manager reports that I have 2 COM ports and 2 printer ports. After plugging in the device it reports 3 COM ports and 2 printer ports. However, before plugging in the device, a call to ComDBGetCurrentPortUsage fills in the bit array with 05 00 00... and after the call it still returns 05 00 00... (for COM 1 and COM 3) How can I determine if the USB COM device has been plugged in and if it has, what number has been assigned to it? It returns these values even if I powered up with the device unplugged. The call to ComDBGetCurrentPortUsage is in a dll written in 'C++'. The call to the dll is from a routine written in Visual Basic. Thanks for your help -- Regards, Dean

How to Get Mount Point from Device Name

Postby TWljaGVsbGU » Fri, 18 Feb 2005 00:09:01 GMT

I am trying to find the mount point of a partition based on the device name 
obtained from Microsoft Cluster. As far as I know, if a drive letter is not 
assigned to the partition, the device name returned by  Microsoft Cluster is 
formatted as "Disk##Partition##". To get the mount point, one way (I am not 
sure if it is safe) I have tried is:

------------------------------------------------------------------------------------------
1. Parse the device name to a format like 
"\\?\GLOBALROOT\device\Harddisk##\Partition##\".

2. GetVolumeNameForVolumeMountPoint() - Using the disk and partition number. 
I can use this function to get the unique volume name i.e. pass 
\\?\GLOBALROOT\device\Harddisk3\Partition1\  
and get back something like 
\\?\Volume{1938fbd3-7961-11d9-b611-0050dabfbe25}\

3. GetVolumePathNamesForVolumeName() - Using the unique volume name. I can 
use this function to get the path name i.e. pass 
\\?\Volume{1938fbd3-7961-11d9-b611-0050dabfbe25}\ and get back the mount 
point, eg. Z:\mnt\
--------------------------------------------------------------------------------------------

My concern is about the first step, that is, my code has to rely on the 
format of the device name returned by Microsoft Cluster. 

Is "Disk##Partition##" the only format of the device name known to Microsoft 
Cluster, provided a drive letter is not assigned??? What if the disk is a 
remote one?

If the device name is not a good option, are there other ways of getting the 
partition's mount point based on the information known to the microsoft 
cluster? I have thought about the volume serial number. But I guess the 
serial number is only unique in one machine. In a cluster environment, there 
might be two partitions formatted by different hosts and have the same serial 
number.

Please help!


Re: How to Get Mount Point from Device Name

Postby Robert Marquardt » Fri, 18 Feb 2005 02:23:26 GMT

From an earlier message here:

Subject:
RE: How to match between physical usb device and its drive letter?
From:
"Kiran" < XXXX@XXXXX.COM >
Date:
Wed, 20 Oct 2004 22:01:02 -0700
Newsgroups:
microsoft.public.development.device.drivers

Hi,

There is no simple/direct way of obtaining the drive letter.

The following code can be used to get the drive letter
But you have to modify them here and there to meet you need.

Kiran


struct tagDrives
{
WCHAR letter;
WCHAR volume[BUFFER_SIZE];
} g_drives[26];

//
WCHAR GetUSBDrive()
{
LPTSTR lpDevID;
WCHAR cDrive;
DWORD dwSize = BUFFER_SIZE;

// Get all removable disks on user laptop.
if(!GetAllRemovableDisks())
{
WRITELOG("Error - GetAllRemovableDisks failed\n");
return 0;
}

// Alocate memory to device ID
lpDevID = (LPTSTR)AllocMem(BUFFER_SIZE);

// Get device ID corresponding to USBFM from registry.
if(!GetRegValue(lpDevID, DEVICE_ID, dwSize))
{
WRITELOG("Error - Registry - USBFMDevID failed\n");
FreeMem(lpDevID);
return 0;
}

// Get drive corresponding to the registry entry.
cDrive = GetSpecificDrive(lpDevID);

FreeMem(lpDevID);

// return the drive letter.
return cDrive;
}

/******************************************************************************
* GetAllRemovableDisks - This function retrieves volume information for all
removable disks
*
* In: None
*
* Out: TRUE - Success
* FALSE - Failure
*
*******************************************************************************/

BOOL GetAllRemovableDisks()
{
WCHAR caDrive[4];
WCHAR volume[BUFFER_SIZE];
int nLoopIndex;
DWORD dwDriveMask;

caDrive[0] = 'A';
caDrive[1] = ':';
caDrive[2] = '\\';
caDrive[3] = 0;

g_count = 0;

// Get all drives in the system.
dwDriveMask = GetLogicalDrives();

if(dwDriveMask == 0)
{
WRITELOG("Error - GetLogicalDrives failed\n");
return FALSE;
}

// Loop for all drives (MAX_DRIVES = 26)

for(nLoopIndex = 0; nLoopIndex< MAX_DRIVES; nLoopIndex++)
{
// if a drive is present,
if(dwDriveMask & 1)
{
caDrive[0] = 'A' + nLoopIndex;

// If a drive is removable
if(GetDriveType(caDrive) == DRIVE_REMOVABLE)
{
//Get its volume info and store it in the global variable.
if(GetVolumeNameForVolumeMountPoint(caDrive, volume, BUFFER_SIZE))
{
g_drives[g_count].letter = caDrive[0];
wcscpy(g_drives[g_count].volume, volume);
g_count ++;
}

}
}
dwDriveMask >>= 1;
}

// success if atleast one removable drive is found.
if(g_count == 0)
{
return FALSE;
}
else
{
return TRUE;
}
}

/******************************************************************************
* GetSpecificDrive - This function returns the drive corresponding to the
given device ID
*
* In : lpDevID - Device ID
*
* Return: Drive letter corresponding to the given device ID.
*
*******************************************************************************/

WCHAR GetSpecificDrive(
LPTSTR lpDevID)
{
HDEVINFO hDevInfo;
GUID guid;
BYTE buffer[BUFFER_SIZE];
DWORD dwRequiredSize ;
WCHAR buf[BUFFER_SIZE];
DEVINST devInstParent;
DWORD dwIndex;
WCHAR volume[BUFFER_SIZE];
int nLength,nLoopIndex;

SP_DEVICE_INTERFACE_DATA devInterfaceData;
SP_DEVINFO_DATA d

Similar Threads:

1.Getting the File Object and Device Object if Device Name is not kn

Hi All,
I am trying to get the File Object and Device Object for my PCI driver so 
that i can use it in IOCTL. The problem is that I don't have the device name 
available and i went through the registry and the device name is missing for 
the card. Is there a way to find out the device name or get the handle 
without the device name.
I will appreciate any help in this regard.
Thanks
Shankar

2.Getting File Object and Device Object without Device Name

Hi All,
I am trying to access a PCI driver so that I can send IOCTL commands to it. 
I donot have the Device name for it and the registry also does not have it. 
Is there a way to either get the device name or to get hold of the File 
Object and Device Object so that I can make IOCTL calls to the card.
Thanks
Shankar Agarwal

3.Request for help with resolving mount point name to a more friendly name.

Can you explain a little more about "netroots"?

Shawn

"Maxim S. Shatskih" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
> Redirectors do not use mount points.
> They use the "netroots", and the only access to them is via MPR.DLL.
> MountMgr cannot help with them.
>
>     Max
>
> "Shawn Anderson" < XXXX@XXXXX.COM > wrote in message
> news: XXXX@XXXXX.COM ...
> > Thanks for the suggestion, but that will not work with mount points
> that are
> > caused by the Network Redirector.  Anyone have any other ideas?
> >
> > "Maxim S. Shatskih" < XXXX@XXXXX.COM > wrote in message
> > news: XXXX@XXXXX.COM ...
> > > > I am currently trying to resolve what I think is a mount point
> > > >
> > > > Examples:
> > > >
> \Device\HarddiskDmVolumes\PhysicalDmVolumes\BlockVolume1\Projects
> > > > \Device\HarddiskVolume2
> > > >
> > > > Into something that I can display to a user
> > >
> > > FindFirstVolumeMountPoint/FindNextVolumeMountPoint in user mode.
> > >
> > >     Max
> > >
> > >
> >
> >
>
>


4.Mount Points

I wont to get the mount points associated with a Physical Disk Drive
Is there any IOCTL or API which will return me the corresponding mount points given a signature or Physical disk number.

5.match a mount point or driver letter to its USBSTOR registry entry

I am trying to figure out the following:

Given a volume or mount point or volume name retrieve its entry in 
HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR.

Seems like the solution should be a combination of the SetupAPI and Volume 
management functions.

Any ideas would be appreciated.

6. Getting a devices "name"

7. getting the driver names from a device stack

8. Device name & Name in NCP



Return to device driver

 

Who is online

Users browsing this forum: No registered users and 66 guest