Skip to content

Commit 894e22f

Browse files
authored
Merge pull request #2816 from hughbe/Cleanup-GETTEXTLENGHTEX
Cleanup EDITSTREAM
2 parents af6bc32 + df8798e commit 894e22f

9 files changed

Lines changed: 3033 additions & 1796 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
using System.Runtime.InteropServices;
7+
8+
internal partial class Interop
9+
{
10+
internal static partial class Richedit
11+
{
12+
[StructLayout(LayoutKind.Sequential, Pack = 4)]
13+
public struct EDITSTREAM
14+
{
15+
public UIntPtr dwCookie;
16+
public uint dwError;
17+
public IntPtr pfnCallback;
18+
}
19+
}
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
7+
internal partial class Interop
8+
{
9+
internal static partial class Richedit
10+
{
11+
public delegate int EDITSTREAMCALLBACK(IntPtr dwCookie, IntPtr pbBuff, int cb, out int pcb);
12+
}
13+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
7+
internal partial class Interop
8+
{
9+
internal static partial class Richedit
10+
{
11+
[Flags]
12+
public enum SF : uint
13+
{
14+
TEXT = 0x0001,
15+
RTF = 0x0002,
16+
RTFNOOBJS = 0x0003,
17+
TEXTIZED = 0x0004,
18+
UNICODE = 0x0010,
19+
USECODEPAGE = 0x0020,
20+
NCRFORNONASCII = 0x0040,
21+
RTFVAL = 0x0700,
22+
F_PWD = 0x0800,
23+
F_KEEPDOCINFO = 0x1000,
24+
F_PERSISTVIEWSCALE = 0x2000,
25+
F_PLAINRTF = 0x4000,
26+
F_SELECTION = 0x8000,
27+
}
28+
}
29+
}

src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Internals/NativeMethods.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,6 @@ public class HH_FTS_QUERY
159159
internal string pszWindow = null;
160160
}
161161

162-
public delegate int EditStreamCallback(IntPtr dwCookie, IntPtr buf, int cb, out int transferred);
163-
164-
[StructLayout(LayoutKind.Sequential)]
165-
public class EDITSTREAM
166-
{
167-
public IntPtr dwCookie = IntPtr.Zero;
168-
public int dwError = 0;
169-
public EditStreamCallback pfnCallback = null;
170-
}
171-
172-
[StructLayout(LayoutKind.Sequential)]
173-
public class EDITSTREAM64
174-
{
175-
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
176-
public byte[] contents = new byte[20];
177-
}
178-
179162
public delegate IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
180163

181164
public delegate int ListViewCompareCallback(IntPtr lParam1, IntPtr lParam2, IntPtr lParamSort);

src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Internals/UnsafeNativeMethods.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,6 @@ public static StringBuilder GetModuleFileNameLongPath(HandleRef hModule)
8383
[DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
8484
public static extern int SendMessage(HandleRef hWnd, int msg, int wParam, [Out, MarshalAs(UnmanagedType.IUnknown)]out object editOle);
8585

86-
[DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
87-
public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.EDITSTREAM lParam);
88-
89-
[DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
90-
public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, NativeMethods.EDITSTREAM64 lParam);
91-
9286
[DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)]
9387
public static extern int GetDlgItemInt(IntPtr hWnd, int nIDDlgItem, bool[] err, bool signed);
9488

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using Xunit;
6+
using static Interop.Richedit;
7+
8+
namespace System.Windows.Forms.Tests.Interop.Richedit
9+
{
10+
public class EDITSTREAMTests : IClassFixture<ThreadExceptionFixture>
11+
{
12+
[WinFormsFact]
13+
public unsafe void EditStream_Size_Get_ReturnsExpected()
14+
{
15+
if (IntPtr.Size == 4)
16+
{
17+
Assert.Equal(12, sizeof(EDITSTREAM));
18+
}
19+
else
20+
{
21+
Assert.Equal(20, sizeof(EDITSTREAM));
22+
}
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)