Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "NativeOverlapped" in [All]

iphlpapi

.

static extern int EnableRouter(IntPtr pHandle, ref System.Threading.NativeOverlapped pOverlapped);

.

static extern int UnenableRouter(ref System.Threading.NativeOverlapped pOverlapped, IntPtr lpdwEnableCount);

Structures

.

public struct NativeOverlapped

.

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();

.

   [In] ref System.Threading.NativeOverlapped lpOverlapped);

.

   [In] ref System.Threading.NativeOverlapped lpOverlapped);

.

https://msdn.microsoft.com/en-us/library/system.threading.nativeoverlapped(v=vs.110).aspx

.

   [In] ref System.Threading.NativeOverlapped lpOverlapped);

.

   [In] ref System.Threading.NativeOverlapped lpOverlapped);

.

  IntPtr lpReserved, NativeOverlapped* lpOverlapped);

.

   uint nNumberOfBytesToRead, [In] ref System.Threading.NativeOverlapped lpOverlapped,

.

   [In] ref System.Threading.NativeOverlapped lpOverlapped);

.

   [In] ref System.Threading.NativeOverlapped lpOverlapped);

.

   [In] ref System.Threading.NativeOverlapped lpOverlapped);

.

  IntPtr lpReserved, System.Threading.NativeOverlapped* lpOverlapped);

.

   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)

.

   [In] ref System.Threading.NativeOverlapped lpOverlapped);

.

  IntPtr lpReserved, System.Threading.NativeOverlapped* lpOverlapped);


 
Access PInvoke.net directly from VS: