Reputation: 19
I have used this code in msdn (Obtaining a file name from a file handle) to obtain the file name of a file handle that i got from findfirstchangenotification.
But now the problem is that the encoding of the resulting string is somehow wrong. I just see one character instead of all characters (usually a question mark).
So my code calls GetMappedFileName
, and gets question marks.
if (GetMappedFileName (GetCurrentProcess(),
pMem,
pszFilename,
MAX_PATH))
Why?
Upvotes: 0
Views: 147
Reputation: 100032
You are calling the 'A' form of GetMappedFileName
, which can only deliver characters in your current ACP. Your filename has characters not in the current ACP, so they get turned to question marks.
If the file name includes Unicode characters that have no representation in your current ACP, you will get question marks. You should call the 'W' form of the API to get the Unicode form of the file name, and then decide what you want to do with it.
Upvotes: 2