RawDisk

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

RawDisk.WriteSectors method

Filter:

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

RawDisk     See also    

Overview

Writes sectors with data to the disk

Declaration

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

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

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

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

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

[VB.NET]
    Shared Sub WriteSectors( 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 put the data to
  • SectorCount - the number of sectors to write
  • Buffer - reference to the data to be written

Description

Use this method to write data to 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