/// <summary> /// Writes the ConnectionInfo data to unmanaged memory. /// </summary> /// <returns>A pointer to the unmanaged memory block storing the ConnectionInfo data</returns> public IntPtr ToPtr() { IntPtr p = MarshalEx.AllocHLocal((uint)Marshal.SizeOf(typeof(ConnectionInfo))); MarshalEx.WriteInt32(p, 0, this.cbSize); MarshalEx.WriteInt32(p, 4, this.dwParams); MarshalEx.WriteInt32(p, 8, this.dwFlags); MarshalEx.WriteInt32(p, 12, this.dwPriority); MarshalEx.WriteBool(p, 16, this.bExclusive); MarshalEx.WriteBool(p, 20, this.bDisabled); MarshalEx.WriteByteArray(p, 24, this.guidDestNet.ToByteArray()); MarshalEx.WriteIntPtr(p, 40, this.hWnd); MarshalEx.WriteInt32(p, 44, this.uMsg); MarshalEx.WriteInt32(p, 48, this.lParam); MarshalEx.WriteInt32(p, 52, this.ulMaxCost); MarshalEx.WriteInt32(p, 56, this.ulMinRcvBw); MarshalEx.WriteInt32(p, 60, this.ulMaxConnLatency); handle = p; return(p); }