Enrico Forestieri wrote:
On Thu, Apr 30, 2009 at 10:43:51AM +0200, Abdelrazak Younes wrote:
Will this be working with UTF16 file names? I see that CreateFile is a macro that is expanded to CreatedFileW on MSVC2008...

I am not proficient with Windows APIs and none of
http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa363874(VS.85).aspx
shed any light for me. What I thought is that toFilesystemEncoding()
should do the right thing and that CreateFile should follow.

From what I read CreateFile (just like most other functions that take a string param) is
nothing more than a macro that during precompilation expands to CreateFileA
or CreateFileW depending on the definition of UNICODE (when UNICODE is
defined it will expand to CreateFileW).

I don't know the internals, but if the docs to CreateFile don't
tell me anything about the encoding, I assume that I can pass any
of the two possible encodings and they will be dealt with correctly.
For what I know, CreateFile could use the W or A APIs according
to whatever succeeds, but this is a speculation of mine.

Hum, the problem is AFAIU that CreateFileA takes a 'char *' and CreateFileW takes a 'wchar_t *' so I fear that we'll get a compilation error on MSVC but I cannot test right now. I came across similar problem recently while trying to dlopen a library by name...

I generally try to stay away from direct exposure to Windows and
use the Cygwin shield, which worked well for me until now ;-)

I know you do ;-)

Abdel.

Reply via email to