Transport: trigger OnErrorInfo if a read/write error forced the thread to closed.

This commit is contained in:
Benoît LeBlanc 2013-12-20 18:26:07 -05:00
parent ac6385448b
commit 70cc837eaf
6 changed files with 13 additions and 0 deletions

View File

@ -146,6 +146,7 @@ extern "C" {
#define ERRINFO_ENCRYPT_FAILED 0x00001193
#define ERRINFO_ENCRYPTION_PACKAGE_MISMATCH 0x00001194
#define ERRINFO_DECRYPT_FAILED2 0x00001195
#define ERRINFO_PEER_DISCONNECTED 0x00001196
#define ERRINFO_SUCCESS 0x00000000
#define ERRINFO_NONE 0xFFFFFFFF

View File

@ -385,6 +385,9 @@ int connectErrorCode;
#define ERRINFO_DECRYPT_FAILED2_STRING \
"Unencrypted data was encountered in a protocol stream which is meant to be encrypted with Standard RDP Security mechanisms (section 5.3.6)."
#define ERRINFO_PEER_DISCONNECTED_STRING \
"The peer connection was lost."
/* Special codes */
#define ERRINFO_SUCCESS_STRING "Success."
#define ERRINFO_NONE_STRING ""
@ -507,6 +510,7 @@ static const ERRINFO ERRINFO_CODES[] =
ERRINFO_DEFINE(ENCRYPT_FAILED),
ERRINFO_DEFINE(ENCRYPTION_PACKAGE_MISMATCH),
ERRINFO_DEFINE(DECRYPT_FAILED2),
ERRINFO_DEFINE(PEER_DISCONNECTED),
ERRINFO_DEFINE(NONE)
};

View File

@ -1042,6 +1042,7 @@ rdpRdp* rdp_new(rdpContext* context)
rdp->extension = extension_new(context->instance);
rdp->transport = transport_new(rdp->settings);
rdp->transport->rdp = rdp;
rdp->license = license_new(rdp);
rdp->input = input_new(rdp);
rdp->update = update_new(rdp);
@ -1088,6 +1089,7 @@ void rdp_reset(rdpRdp* rdp)
settings->ClientAddress = NULL;
rdp->transport = transport_new(rdp->settings);
rdp->transport->rdp = rdp;
rdp->license = license_new(rdp);
rdp->nego = nego_new(rdp->transport);
rdp->mcs = mcs_new(rdp->transport);

View File

@ -208,4 +208,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);
#endif /* __RDP_H */

View File

@ -46,6 +46,7 @@
#include "tpkt.h"
#include "fastpath.h"
#include "transport.h"
#include "rdp.h"
#define BUFFER_SIZE 16384
@ -1039,6 +1040,8 @@ static void* transport_client_thread(void* arg)
status = WaitForMultipleObjects(nCount, handles, FALSE, 100);
if (transport->layer == TRANSPORT_LAYER_CLOSED)
{
rdpRdp* rdp = (rdpRdp*) transport->rdp;
rdp_set_error_info(rdp, ERRINFO_PEER_DISCONNECTED);
break;
}
else if (status != WAIT_TIMEOUT)

View File

@ -78,6 +78,7 @@ struct rdp_transport
CRITICAL_SECTION ReadLock;
CRITICAL_SECTION WriteLock;
wLog* log;
void* rdp;
};
wStream* transport_send_stream_init(rdpTransport* transport, int size);