Code Coverage by Clover.NET

 « Return to Thread: Unicode in path for log file

Re: Unicode in path for log file

by Trebuchet :: Rate this Message:

Reply to Author | View in Thread

Given no response here I went digging myself...

This comes down to Win32FileHelper using CreateFile rather than CreateFileW.  

Changing the import to

        [DllImport("kernel32.dll", SetLastError = true)]
        public static extern IntPtr CreateFileW(
            [MarshalAs(UnmanagedType.LPWStr)] string lpwFileName,
            FileAccess dwDesiredAccess,
            int dwShareMode,
            IntPtr lpSecurityAttributes,
            CreationDisposition dwCreationDisposition,
            Win32FileAttributes dwFlagsAndAttributes,
            IntPtr hTemplateFile);

and then changing BaseFileAppender to call this instead seemed to work ok.  

 « Return to Thread: Unicode in path for log file

LightInTheBox - Buy quality products at wholesale price