Desktop Functions: Smart Device Functions:
|
Search Results for "NativeOverlapped" in [All]iphlpapi1: EnableRouter
static extern int EnableRouter(IntPtr pHandle, ref System.Threading.NativeOverlapped pOverlapped);
static extern int UnenableRouter(ref System.Threading.NativeOverlapped pOverlapped, IntPtr lpdwEnableCount); Structures3: OVERLAPPED
public struct NativeOverlapped 4: OVERLAPPED This structure is already defined as System.Threading.NativeOverlapped in the .NET Framework. It is not supported for the .NET Compact Framework. kernel32
[In] ref System.Threading.NativeOverlapped lpOverlapped);
[In] ref NativeOverlapped lpOverlapped);
[In] ref System.Threading.NativeOverlapped Overlapped
<[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(); 8: LockFile
[In] ref System.Threading.NativeOverlapped lpOverlapped); 9: LockFileEx
[In] ref System.Threading.NativeOverlapped lpOverlapped); 10: NativeOverlapped
[In] ref System.Threading.NativeOverlapped lpOverlapped); 12: ReadFile
[In] ref System.Threading.NativeOverlapped lpOverlapped);
IntPtr lpReserved, NativeOverlapped* lpOverlapped); 13: ReadFileEx
uint nNumberOfBytesToRead, [In] ref System.Threading.NativeOverlapped lpOverlapped, 14: ReadFileScatter
[In] ref System.Threading.NativeOverlapped lpOverlapped); 15: UnlockFile
[In] ref System.Threading.NativeOverlapped lpOverlapped); 16: WriteFile
[In] ref System.Threading.NativeOverlapped lpOverlapped);
IntPtr lpReserved, System.Threading.NativeOverlapped* lpOverlapped); 17: 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) 18: WriteFileGather
[In] ref System.Threading.NativeOverlapped lpOverlapped);
IntPtr lpReserved, System.Threading.NativeOverlapped* lpOverlapped); |