B
bjtsoft
Unregistered / Unconfirmed
GUEST, unregistred user!
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;
需要JEDI的Win32支持库才能编译!可是我装了这个库不知道用那个库文件呀,请高手指教
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;
需要JEDI的Win32支持库才能编译!可是我装了这个库不知道用那个库文件呀,请高手指教