diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-04-02 14:34:17 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-04-02 14:34:17 +0400 |
commit | 8c4fc35ecbd51cd669adbf7b37bfd8667821f001 (patch) | |
tree | 2f380cb7e5c368071626aba242853b3f02f27b3d /winsup/cygwin/dcrt0.cc | |
parent | bd6e30d59aed07d0d63f8c7b9be1813300fa2225 (diff) |
* dcrt0.cc (insert_file): Convert filename to WCHAR and call
CreateFileW to allow UTF-8 filenames.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 7461b04aa..cd2ac1eae 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -39,6 +39,7 @@ details. */ #include "sync.h" #include "heap.h" #include "environ.h" +#include "tls_pbuf.h" #define MAX_AT_FILE_LEVEL 10 @@ -161,14 +162,17 @@ insert_file (char *name, char *&cmd) { HANDLE f; DWORD size; - - f = CreateFile (name + 1, - GENERIC_READ, /* open for reading */ - FILE_SHARE_READ, /* share for reading */ - &sec_none_nih, /* no security */ - OPEN_EXISTING, /* existing file only */ - FILE_ATTRIBUTE_NORMAL, /* normal file */ - NULL); /* no attr. template */ + tmp_pathbuf tp; + + PWCHAR wname = tp.w_get (); + sys_mbstowcs (wname, NT_MAX_PATH + 1, name + 1); + f = CreateFileW (wname, + GENERIC_READ, /* open for reading */ + FILE_SHARE_READ, /* share for reading */ + &sec_none_nih, /* default security */ + OPEN_EXISTING, /* existing file only */ + FILE_ATTRIBUTE_NORMAL,/* normal file */ + NULL); /* no attr. template */ if (f == INVALID_HANDLE_VALUE) { |