Skip to content

Commit

Permalink
Migrate DWrite Factory to managed.
Browse files Browse the repository at this point in the history
Contributes to dotnet#5305
  • Loading branch information
ThomasGoulet73 authored and kant2002 committed Jul 5, 2022
1 parent e1c803e commit ea03a25
Show file tree
Hide file tree
Showing 30 changed files with 954 additions and 549 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;

internal static partial class Interop
{
// Implementation of HRESULT_FROM_WIN32 macro
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static int HRESULT_FROM_WIN32(int errorCode)
{
if (errorCode <= 0 || (errorCode & 0x80000000) == 0x80000000)
{
return errorCode;
}

return (errorCode & 0x0000FFFF) | unchecked((int)0x80070000);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class Kernel32
{
[DllImport(Libraries.Kernel32, SetLastError = true, ExactSpelling = true)]
internal static extern int FreeLibrary(IntPtr hModule);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class Kernel32
{
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
internal static extern IntPtr GetModuleHandleW(string moduleName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class Kernel32
{
[DllImport(Libraries.Kernel32, CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
internal static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class Kernel32
{
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
internal static extern IntPtr LoadLibraryW(string libFilename);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class Kernel32
{
public const int LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800;

[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
internal static extern IntPtr LoadLibraryExW(string lpwLibFileName, IntPtr hFile, uint dwFlags);
}
}
Loading

0 comments on commit ea03a25

Please sign in to comment.