pvginkel / PdfiumViewer

PDF viewer based on Google's PDFium.
Apache License 2.0
972 stars 418 forks source link

LoadLibrary is using the Ansi version #108

Closed xanatos closed 7 years ago

xanatos commented 7 years ago

The LoadLibrary is using the Ansi Version of the method.

    [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
    private static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string lpFileName);

should be

    [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)]
    private static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPWStr)] string lpFileName);

otherwise if you have folders with Unicode names it won't work correctly (or like the CreateFileMapping use CharSet.Auto and LPTStr)

pvginkel commented 7 years ago

Thanks for the report. I've made the change.