Index: base/applications/mstsc/rdp.c =================================================================== --- base/applications/mstsc/rdp.c (revision 74520) +++ base/applications/mstsc/rdp.c (working copy) @@ -340,8 +340,10 @@ int len_directory = 2 * strlen(directory); /* length of strings in TS_EXTENDED_PACKET includes null terminator */ + HMODULE hDllName = NULL; + char dllName[MAX_PATH]; int len_ip = 2 * strlen(ipaddr) + 2; - int len_dll = 2 * strlen("C:\\") + 2; + int len_dll = 0; int packetlen = 0; uint32 sec_flags = g_encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT) : SEC_LOGON_INFO; @@ -350,6 +352,10 @@ time_t tzone; uint8 security_verifier[16]; + GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)rdp_send_logon_info, &hDllName); + GetModuleFileNameA(hDllName, dllName, MAX_PATH); + FreeLibrary(hDllName); + len_dll = 2 * strlen(dllName) + 2; + if (g_rdp_version == RDP_V4 || 1 == g_server_rdp_version) { DEBUG_RDP5(("Sending RDP4-style Logon packet\n")); @@ -466,7 +472,7 @@ out_uint16_le(s, len_ip); /* cbClientAddress, Length of client ip */ rdp_out_unistr(s, ipaddr, len_ip - 2); /* clientAddress */ out_uint16_le(s, len_dll); /* cbClientDir */ - rdp_out_unistr(s, "C:\\", len_dll - 2); /* clientDir */ + rdp_out_unistr(s, dllName, len_dll - 2); /* clientDir */ /* TS_TIME_ZONE_INFORMATION */ tzone = (mktime(gmtime(&t)) - mktime(localtime(&t))) / 60;