Skip to content

Commit

Permalink
Support non-ascii file paths (#76)
Browse files Browse the repository at this point in the history
Fix #75
  • Loading branch information
qwbarch committed Jun 18, 2024
1 parent 5b5bb00 commit 07067e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions NAudio.Lame/LameDLL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ internal static LAMEVersion GetLameVersion()

internal static class Native
{
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string lpFilename);
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)]
static extern IntPtr LoadLibraryW([MarshalAs(UnmanagedType.LPWStr)] string lpFilename);

private static IntPtr _hLameDll = IntPtr.Zero;

private static bool TryLoadLameDLL(FileInfo file)
{
if (file == null || !file.Exists)
return false;
var handle = LoadLibrary(file.FullName);
var handle = LoadLibraryW(file.FullName);
if (handle == IntPtr.Zero)
return false;
_hLameDll = handle;
Expand Down

0 comments on commit 07067e2

Please sign in to comment.