RawDisk

Direct access to disks and protected files from user-mode applications in Windows

RawDisk.ReadSectors method

Filter:

Pascal    C++ (DLL/Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET   

RawDisk     See also    

Overview

Reads sectors with data from the disk

Declaration

[Pascal]
    class procedure ReadSectors( DiskHandle : THandle; StartingSector : Int64; SectorCount : DWORD; Buffer : PByte);

[C++ (DLL/Lib)]
    static void ReadSectors( HANDLE DiskHandle, __int64 StartingSector, unsigned long SectorCount, void *Buffer);

[C++ (VCL)]
    static void __fastcall ReadSectors( THandle DiskHandle, __int64 StartingSector, unsigned long SectorCount, unsigned char *Buffer);

[C++ (.NET)]
    static void ReadSectors( IntPtr DiskHandle, Int64 StartingSector, UInt32 SectorCount, IntPtr Buffer);

[C#]
    static void ReadSectors( IntPtr DiskHandle, Int64 StartingSector, UInt32 SectorCount, IntPtr Buffer);

[VB.NET]
    Shared Sub ReadSectors( ByVal DiskHandle As IntPtr, ByVal StartingSector As Int64, ByVal SectorCount As UInt32, ByVal Buffer As IntPtr)

Parameters

  • DiskHandle - the handle of the opened disk device
  • StartingSector - initial sector to read the data from
  • SectorCount - the number of sectors to read
  • Buffer - buffer for the data to be read

Description

Use this method to read data from sectors of the disk. The handle to the device must have been obtained using Open() or OpenEx() methods.

StartingSector and ending sector (which is equal to StartingSector + SectorCount) must not exceed the number of sectors on the disk which can be obtained using GetSectorCount() method. The size of Buffer must correspond to SectorCount multiplied by the size of single sector which can be obtained using GetSectorSize() method.

If the method fails for whatever reason (eg. parameters are invalid), an exception with Windows-defined error code is thrown.

See also

GetSectorCount     GetSectorSize     Open     OpenEx    

Back to top