wfreerdp: Fix the crash when 'HOME' env is not defined. Now use 'HOMEDRIVE' and 'HOMEPATH' to combine it if it don't exist.

This commit is contained in:
louyihua 2012-01-10 05:19:28 +08:00
parent 7b30f732f2
commit 77523cf587
1 changed files with 8 additions and 0 deletions

View File

@ -598,6 +598,14 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
WSADATA wsa_data;
WNDCLASSEX wnd_cls;
if (NULL == getenv("HOME"))
{
char home[MAX_PATH * 2] = "HOME=";
strcat(home, getenv("HOMEDRIVE"));
strcat(home, getenv("HOMEPATH"));
_putenv(home);
}
if (WSAStartup(0x101, &wsa_data) != 0)
return 1;