SHGetFolderPath returns path with question marks in it

Posted by Colen on Stack Overflow See other posts from Stack Overflow or by Colen
Published on 2010-12-28T17:25:32Z Indexed on 2010/12/28 22:54 UTC
Read the original article Hit count: 315

Filed under:
|
|
|

Hi,

Our application calls ShGetFolderPath when it runs, to get the My Documents folder. This normally works great. However, for three users - ???????, Jörg and Jörgen (see if you can spot the pattern!) - the call returns some very strange results. For example, for ???????, the call returns:

c:\Users\???????\Documents

I assume there's some sort of character encoding shenanigan going on here, possibly related to Unicode, but I don't have any experience with that sort of thing. How can I get a useful path to the folder (and other related folders) out of windows, without grovelling through registry keys for the information?

In an email to me, ??????? ("Dmitry"), told me his "my documents" folder was actually located here:

C:\Users\43D6~1\Documents

So I know there's a way to get a "normal" version of the path out of Windows, I just don't know what it is.

Background: Our application is not unicode-aware, and uses standard "char *" strings. How can we get the "normal" path? I'm not opposed to calling the "unicode" version of the function, then converting it to "normal" text, if that's possible. Converting the application entirely to use unicode is not an option here (we don't have the time).

Thanks.

© Stack Overflow or respective owner

Related posts about c++

Related posts about winapi