Bug 8449 - Definition of System.Threading.NativeOverlapped structure does not correspond to Win32 OVERLAPPED
Summary: Definition of System.Threading.NativeOverlapped structure does not correspond...
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-11-15 21:59 UTC by Alex
Modified: 2012-12-11 08:38 UTC (History)
3 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Alex 2012-11-15 21:59:01 UTC

NativeOverlapped should represent a Win32 OVERLAPPED structure. In Mono it is declared as follows

public struct NativeOverlapped {
	public IntPtr EventHandle;
	public IntPtr InternalHigh;
	public IntPtr InternalLow;
	public int OffsetHigh;
	public int OffsetLow;
	// additional fields

however Win32 OVERLAPPED is

typedef struct _OVERLAPPED {
  ULONG_PTR Internal;
  ULONG_PTR InternalHigh;
  union {
    struct {
      DWORD Offset;
      DWORD OffsetHigh;
    PVOID  Pointer;
  HANDLE    hEvent;

therefore definition of NativeOverlapped should be something like

public struct NativeOverlapped
    public IntPtr  InternalLow; 
    public IntPtr  InternalHigh;
    public int     OffsetLow; 
    public int     OffsetHigh;
    public IntPtr  EventHandle;
    // additional fields

Win32 overlapped IO depends on NativeOverlapped, particularly the SerialPort class is affected - it is not possible to run concurrent reads and writes on serial ports. Please correct the order of fields of NativeOverlapped.
Comment 1 Jonathan Pryor 2012-11-15 23:38:07 UTC
For reference, the WinAPI documentation for OVERLAPPED:

Comment 2 Marek Safar 2012-11-20 07:04:59 UTC
Fixed in master

Note You need to log in before you can comment on or make changes to this bug.