From 77523cf58738c61b5a50252517a799bd387bd0ec Mon Sep 17 00:00:00 2001 From: louyihua Date: Tue, 10 Jan 2012 05:19:28 +0800 Subject: [PATCH] wfreerdp: Fix the crash when 'HOME' env is not defined. Now use 'HOMEDRIVE' and 'HOMEPATH' to combine it if it don't exist. --- client/Windows/wfreerdp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/Windows/wfreerdp.c b/client/Windows/wfreerdp.c index f4dad7c5a..e3dc679f6 100644 --- a/client/Windows/wfreerdp.c +++ b/client/Windows/wfreerdp.c @@ -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;