* dcrt0.cc (insert_file): Convert filename to WCHAR and call

CreateFileW to allow UTF-8 filenames.
This commit is contained in:
Corinna Vinschen 2008-04-02 10:34:17 +00:00
parent bd6e30d59a
commit 8c4fc35ecb
2 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2008-04-02 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (insert_file): Convert filename to WCHAR and call
CreateFileW to allow UTF-8 filenames.
2008-04-01 Corinna Vinschen <corinna@vinschen.de> 2008-04-01 Corinna Vinschen <corinna@vinschen.de>
* Fix copyright dates. * Fix copyright dates.

View File

@ -39,6 +39,7 @@ details. */
#include "sync.h" #include "sync.h"
#include "heap.h" #include "heap.h"
#include "environ.h" #include "environ.h"
#include "tls_pbuf.h"
#define MAX_AT_FILE_LEVEL 10 #define MAX_AT_FILE_LEVEL 10
@ -161,14 +162,17 @@ insert_file (char *name, char *&cmd)
{ {
HANDLE f; HANDLE f;
DWORD size; DWORD size;
tmp_pathbuf tp;
f = CreateFile (name + 1, PWCHAR wname = tp.w_get ();
GENERIC_READ, /* open for reading */ sys_mbstowcs (wname, NT_MAX_PATH + 1, name + 1);
FILE_SHARE_READ, /* share for reading */ f = CreateFileW (wname,
&sec_none_nih, /* no security */ GENERIC_READ, /* open for reading */
OPEN_EXISTING, /* existing file only */ FILE_SHARE_READ, /* share for reading */
FILE_ATTRIBUTE_NORMAL, /* normal file */ &sec_none_nih, /* default security */
NULL); /* no attr. template */ OPEN_EXISTING, /* existing file only */
FILE_ATTRIBUTE_NORMAL,/* normal file */
NULL); /* no attr. template */
if (f == INVALID_HANDLE_VALUE) if (f == INVALID_HANDLE_VALUE)
{ {