怎么由逻辑盘符获得所在的物理设备符?
比如由逻辑盘符“c:”获得物理设备符“PhysicalDrive0”

解决方案 »

  1.   

    我在FAQ中有提到过类似的问题的!详细的查看FAQ中的内容function GetVolumeInfo(DriverLetter: Char): TDiskExtent;
    var
      hVolume: THandle;
      DiskExtents: PVolumeDiskExtents;
      dwOutBytes: Cardinal;
    begin
      with Result do
        begin
          DiskNumber := 0;
          StartingOffset.QuadPart := 0;
          ExtentLength.QuadPart := 0;
        end;
      hVolume := CreateFile(PChar('\\.\'+DriverLetter+':'), GENERIC_READ or GENERIC_WRITE,
                             FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, 0, 0);
      if hVolume < 1 then Exit;
      DiskExtents := AllocMem(Max_Path);
      if DeviceIoControl(hVolume,
                    IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,
                    nil, 0,
                    DiskExtents, Max_Path,
                    dwOutBytes, nil) then
         begin
           if DiskExtents^.NumberOfDiskExtents > 0 then
              Result := DiskExtents^.Extents[0];
         end;
      FreeMem(DiskExtents);
      CloseHandle(hVolume);
    end;http://lysoft.7u7.net
      

  2.   

    http://search.csdn.net/Expert/topic/1249/1249469.xml?temp=.3637659
    中有
      

  3.   

    http://search.csdn.net/Expert/topic/1249/1249469.xml?temp=.3637659