Desktop Functions: Smart Device Functions:
|
writefile (kernel32)
C# Signature:
[DllImport("kernel32.dll")] or
[DllImport("kernel32.dll", SetLastError=true)] VB Signature:
<DllImport("kernel32.dll", SetlastError:=True)> _ User-Defined Types:None. Notes:The documentation states that if using unbuffered IO, the memory must be "storage aligned" (aligned to the sector size of the storage device). Either this is not enforced, or managed allocations (specifically byte arrays) are automatically storage aligned because there seems to be no problem using it. Note that storage aligned and page aligned are not the same, and managed allocations are not in general page aligned (required for WriteFileScatter). In fact the buffer must be aligned to the granularity of the SCSI/IDE adapter's DMA alignment (PDEVICE_OBJECT->AlignmentRequirement). The MSDN documentation is written for the lamers and probably it seemed safe to restrict them using the sector size (which is >= 512 byte, while most modern SCSI cards use <=4 byte requirement). For more information on unbuffered IO in .NET see: http://arxiv.org/abs/cs.PF/0502012 Tips & Tricks:Please add some! Sample Code:
Public Sub Write(ByVal Packet As stArcnetPacket, ByVal DataLength As Int16) Alternative Managed API:System.IO.FileStream See AlsoReadFile, WriteFileGather, ReadFileScatter Please edit this page!Do you have...
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more). |
|