libfreerdp-core: add TS Gateway system message support

This commit is contained in:
Marc-André Moreau 2013-03-14 12:57:45 -04:00
parent 79638db42c
commit 0031c4918e
4 changed files with 37 additions and 20 deletions

View File

@ -491,11 +491,9 @@ static void rfx_dwt_2d_encode_sse2(INT16* buffer, INT16* dwt_buffer)
void rfx_init_sse2(RFX_CONTEXT* context) void rfx_init_sse2(RFX_CONTEXT* context)
{ {
if (!IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) if (!IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE))
return; return;
printf("\n\nIs this causing crashes???\n\n");
DEBUG_RFX("Using SSE2 optimizations"); DEBUG_RFX("Using SSE2 optimizations");
IF_PROFILER(context->priv->prof_rfx_quantization_decode->name = "rfx_quantization_decode_sse2"); IF_PROFILER(context->priv->prof_rfx_quantization_decode->name = "rfx_quantization_decode_sse2");

View File

@ -335,9 +335,10 @@ int rpc_in_write(rdpRpc* rpc, BYTE* data, int length)
int status; int status;
#ifdef WITH_DEBUG_TSG #ifdef WITH_DEBUG_TSG
rpc_pdu_header_print((rpcconn_hdr_t*) data);
printf("Sending PDU (length: %d)\n", length); printf("Sending PDU (length: %d)\n", length);
rpc_pdu_header_print((rpcconn_hdr_t*) data);
winpr_HexDump(data, length); winpr_HexDump(data, length);
printf("\n");
#endif #endif
status = tls_write_all(rpc->TlsIn, data, length); status = tls_write_all(rpc->TlsIn, data, length);

View File

@ -191,15 +191,16 @@ int rpc_client_on_fragment_received_event(rdpRpc* rpc)
if (header->response.alloc_hint == StubLength) if (header->response.alloc_hint == StubLength)
{ {
rpc->StubCallId = 0;
rpc->StubFragCount = 0;
rpc->client->pdu->Flags = RPC_PDU_FLAG_STUB; rpc->client->pdu->Flags = RPC_PDU_FLAG_STUB;
rpc->client->pdu->CallId = rpc->StubCallId; rpc->client->pdu->CallId = rpc->StubCallId;
Stream_Length(rpc->client->pdu->s) = Stream_Position(rpc->client->pdu->s); Stream_Length(rpc->client->pdu->s) = Stream_Position(rpc->client->pdu->s);
rpc->StubFragCount = 0;
rpc->StubCallId = 0;
Queue_Enqueue(rpc->client->ReceiveQueue, rpc->client->pdu); Queue_Enqueue(rpc->client->ReceiveQueue, rpc->client->pdu);
rpc->client->pdu = NULL; rpc->client->pdu = NULL;
return 0; return 0;
@ -408,6 +409,16 @@ RPC_PDU* rpc_recv_dequeue_pdu(rdpRpc* rpc)
if (WaitForSingleObject(Queue_Event(rpc->client->ReceiveQueue), dwMilliseconds) == WAIT_OBJECT_0) if (WaitForSingleObject(Queue_Event(rpc->client->ReceiveQueue), dwMilliseconds) == WAIT_OBJECT_0)
{ {
pdu = (RPC_PDU*) Queue_Dequeue(rpc->client->ReceiveQueue); pdu = (RPC_PDU*) Queue_Dequeue(rpc->client->ReceiveQueue);
#ifdef WITH_DEBUG_TSG
if (pdu)
{
printf("Receiving PDU (length: %d, CallId: %d)\n", pdu->s->length, pdu->CallId);
winpr_HexDump(pdu->s->buffer, pdu->s->length);
printf("\n");
}
#endif
return pdu; return pdu;
} }

View File

@ -684,6 +684,7 @@ BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
UINT32 ActualCount; UINT32 ActualCount;
UINT32 SwitchValue; UINT32 SwitchValue;
PTSG_PACKET packet; PTSG_PACKET packet;
char* messageText = NULL;
PTSG_PACKET_MSG_RESPONSE packetMsgResponse; PTSG_PACKET_MSG_RESPONSE packetMsgResponse;
PTSG_PACKET_STRING_MESSAGE packetStringMessage = NULL; PTSG_PACKET_STRING_MESSAGE packetStringMessage = NULL;
PTSG_PACKET_REAUTH_MESSAGE packetReauthMessage = NULL; PTSG_PACKET_REAUTH_MESSAGE packetReauthMessage = NULL;
@ -740,7 +741,9 @@ BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
/* Offset */ /* Offset */
ActualCount = *((UINT32*) &buffer[offset + 56]); /* ActualCount */ ActualCount = *((UINT32*) &buffer[offset + 56]); /* ActualCount */
winpr_HexDump(&buffer[offset + 60], ActualCount * 2); ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) &buffer[offset + 60], ActualCount, &messageText, 0, NULL, NULL);
printf("Consent Message: %s\n", messageText);
free(messageText);
break; break;
@ -759,7 +762,9 @@ BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
/* Offset */ /* Offset */
ActualCount = *((UINT32*) &buffer[offset + 56]); /* ActualCount */ ActualCount = *((UINT32*) &buffer[offset + 56]); /* ActualCount */
winpr_HexDump(&buffer[offset + 60], ActualCount * 2); ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) &buffer[offset + 60], ActualCount, &messageText, 0, NULL, NULL);
printf("Service Message: %s\n", messageText);
free(messageText);
break; break;
@ -777,8 +782,6 @@ BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
break; break;
} }
exit(0);
return TRUE; return TRUE;
} }
@ -1130,6 +1133,7 @@ BOOL TsProxySetupReceivePipe(handle_t IDL_handle, BYTE* pRpcMessage)
BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port) BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
{ {
RPC_PDU* pdu = NULL; RPC_PDU* pdu = NULL;
RpcClientCall* call;
rdpRpc* rpc = tsg->rpc; rdpRpc* rpc = tsg->rpc;
rdpSettings* settings = rpc->settings; rdpSettings* settings = rpc->settings;
@ -1265,16 +1269,6 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
if (!TsProxyMakeTunnelCall(tsg, &tsg->TunnelContext, TSG_TUNNEL_CALL_ASYNC_MSG_REQUEST, NULL, NULL)) if (!TsProxyMakeTunnelCall(tsg, &tsg->TunnelContext, TSG_TUNNEL_CALL_ASYNC_MSG_REQUEST, NULL, NULL))
return FALSE; return FALSE;
#if 0
pdu = rpc_recv_dequeue_pdu(rpc);
if (!TsProxyMakeTunnelCallReadResponse(tsg, pdu))
{
printf("TsProxyMakeTunnelCall: error reading response\n");
return FALSE;
}
#endif
/** /**
* Sequential processing rules for connection process (continued): * Sequential processing rules for connection process (continued):
* *
@ -1296,6 +1290,19 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
pdu = rpc_recv_dequeue_pdu(rpc); pdu = rpc_recv_dequeue_pdu(rpc);
call = rpc_client_call_find_by_id(rpc, pdu->CallId);
if (call->OpNum == TsProxyMakeTunnelCallOpnum)
{
if (!TsProxyMakeTunnelCallReadResponse(tsg, pdu))
{
printf("TsProxyMakeTunnelCall: error reading response\n");
return FALSE;
}
pdu = rpc_recv_dequeue_pdu(rpc);
}
if (!TsProxyCreateChannelReadResponse(tsg, pdu)) if (!TsProxyCreateChannelReadResponse(tsg, pdu))
{ {
printf("TsProxyCreateChannel: error reading response\n"); printf("TsProxyCreateChannel: error reading response\n");