added set_error_info function

if an error_info is set, a TS_SET_ERROR_INFO_PDU
will be sent to the client on disconnect with
the error_info
This commit is contained in:
Martin Haimberger 2015-01-13 08:09:36 -08:00
parent df79781f3e
commit bba342a6be
6 changed files with 37 additions and 1 deletions

View File

@ -3,6 +3,8 @@
* FreeRDP Interface
*
* Copyright 2009-2011 Jay Sorg
* Copyright 2014 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -252,6 +254,7 @@ FREERDP_API int freerdp_message_queue_process_message(freerdp* instance, DWORD i
FREERDP_API int freerdp_message_queue_process_pending_messages(freerdp* instance, DWORD id);
FREERDP_API UINT32 freerdp_error_info(freerdp* instance);
FREERDP_API void freerdp_set_error_info(rdpRdp* rdp, UINT32 error);
FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision);

View File

@ -1,8 +1,9 @@
/*
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Core
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2014 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -491,6 +492,10 @@ UINT32 freerdp_error_info(freerdp* instance)
return instance->context->rdp->errorInfo;
}
void freerdp_set_error_info(rdpRdp* rdp, UINT32 error) {
rdp->errorInfo = error;
}
UINT32 freerdp_get_last_error(rdpContext* context)
{
return context->LastError;

View File

@ -4,6 +4,7 @@
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2014 Norbert Federa <norbert.federa@thincast.com>
* Copyright 2014 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -766,6 +767,8 @@ BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
if (!(earlyCapabilityFlags & RNS_UD_CS_VALID_CONNECTION_TYPE))
connectionType = 0;
settings->SupportErrorInfoPdu = earlyCapabilityFlags & RNS_UD_CS_SUPPORT_ERRINFO_PDU;
settings->ConnectionType = connectionType;
return TRUE;

View File

@ -3,6 +3,7 @@
* RDP Server Peer
*
* Copyright 2011 Vic Lee
* Copyright 2014 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -574,6 +575,10 @@ static BOOL freerdp_peer_close(freerdp_peer* client)
if (!rdp_send_deactivate_all(client->context->rdp))
return FALSE;
if (freerdp_get_param_bool(client->settings, FreeRDP_SupportErrorInfoPdu) ) {
rdp_send_error_info(client->context->rdp);
}
return mcs_send_disconnect_provider_ultimatum(client->context->rdp->mcs);
}

View File

@ -3,6 +3,7 @@
* RDP Core
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2014 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -1235,6 +1236,23 @@ int rdp_send_channel_data(rdpRdp* rdp, UINT16 channelId, BYTE* data, int size)
return freerdp_channel_send(rdp, channelId, data, size);
}
BOOL rdp_send_error_info(rdpRdp* rdp)
{
wStream* s;
BOOL status;
if (rdp->errorInfo == ERRINFO_SUCCESS)
return TRUE;
s = rdp_data_pdu_init(rdp);
Stream_Write_UINT32(s, rdp->errorInfo); /* error id (4 bytes) */
status = rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SET_ERROR_INFO, 0);
return status;
}
/**
* Set non-blocking mode information.
* @param rdp RDP module

View File

@ -3,6 +3,7 @@
* RDP Core
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2014 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -229,5 +230,6 @@ void rdp_free(rdpRdp* rdp);
BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags);
BOOL rdp_set_error_info(rdpRdp* rdp, UINT32 errorInfo);
BOOL rdp_send_error_info(rdpRdp* rdp);
#endif /* __RDP_H */