mirror of https://github.com/FreeRDP/FreeRDP
wfreerdp: add support for .rdp files
This commit is contained in:
parent
bdcedaf8df
commit
67c24dc81d
|
@ -43,6 +43,8 @@
|
|||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/load_plugin.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#include <freerdp/client/file.h>
|
||||
#include <freerdp/client/channels.h>
|
||||
#include <freerdp/channels/channels.h>
|
||||
|
||||
|
@ -144,6 +146,7 @@ BOOL wf_pre_connect(freerdp* instance)
|
|||
{
|
||||
int i1;
|
||||
wfInfo* wfi;
|
||||
rdpFile* file;
|
||||
wfContext* context;
|
||||
rdpSettings* settings;
|
||||
|
||||
|
@ -154,6 +157,18 @@ BOOL wf_pre_connect(freerdp* instance)
|
|||
|
||||
settings = instance->settings;
|
||||
|
||||
settings = instance->settings;
|
||||
|
||||
if (settings->connection_file)
|
||||
{
|
||||
file = freerdp_client_rdp_file_new();
|
||||
|
||||
printf("Using connection file: %s\n", settings->connection_file);
|
||||
|
||||
freerdp_client_parse_rdp_file(file, settings->connection_file);
|
||||
freerdp_client_populate_settings_from_rdp_file(file, settings);
|
||||
}
|
||||
|
||||
settings->os_major_type = OSMAJORTYPE_WINDOWS;
|
||||
settings->os_minor_type = OSMINORTYPE_WINDOWS_NT;
|
||||
settings->order_support[NEG_DSTBLT_INDEX] = TRUE;
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#define DEBUG_CLIENT_FILE 1
|
||||
|
||||
static BYTE BOM_UTF16_LE[2] = { 0xFF, 0xFE };
|
||||
static WCHAR CR_LF_STR_W[] = { '\r', '\n', '\0' };
|
||||
|
||||
|
@ -48,6 +50,10 @@ static WCHAR CR_LF_STR_W[] = { '\r', '\n', '\0' };
|
|||
|
||||
BOOL freerdp_client_rdp_file_set_integer(rdpFile* file, char* name, int value)
|
||||
{
|
||||
#ifdef DEBUG_CLIENT_FILE
|
||||
printf("%s:i:%d\n", name, value);
|
||||
#endif
|
||||
|
||||
if (_stricmp(name, "use multimon") == 0)
|
||||
file->UseMultiMon = value;
|
||||
else if (_stricmp(name, "screen mode id") == 0)
|
||||
|
@ -214,6 +220,10 @@ void freerdp_client_parse_rdp_file_integer_ascii(rdpFile* file, char* name, char
|
|||
|
||||
BOOL freerdp_client_rdp_file_set_string(rdpFile* file, char* name, char* value)
|
||||
{
|
||||
#ifdef DEBUG_CLIENT_FILE
|
||||
printf("%s:s:%s\n", name, value);
|
||||
#endif
|
||||
|
||||
if (_stricmp(name, "username") == 0)
|
||||
file->Username = value;
|
||||
else if (_stricmp(name, "domain") == 0)
|
||||
|
@ -517,8 +527,14 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
|
|||
settings->shell = file->AlternateShell;
|
||||
if (~((size_t) file->ShellWorkingDirectory))
|
||||
settings->directory = file->ShellWorkingDirectory;
|
||||
|
||||
if (~((size_t) file->GatewayHostname))
|
||||
settings->tsg_hostname = file->GatewayHostname;
|
||||
if (~file->GatewayUsageMethod)
|
||||
settings->ts_gateway = TRUE;
|
||||
if (~file->PromptCredentialOnce)
|
||||
settings->tsg_same_credentials = TRUE;
|
||||
|
||||
if (~file->RemoteApplicationMode)
|
||||
settings->remote_app = file->RemoteApplicationMode;
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ struct rdp_file
|
|||
LPSTR Domain; /* domain */
|
||||
PBYTE Password51; /* password 51 */
|
||||
|
||||
LPTSTR FullAddress; /* full address */
|
||||
LPTSTR AlternateFullAddress; /* alternate full address */
|
||||
LPSTR FullAddress; /* full address */
|
||||
LPSTR AlternateFullAddress; /* alternate full address */
|
||||
DWORD ServerPort; /* server port */
|
||||
|
||||
DWORD RedirectDrives; /* redirectdrives */
|
||||
|
|
|
@ -303,7 +303,9 @@ struct rdp_settings
|
|||
ALIGN64 char* preconnection_blob; /* 74 */
|
||||
ALIGN64 char* computer_name; /* 75 */
|
||||
ALIGN64 char* connection_file; /* 76 */
|
||||
UINT64 paddingC[80 - 77]; /* 77 */
|
||||
ALIGN64 char* tsg_domain; /* 77 */
|
||||
ALIGN64 BOOL tsg_same_credentials; /* 78 */
|
||||
UINT64 paddingC[80 - 79]; /* 79 */
|
||||
|
||||
/* User Interface Parameters */
|
||||
ALIGN64 BOOL sw_gdi; /* 80 */
|
||||
|
|
|
@ -579,7 +579,7 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
|
|||
{
|
||||
cookie_length = strlen(nego->cookie);
|
||||
|
||||
if (cookie_length > nego->cookie_max_length)
|
||||
if (cookie_length > (int) nego->cookie_max_length)
|
||||
cookie_length = nego->cookie_max_length;
|
||||
|
||||
stream_write(s, "Cookie: mstshash=", 17);
|
||||
|
|
|
@ -212,13 +212,24 @@ STREAM* rpc_ntlm_http_request(rdpRpc* rpc, SecBuffer* ntlm_token, int content_le
|
|||
BOOL rpc_ntlm_http_out_connect(rdpRpc* rpc)
|
||||
{
|
||||
STREAM* s;
|
||||
rdpSettings* settings;
|
||||
int ntlm_token_length;
|
||||
BYTE* ntlm_token_data;
|
||||
HttpResponse* http_response;
|
||||
rdpNtlm* ntlm = rpc->ntlm_http_out->ntlm;
|
||||
|
||||
ntlm_client_init(ntlm, TRUE, rpc->settings->username,
|
||||
rpc->settings->domain, rpc->settings->password);
|
||||
settings = rpc->settings;
|
||||
|
||||
if (settings->tsg_same_credentials)
|
||||
{
|
||||
ntlm_client_init(ntlm, TRUE, settings->username,
|
||||
settings->domain, settings->password);
|
||||
}
|
||||
else
|
||||
{
|
||||
ntlm_client_init(ntlm, TRUE, settings->tsg_username,
|
||||
settings->tsg_domain, settings->tsg_password);
|
||||
}
|
||||
|
||||
ntlm_authenticate(ntlm);
|
||||
|
||||
|
|
Loading…
Reference in New Issue