From 1b4088e580af681634e72286a5ee747630a2fa46 Mon Sep 17 00:00:00 2001 From: san Date: Mon, 16 Feb 2009 06:59:33 +0000 Subject: [PATCH] Processing Unicode string returned by Win32 API correctly --- src/SUITApp/SUITApp.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index bbac91a30..efe4b4ba3 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -196,13 +196,12 @@ int main( int args, char* argv[] ) #ifdef WIN32 DWORD aLen=1024; - char aStr[1024]; + wchar_t aStr[1024]; HANDLE aToken=0; HANDLE hProcess = GetCurrentProcess(); OpenProcessToken(hProcess,TOKEN_QUERY,&aToken); - if( GetUserProfileDirectory( aToken, aStr, &aLen ) ) - env = aStr; - + if( GetUserProfileDirectory( aToken, aStr, &aLen ) && aLen > 0) + env = QString::fromWCharArray(aStr, aLen); #else if ( ::getenv( "HOME" ) ) env = ::getenv( "HOME" ); -- 2.39.2