Skip to content

Commit ea03a25

Browse files
ThomasGoulet73kant2002
authored andcommitted
Migrate DWrite Factory to managed.
Contributes to dotnet#5305
1 parent e1c803e commit ea03a25

30 files changed

+954
-549
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
4+
using System.Runtime.CompilerServices;
5+
6+
internal static partial class Interop
7+
{
8+
// Implementation of HRESULT_FROM_WIN32 macro
9+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
10+
internal static int HRESULT_FROM_WIN32(int errorCode)
11+
{
12+
if (errorCode <= 0 || (errorCode & 0x80000000) == 0x80000000)
13+
{
14+
return errorCode;
15+
}
16+
17+
return (errorCode & 0x0000FFFF) | unchecked((int)0x80070000);
18+
}
19+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
4+
using System;
5+
using System.Runtime.InteropServices;
6+
7+
internal static partial class Interop
8+
{
9+
internal static partial class Kernel32
10+
{
11+
[DllImport(Libraries.Kernel32, SetLastError = true, ExactSpelling = true)]
12+
internal static extern int FreeLibrary(IntPtr hModule);
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
4+
using System;
5+
using System.Runtime.InteropServices;
6+
7+
internal static partial class Interop
8+
{
9+
internal static partial class Kernel32
10+
{
11+
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
12+
internal static extern IntPtr GetModuleHandleW(string moduleName);
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
4+
using System;
5+
using System.Runtime.InteropServices;
6+
7+
internal static partial class Interop
8+
{
9+
internal static partial class Kernel32
10+
{
11+
[DllImport(Libraries.Kernel32, CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
12+
internal static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
4+
using System;
5+
using System.Runtime.InteropServices;
6+
7+
internal static partial class Interop
8+
{
9+
internal static partial class Kernel32
10+
{
11+
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
12+
internal static extern IntPtr LoadLibraryW(string libFilename);
13+
}
14+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
4+
using System;
5+
using System.Runtime.InteropServices;
6+
7+
internal static partial class Interop
8+
{
9+
internal static partial class Kernel32
10+
{
11+
public const int LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800;
12+
13+
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
14+
internal static extern IntPtr LoadLibraryExW(string lpwLibFileName, IntPtr hFile, uint dwFlags);
15+
}
16+
}

0 commit comments

Comments
 (0)