Desktop Functions: Smart Device Functions:
|
Search Results for "NativeOverlapped" in [All]kernel32
[In] ref System.Threading.NativeOverlapped lpOverlapped);
<[In]()> ByRef lpOverlapped As NativeOverlapped) As Boolean
ByRef Overlapped As System.Threading.NativeOverlapped) As Boolean lpOverlapped - Main use in asynchronous deviceIoControl. NativeOverlapped is the managed version of the structure and use is the same. The difference between NativeOverlapped and Overlapped is managed Struct vs managed Class respectively. NativeOverlapped was more condusive for one-way device driver communication. Convert from Overlapped to NativeOverlapped to make the call, since NativeOverlapped is explicitly defined to mimic the unmanaged Overlapped structure. Pin your NativeOverlapped structure, DeviceIoControl is asynchronous and will write into the overlapped structure upon completion of IO requested. If you NativeOverlapped structure has been moved by garbage collection it will write into the wrong area causing heap corruption. If you want x64 proccessor support, you CANNOT use the System.Threading.NativeOverlapped structure as a ref parameter described above. The overlap structure must be allocated in global memory space. See the section "DeviceIoControl w/x64 support":
public bool DeviceIoControl( IntPtr hDevice, uint dwIoControlCode, ref long buffer, int bufferSize, ref NativeOverlapped pOverlapped)
mPtrOverlapped = Marshal.AllocHGlobal(Marshal.SizeOf(typeof (NativeOverlapped)));
// Find the structural starting positions in the NativeOverlapped structure.
mFieldOffset_InternalLow = Marshal.OffsetOf(typeof (NativeOverlapped), "InternalLow").ToInt32();
mFieldOffset_InternalHigh = Marshal.OffsetOf(typeof (NativeOverlapped), "InternalHigh").ToInt32();
mFieldOffset_OffsetLow = Marshal.OffsetOf(typeof (NativeOverlapped), "OffsetLow").ToInt32();
mFieldOffset_OffsetHigh = Marshal.OffsetOf(typeof (NativeOverlapped), "OffsetHigh").ToInt32();
mFieldOffset_EventHandle = Marshal.OffsetOf(typeof (NativeOverlapped), "EventHandle").ToInt32();
[In] ref System.Threading.NativeOverlapped lpOverlapped, Private Shared Function GetOverlappedResult(ByVal hFile As IntPtr, <[In]()> ByRef lpOverlapped As System.Threading.NativeOverlapped, ByRef lpNumberOfBytesTransferred As UInteger, ByVal bWait As Boolean) As Boolean
NativeOverlapped lpOverlapped = new NativeOverlapped(); 4: LockFileEx
[In] ref System.Threading.NativeOverlapped lpOverlapped);
[In] ref System.Threading.NativeOverlapped lpOverlapped); 7: ReadFile
IntPtr numBytesRead, NativeOverlapped* overlapped);
out uint lpNumberOfBytesRead, [In] ref System.Threading.NativeOverlapped lpOverlapped);
NativeOverlapped *lpOverlapped // should be fixed, if not IntPtr.Zero
ByRef Overlapped As System.Threading.NativeOverlapped) As SafeFileHandle 8: ReadFileEx
uint nNumberOfBytesToRead, [In] ref System.Threading.NativeOverlapped lpOverlapped,
[In] ref System.Threading.NativeOverlapped lpOverlapped); 10: UnlockFile
[In] ref System.Threading.NativeOverlapped lpOverlapped); 11: WriteFile
[In] ref System.Threading.NativeOverlapped lpOverlapped);
int numBytesToWrite, IntPtr numBytesWritten, NativeOverlapped* lpOverlapped);
[In] ref System.Threading.NativeOverlapped lpOverlapped);
[In] ref System.Threading.NativeOverlapped lpOverlapped);
"Overlapped" = If the file is asynchronous (overlapped), this is an threading.NativeOverlappedStructure specifying where to begin writing at. If the file is synchronous (not overlapped), this must be 0.
ByRef Overlapped As System.Threading.NativeOverlapped) As <MarshalAs(UnmanagedType.Bool)> Boolean If you are passing a System.Threading.NativeOverlapped struct in (for lpOverlapped) then there's no need to also call SetFilePointer or SetFilePointerEx. The offset in the OVERLAPPED structure trumps wherever the file position was previouly set to. 12: WriteFileEx
uint nNumberOfBytesToWrite, [In] ref System.Threading.NativeOverlapped lpOverlapped,
UInt32 dwNumberOfBytesTransfered, ref NativeOverlapped lpOverlapped);
uint nNumberOfBytesToWrite, [In] ref NativeOverlapped lpOverlapped,
NativeOverlapped ol = new NativeOverlapped();
private static void callback(UInt32 dwErrorCode, UInt32 dwNumberOfBytesTransfered, ref NativeOverlapped lpOverlapped) 13: WriteFileGather
[In] ref System.Threading.NativeOverlapped lpOverlapped);
IntPtr lpReserved, System.Threading.NativeOverlapped* lpOverlapped); Structures14: OVERLAPPED
public struct NativeOverlapped 15: OVERLAPPED This structure is already defined as System.Threading.NativeOverlapped in the .NET Framework. It is not supported for the .NET Compact Framework. iphlpapi16: EnableRouter
static extern int EnableRouter(IntPtr pHandle, ref System.Threading.NativeOverlapped pOverlapped); 17: UnenableRouter
static extern int UnenableRouter(ref System.Threading.NativeOverlapped pOverlapped, IntPtr lpdwEnableCount); |