Note, infoBuf is of course not a string, it's a null-terminated TCHAR array.
If unicode is enabled (the default I believe), then this is convertible to a std::wstring.
Another way is to use std::getenv, if you're sure you just want whatever %USERNAME% is (Another program might modify your environmental variable, so in general it's not as secure).