X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.Threading%2FOverlapped.cs;h=1a633dd00cd95adfbdbd4b921fc52c293c952f98;hb=c5a10f4d14a4ec1a28e3cd74c3d64392573393ee;hp=b5bb12d93183d12d8563b9669989ff267bbffe95;hpb=f99ce750ee781a2584e849a0264300fa4d99aaaa;p=mono.git diff --git a/mcs/class/corlib/System.Threading/Overlapped.cs b/mcs/class/corlib/System.Threading/Overlapped.cs index b5bb12d9318..1a633dd00cd 100644 --- a/mcs/class/corlib/System.Threading/Overlapped.cs +++ b/mcs/class/corlib/System.Threading/Overlapped.cs @@ -37,6 +37,9 @@ using System.Security.Permissions; namespace System.Threading { +#if NET_2_0 + [ComVisible (true)] +#endif public class Overlapped { IAsyncResult ares; @@ -44,10 +47,17 @@ namespace System.Threading int offsetH; int evt; +#if NET_2_0 + IntPtr evt_ptr; +#endif + public Overlapped () { } +#if NET_2_0 + [Obsolete ("Not 64bit compatible. Please use the constructor that takes IntPtr for the event handle", false)] +#endif public Overlapped(int offsetLo, int offsetHi, int hEvent, IAsyncResult ar) { offsetL = offsetLo; @@ -56,6 +66,17 @@ namespace System.Threading ares = ar; } +#if NET_2_0 + public Overlapped (int offsetLo, int offsetHi, IntPtr hEvent, + IAsyncResult ar) + { + offsetL = offsetLo; + offsetH = offsetHi; + evt_ptr = hEvent; + ares = ar; + } +#endif + [CLSCompliant(false)] unsafe public static void Free (NativeOverlapped *nativeOverlappedPtr) { @@ -74,22 +95,50 @@ namespace System.Threading Overlapped result = new Overlapped (); result.offsetL = nativeOverlappedPtr->OffsetLow; result.offsetH = nativeOverlappedPtr->OffsetHigh; +#if NET_2_0 + result.evt = (int)nativeOverlappedPtr->EventHandle; +#else result.evt = nativeOverlappedPtr->EventHandle; +#endif return result; } [CLSCompliant(false)] +#if NET_2_0 + [Obsolete ("Use Pack(iocb, userData) instead", false)] +#endif [MonoTODO ("Security - we need to propagate the call stack")] unsafe public NativeOverlapped *Pack (IOCompletionCallback iocb) { NativeOverlapped *result = (NativeOverlapped *) Marshal.AllocHGlobal (Marshal.SizeOf (typeof (NativeOverlapped))); result->OffsetLow = offsetL; result->OffsetHigh = offsetH; +#if NET_2_0 + result->EventHandle = (IntPtr)evt; +#else result->EventHandle = evt; +#endif return result; } + +#if NET_2_0 + [CLSCompliant (false)] + [ComVisible (false)] + [MonoTODO ("handle userData")] + unsafe public NativeOverlapped *Pack (IOCompletionCallback iocb, object userData) + { + NativeOverlapped *result = (NativeOverlapped *) Marshal.AllocHGlobal (Marshal.SizeOf(typeof(NativeOverlapped))); + result->OffsetLow = offsetL; + result->OffsetHigh = offsetH; + result->EventHandle = evt_ptr; + return(result); + } +#endif [CLSCompliant(false)] +#if NET_2_0 + [Obsolete ("Use UnsafePack(iocb, userData) instead", false)] +#endif [SecurityPermission (SecurityAction.Demand, ControlEvidence=true, ControlPolicy=true)] unsafe public NativeOverlapped *UnsafePack (IOCompletionCallback iocb) { @@ -97,16 +146,41 @@ namespace System.Threading return Pack (iocb); } +#if NET_2_0 + [ComVisible (false)] + [CLSCompliant (false)] + unsafe public NativeOverlapped *UnsafePack (IOCompletionCallback iocb, object userData) + { + return Pack (iocb, userData); + } +#endif + public IAsyncResult AsyncResult { get { return ares; } set { ares = value; } } +#if NET_2_0 + [Obsolete ("Not 64bit compatible. Use EventHandleIntPtr instead.", false)] +#endif public int EventHandle { get { return evt; } set { evt = value; } } +#if NET_2_0 + [ComVisible (false)] + public IntPtr EventHandleIntPtr + { + get{ + return(evt_ptr); + } + set{ + evt_ptr = value; + } + } +#endif + public int OffsetHigh { get { return offsetH; } set { offsetH = value; }