instance->context_size = sizeof(xfContext);
instance->ContextNew = (pContextNew) xf_context_new;
instance->ContextFree = (pContextFree) xf_context_free;
+ //instance->flags = FREERDP_FLAG_ASYNC_UPDATE;
freerdp_context_new(instance);
instance->context->argc = argc;
detect_status = 1;
}
+ if (settings->ServerHostname)
+ free(settings->ServerHostname);
+
free(settings);
return detect_status;
UINT32 paddingC[64 - 41]; /* 41 */
};
+#define FREERDP_FLAG_ASYNC_UPDATE 0x00000001
+
/** Defines the options for a given instance of RDP connection.
* This is built by the client and given to the FreeRDP library to create the connection
* with the expected options.
When using this capability, client application should ALWAYS declare their structure with the
rdpContext field first, and any additional content following it.
Can be allocated by a call to freerdp_context_new().
- Must be dealocated by a call to freerdp_context_free() before deallocating the current instance. */
- UINT32 paddingA[16 - 1]; /* 1 */
+ Must be deallocated by a call to freerdp_context_free() before deallocating the current instance. */
+
+ UINT32 flags; /**< (offset 1) context flags, can be set prior to freerdp_context_new() */
+
+ UINT32 paddingA[16 - 2]; /* 2 */
rdpInput* input; /* (offset 16)
Input handle for the connection.
for (y = 0; y < subband_width; y++)
{
/* Even coefficients */
- for (n = 0; n < subband_width; n+=8)
+ for (n = 0; n < subband_width; n += 8)
{
/* dst[2n] = l[n] - ((h[n-1] + h[n] + 1) >> 1); */
h_n = _mm_load_si128((__m128i*) h_ptr);
h_n_m = _mm_loadu_si128((__m128i*) (h_ptr - 1));
+
if (n == 0)
{
first = _mm_extract_epi16(h_n_m, 1);
_mm_store_si128((__m128i*) l_ptr, dst_n);
- l_ptr+=8;
- h_ptr+=8;
+ l_ptr += 8;
+ h_ptr += 8;
}
+
l_ptr -= subband_width;
h_ptr -= subband_width;
/* Odd coefficients */
- for (n = 0; n < subband_width; n+=8)
+ for (n = 0; n < subband_width; n += 8)
{
/* dst[2n + 1] = (h[n] << 1) + ((dst[2n] + dst[2n + 2]) >> 1); */
dst_n = _mm_load_si128((__m128i*) (l_ptr));
dst_n_p = _mm_loadu_si128((__m128i*) (l_ptr + 1));
+
if (n == subband_width - 8)
{
last = _mm_extract_epi16(dst_n_p, 6);
_mm_store_si128((__m128i*) dst_ptr, dst1);
_mm_store_si128((__m128i*) (dst_ptr + 8), dst2);
- l_ptr+=8;
- h_ptr+=8;
- dst_ptr+=16;
+ l_ptr += 8;
+ h_ptr += 8;
+ dst_ptr += 16;
}
}
}
freerdp* instance;
instance = (freerdp*) malloc(sizeof(freerdp));
- ZeroMemory(instance, sizeof(freerdp));
- if (instance != NULL)
+ if (instance)
{
+ ZeroMemory(instance, sizeof(freerdp));
instance->context_size = sizeof(rdpContext);
instance->SendChannelData = freerdp_send_channel_data;
}
static void message_SetBounds(rdpContext* context, rdpBounds* bounds)
{
- rdpBounds* wParam;
+ rdpBounds* wParam = NULL;
- wParam = (rdpBounds*) malloc(sizeof(rdpBounds));
- CopyMemory(wParam, bounds, sizeof(rdpBounds));
+ if (bounds)
+ {
+ wParam = (rdpBounds*) malloc(sizeof(rdpBounds));
+ CopyMemory(wParam, bounds, sizeof(rdpBounds));
+ }
MessageQueue_Post(context->update->queue, (void*) context,
MakeMessageId(Update, SetBounds), (void*) wParam, NULL);
wParam = (CACHE_BRUSH_ORDER*) malloc(sizeof(CACHE_BRUSH_ORDER));
CopyMemory(wParam, cacheBrushOrder, sizeof(CACHE_BRUSH_ORDER));
- wParam->data = (BYTE*) malloc(wParam->length);
- CopyMemory(wParam->data, cacheBrushOrder->data, wParam->length);
+ //wParam->data = (BYTE*) malloc(wParam->length);
+ //CopyMemory(wParam->data, cacheBrushOrder->data, wParam->length);
MessageQueue_Post(context->update->queue, (void*) context,
MakeMessageId(SecondaryUpdate, CacheBrush), (void*) wParam, NULL);
case Update_SetBounds:
IFCALL(update->SetBounds, msg->context, (rdpBounds*) msg->wParam);
- free(msg->wParam);
+ if (msg->wParam)
+ free(msg->wParam);
break;
case Update_Synchronize:
{
CACHE_BITMAP_V2_ORDER* wParam = (CACHE_BITMAP_V2_ORDER*) msg->wParam;
- free(wParam->bitmapDataStream);
+ //free(wParam->bitmapDataStream);
free(wParam);
}
break;
{
CACHE_BRUSH_ORDER* wParam = (CACHE_BRUSH_ORDER*) msg->wParam;
- free(wParam->data);
+ //free(wParam->data);
free(wParam);
}
break;
return 0; /* Packet is not yet completely received. */
}
- /*
- * A complete packet has been received. In case there are trailing data
- * for the next packet, we copy it to the new receive buffer.
- */
received = transport->ReceiveBuffer;
transport->ReceiveBuffer = transport_receive_pool_take(transport);
* 1: asynchronous return
*/
- ReferenceTable_Add(transport->ReceiveReferences, received);
-
recv_status = transport->ReceiveCallback(transport, received, transport->ReceiveExtra);
- ReferenceTable_Release(transport->ReceiveReferences, received);
+ transport_receive_pool_return(transport, received);
if (recv_status < 0)
status = -1;
pdu = Queue_Dequeue(transport->ReceivePool);
if (!pdu)
+ {
pdu = stream_new(BUFFER_SIZE);
+ }
pdu->p = pdu->data;
/* a small 0.1ms delay when transport is blocking. */
transport->SleepInterval = 100;
+ transport->ReceivePool = Queue_New(TRUE, -1, -1);
+ transport->ReceiveQueue = Queue_New(TRUE, -1, -1);
+ Queue_Object(transport->ReceivePool)->fnObjectFree = (OBJECT_FREE_FN) stream_free;
+ Queue_Object(transport->ReceiveQueue)->fnObjectFree = (OBJECT_FREE_FN) stream_free;
+
/* receive buffer for non-blocking read. */
- transport->ReceiveBuffer = stream_new(BUFFER_SIZE);
+ transport->ReceiveBuffer = transport_receive_pool_take(transport);
transport->ReceiveEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
/* buffers for blocking read/write */
transport->blocking = TRUE;
transport->layer = TRANSPORT_LAYER_TCP;
-
- transport->ReceivePool = Queue_New(TRUE, -1, -1);
- transport->ReceiveQueue = Queue_New(TRUE, -1, -1);
- Queue_Object(transport->ReceivePool)->fnObjectFree = (OBJECT_FREE_FN) stream_free;
- Queue_Object(transport->ReceiveQueue)->fnObjectFree = (OBJECT_FREE_FN) stream_free;
-
- transport->ReceiveReferences = ReferenceTable_New(TRUE,
- (void*) transport, (REFERENCE_FREE) transport_receive_pool_return);
}
return transport;
{
if (transport != NULL)
{
- stream_free(transport->ReceiveBuffer);
+ if (transport->ReceiveBuffer)
+ stream_free(transport->ReceiveBuffer);
+
stream_free(transport->ReceiveStream);
stream_free(transport->SendStream);
CloseHandle(transport->ReceiveEvent);
Queue_Free(transport->ReceivePool);
Queue_Free(transport->ReceiveQueue);
- ReferenceTable_Free(transport->ReceiveReferences);
-
free(transport);
}
}
wQueue* ReceivePool;
wQueue* ReceiveQueue;
-
- wReferenceTable* ReceiveReferences;
};
STREAM* transport_recv_stream_init(rdpTransport* transport, int size);
update->SuppressOutput = update_send_suppress_output;
update->initialState = TRUE;
- //update->asynchronous = TRUE;
+ update->asynchronous = (rdp->instance->flags & FREERDP_FLAG_ASYNC_UPDATE) ? TRUE : FALSE;
if (update->asynchronous)
{
if (tls->PublicKey)
free(tls->PublicKey);
+ if (tls->Bindings)
+ {
+ free(tls->Bindings->Bindings);
+ free(tls->Bindings);
+ }
+
certificate_store_free(tls->certificate_store);
free(tls);
dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
if (srcp != 0 && dstp != 0)
- memcpy(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
+ memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
}
return 0;
gdi_bitmap_free_ex(gdi->tile);
gdi_bitmap_free_ex(gdi->image);
gdi_DeleteDC(gdi->hdc);
- rfx_context_free((RFX_CONTEXT*)gdi->rfx_context);
+ rfx_context_free((RFX_CONTEXT*) gdi->rfx_context);
+ nsc_context_free((NSC_CONTEXT*) gdi->nsc_context);
+ free(gdi->clrconv->palette);
free(gdi->clrconv);
free(gdi);
}
gdi_CRgnToRect(x, y, width, height, &rect);
brush = gdi_CreateSolidBrush(fgcolor);
-
gdi_FillRect(gdi->drawing->hdc, &rect, brush);
+ gdi_DeleteObject((HGDIOBJECT) brush);
gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
}