Merge branch 'master' of github.com:FreeRDP/FreeRDP
This commit is contained in:
commit
cd278d7967
@ -52,8 +52,7 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
|
||||
}
|
||||
else
|
||||
{
|
||||
STREAM* body;
|
||||
body = stream_new(0);
|
||||
STREAM* body = stream_new(0);
|
||||
|
||||
for (i = 0; i < cb_event->num_formats; i++)
|
||||
{
|
||||
@ -82,12 +81,14 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
|
||||
name_length = 32;
|
||||
|
||||
stream_extend(body, stream_get_size(body) + 4 + name_length);
|
||||
|
||||
stream_write_uint32(body, cb_event->formats[i]);
|
||||
stream_write(body, name, name_length);
|
||||
}
|
||||
|
||||
s = cliprdr_packet_new(CB_FORMAT_LIST, 0, stream_get_size(body));
|
||||
stream_write(s, stream_get_head(body), stream_get_size(body));
|
||||
stream_free(body);
|
||||
}
|
||||
|
||||
cliprdr_packet_send(cliprdr, s);
|
||||
@ -166,15 +167,19 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint32
|
||||
if (cliprdr->num_format_names >= allocated_formats)
|
||||
{
|
||||
allocated_formats *= 2;
|
||||
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xrealloc(cliprdr->format_names, sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);
|
||||
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xrealloc(cliprdr->format_names,
|
||||
sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);
|
||||
}
|
||||
|
||||
format_name = &cliprdr->format_names[cliprdr->num_format_names++];
|
||||
stream_read_uint32(s, format_name->id);
|
||||
|
||||
for (p = stream_get_tail(s), name_len = 0; p+1 < end_mark; p += 2, name_len += 2)
|
||||
format_name->name = NULL;
|
||||
format_name->length = 0;
|
||||
|
||||
for (p = stream_get_tail(s), name_len = 0; p + 1 < end_mark; p += 2, name_len += 2)
|
||||
{
|
||||
if (*((unsigned short*)p) == 0)
|
||||
if (*((unsigned short*) p) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -262,10 +267,21 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL
|
||||
|
||||
if (supported)
|
||||
cb_event->formats[cb_event->num_formats++] = format;
|
||||
|
||||
if (format_name->length > 0)
|
||||
xfree(format_name->name);
|
||||
}
|
||||
|
||||
if (cliprdr->format_names != NULL)
|
||||
{
|
||||
for (i = 0; i < cliprdr->num_format_names; i++)
|
||||
{
|
||||
format_name = &cliprdr->format_names[i];
|
||||
|
||||
if (format_name->length > 0)
|
||||
xfree(format_name->name);
|
||||
}
|
||||
|
||||
xfree(cliprdr->format_names);
|
||||
cliprdr->format_names = NULL;
|
||||
}
|
||||
|
@ -263,6 +263,11 @@ static void cliprdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
|
||||
|
||||
static void cliprdr_process_terminate(rdpSvcPlugin* plugin)
|
||||
{
|
||||
cliprdrPlugin* cliprdr_plugin = (cliprdrPlugin*) plugin;
|
||||
|
||||
if (cliprdr_plugin->uniconv != NULL)
|
||||
freerdp_uniconv_free(cliprdr_plugin->uniconv);
|
||||
|
||||
xfree(plugin);
|
||||
}
|
||||
|
||||
|
@ -547,11 +547,7 @@ boolean xf_pre_connect(freerdp* instance)
|
||||
|
||||
xf_kbd_init(xfi);
|
||||
|
||||
xfi->clrconv = xnew(CLRCONV);
|
||||
xfi->clrconv->alpha = true;
|
||||
xfi->clrconv->invert = false;
|
||||
xfi->clrconv->rgb555 = false;
|
||||
xfi->clrconv->palette = xnew(rdpPalette);
|
||||
xfi->clrconv = freerdp_clrconv_new(CLRCONV_ALPHA);
|
||||
|
||||
instance->context->cache = cache_new(instance->settings);
|
||||
|
||||
@ -647,23 +643,7 @@ boolean xf_post_connect(freerdp* instance)
|
||||
xfi->srcBpp = instance->settings->color_depth;
|
||||
xf_gdi_register_update_callbacks(instance->update);
|
||||
|
||||
xfi->hdc = gdi_GetDC();
|
||||
xfi->hdc->bitsPerPixel = xfi->bpp;
|
||||
xfi->hdc->bytesPerPixel = xfi->bpp / 8;
|
||||
|
||||
xfi->hdc->alpha = xfi->clrconv->alpha;
|
||||
xfi->hdc->invert = xfi->clrconv->invert;
|
||||
xfi->hdc->rgb555 = xfi->clrconv->rgb555;
|
||||
|
||||
xfi->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
|
||||
xfi->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
|
||||
xfi->hdc->hwnd->invalid->null = 1;
|
||||
|
||||
xfi->hdc->hwnd->count = 32;
|
||||
xfi->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * xfi->hdc->hwnd->count);
|
||||
xfi->hdc->hwnd->ninvalid = 0;
|
||||
|
||||
xfi->primary_buffer = (uint8*) xzalloc(xfi->width * xfi->height * xfi->bpp);
|
||||
xfi->hdc = gdi_CreateDC(xfi->clrconv, xfi->bpp);
|
||||
|
||||
if (instance->settings->rfx_codec)
|
||||
{
|
||||
@ -884,6 +864,9 @@ void xf_window_free(xfInfo* xfi)
|
||||
XFreeGC(xfi->display, xfi->gc);
|
||||
xfi->gc = 0;
|
||||
|
||||
XFreeGC(xfi->display, xfi->gc_mono);
|
||||
xfi->gc_mono = 0;
|
||||
|
||||
if (xfi->window != NULL)
|
||||
{
|
||||
xf_DestroyWindow(xfi, xfi->window);
|
||||
@ -922,8 +905,9 @@ void xf_window_free(xfInfo* xfi)
|
||||
rfx_context_free(xfi->rfx_context);
|
||||
xfi->rfx_context = NULL;
|
||||
}
|
||||
|
||||
xfree(xfi->clrconv);
|
||||
|
||||
freerdp_clrconv_free(xfi->clrconv);
|
||||
gdi_DeleteDC(xfi->hdc);
|
||||
|
||||
xf_tsmf_uninit(xfi);
|
||||
xf_cliprdr_uninit(xfi);
|
||||
@ -932,7 +916,12 @@ void xf_window_free(xfInfo* xfi)
|
||||
void xf_free(xfInfo* xfi)
|
||||
{
|
||||
xf_window_free(xfi);
|
||||
|
||||
if (xfi->bmp_codec_none != NULL)
|
||||
xfree(xfi->bmp_codec_none);
|
||||
|
||||
XCloseDisplay(xfi->display);
|
||||
|
||||
xfree(xfi);
|
||||
}
|
||||
|
||||
@ -1073,7 +1062,7 @@ void* thread_func(void* param)
|
||||
if (g_thread_count < 1)
|
||||
freerdp_sem_signal(g_sem);
|
||||
|
||||
return NULL;
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
static uint8 exit_code_from_disconnect_reason(uint32 reason)
|
||||
|
@ -254,6 +254,9 @@ FREERDP_API uint32 freerdp_color_convert_bgr_rgb(uint32 srcColor, int srcBpp, in
|
||||
FREERDP_API uint32 freerdp_color_convert_var_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API uint32 freerdp_color_convert_var_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
|
||||
FREERDP_API HCLRCONV freerdp_clrconv_new(uint32 flags);
|
||||
FREERDP_API void freerdp_clrconv_free(HCLRCONV clrconv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <freerdp/gdi/gdi.h>
|
||||
|
||||
FREERDP_API HGDI_DC gdi_GetDC();
|
||||
FREERDP_API HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp);
|
||||
FREERDP_API HGDI_DC gdi_CreateCompatibleDC(HGDI_DC hdc);
|
||||
FREERDP_API HGDIOBJECT gdi_SelectObject(HGDI_DC hdc, HGDIOBJECT hgdiobject);
|
||||
FREERDP_API int gdi_DeleteObject(HGDIOBJECT hgdiobject);
|
||||
|
@ -274,7 +274,7 @@ void bitmap_cache_free(rdpBitmapCache* bitmap_cache)
|
||||
}
|
||||
|
||||
if (bitmap_cache->bitmap != NULL)
|
||||
bitmap_cache->bitmap->Free(bitmap_cache->context, bitmap_cache->bitmap);
|
||||
Bitmap_Free(bitmap_cache->context, bitmap_cache->bitmap);
|
||||
|
||||
xfree(bitmap_cache->cells);
|
||||
xfree(bitmap_cache);
|
||||
|
@ -86,6 +86,8 @@ void* brush_cache_get(rdpBrushCache* brush, uint32 index, uint32* bpp)
|
||||
|
||||
void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp)
|
||||
{
|
||||
void* prevEntry;
|
||||
|
||||
if (bpp == 1)
|
||||
{
|
||||
if (index > brush->maxMonoEntries)
|
||||
@ -94,6 +96,11 @@ void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp
|
||||
return;
|
||||
}
|
||||
|
||||
prevEntry = brush->monoEntries[index].entry;
|
||||
|
||||
if (prevEntry != NULL)
|
||||
xfree(prevEntry);
|
||||
|
||||
brush->monoEntries[index].bpp = bpp;
|
||||
brush->monoEntries[index].entry = entry;
|
||||
}
|
||||
@ -105,6 +112,11 @@ void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp
|
||||
return;
|
||||
}
|
||||
|
||||
prevEntry = brush->entries[index].entry;
|
||||
|
||||
if (prevEntry != NULL)
|
||||
xfree(prevEntry);
|
||||
|
||||
brush->entries[index].bpp = bpp;
|
||||
brush->entries[index].entry = entry;
|
||||
}
|
||||
@ -142,10 +154,32 @@ rdpBrushCache* brush_cache_new(rdpSettings* settings)
|
||||
|
||||
void brush_cache_free(rdpBrushCache* brush)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (brush != NULL)
|
||||
{
|
||||
xfree(brush->entries);
|
||||
xfree(brush->monoEntries);
|
||||
if (brush->entries != NULL)
|
||||
{
|
||||
for (i = 0; i < brush->maxEntries; i++)
|
||||
{
|
||||
if (brush->entries[i].entry != NULL)
|
||||
xfree(brush->entries[i].entry);
|
||||
}
|
||||
|
||||
xfree(brush->entries);
|
||||
}
|
||||
|
||||
if (brush->monoEntries != NULL)
|
||||
{
|
||||
for (i = 0; i < brush->maxMonoEntries; i++)
|
||||
{
|
||||
if (brush->monoEntries[i].entry != NULL)
|
||||
xfree(brush->monoEntries[i].entry);
|
||||
}
|
||||
|
||||
xfree(brush->monoEntries);
|
||||
}
|
||||
|
||||
xfree(brush);
|
||||
}
|
||||
}
|
||||
|
@ -318,6 +318,9 @@ void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph)
|
||||
Glyph_New(context, glyph);
|
||||
|
||||
glyph_cache_put(cache->glyph, cache_glyph->cacheId, glyph_data->cacheIndex, glyph);
|
||||
|
||||
cache_glyph->glyphData[i] = NULL;
|
||||
xfree(glyph_data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,6 +346,9 @@ void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_
|
||||
Glyph_New(context, glyph);
|
||||
|
||||
glyph_cache_put(cache->glyph, cache_glyph_v2->cacheId, glyph_data->cacheIndex, glyph);
|
||||
|
||||
cache_glyph_v2->glyphData[i] = NULL;
|
||||
xfree(glyph_data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -484,6 +490,7 @@ void glyph_cache_free(rdpGlyphCache* glyph_cache)
|
||||
rdpGlyph* glyph;
|
||||
|
||||
glyph = glyph_cache->glyphCache[i].entries[j];
|
||||
|
||||
if (glyph != NULL)
|
||||
{
|
||||
Glyph_Free(glyph_cache->context, glyph);
|
||||
|
@ -90,12 +90,19 @@ rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, uint32 index)
|
||||
|
||||
void pointer_cache_put(rdpPointerCache* pointer_cache, uint32 index, rdpPointer* pointer)
|
||||
{
|
||||
rdpPointer* prevPointer;
|
||||
|
||||
if (index >= pointer_cache->cacheSize)
|
||||
{
|
||||
printf("invalid pointer index:%d\n", index);
|
||||
return;
|
||||
}
|
||||
|
||||
prevPointer = pointer_cache->entries[index];
|
||||
|
||||
if (prevPointer != NULL)
|
||||
Pointer_Free(pointer_cache->update->context, prevPointer);
|
||||
|
||||
pointer_cache->entries[index] = pointer;
|
||||
}
|
||||
|
||||
@ -121,7 +128,7 @@ rdpPointerCache* pointer_cache_new(rdpSettings* settings)
|
||||
pointer_cache->settings = settings;
|
||||
pointer_cache->cacheSize = settings->pointer_cache_size;
|
||||
pointer_cache->update = ((freerdp*) settings->instance)->update;
|
||||
pointer_cache->entries = xzalloc(sizeof(rdpPointer**) * pointer_cache->cacheSize);
|
||||
pointer_cache->entries = (rdpPointer**) xzalloc(sizeof(rdpPointer*) * pointer_cache->cacheSize);
|
||||
}
|
||||
|
||||
return pointer_cache;
|
||||
@ -139,17 +146,7 @@ void pointer_cache_free(rdpPointerCache* pointer_cache)
|
||||
pointer = pointer_cache->entries[i];
|
||||
|
||||
if (pointer != NULL)
|
||||
{
|
||||
pointer->Free(pointer_cache->update->context, pointer);
|
||||
|
||||
if (pointer->xorMaskData != NULL)
|
||||
xfree(pointer->xorMaskData);
|
||||
|
||||
if (pointer->andMaskData != NULL)
|
||||
xfree(pointer->andMaskData);
|
||||
|
||||
xfree(pointer);
|
||||
}
|
||||
Pointer_Free(pointer_cache->update->context, pointer);
|
||||
}
|
||||
|
||||
xfree(pointer_cache->entries);
|
||||
|
@ -1036,3 +1036,26 @@ void freerdp_image_swap_color_order(uint8* data, int width, int height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HCLRCONV freerdp_clrconv_new(uint32 flags)
|
||||
{
|
||||
HCLRCONV clrconv = xnew(CLRCONV);
|
||||
|
||||
clrconv->alpha = (flags & CLRCONV_ALPHA) ? true : false;
|
||||
clrconv->invert = (flags & CLRCONV_INVERT) ? true : false;
|
||||
clrconv->rgb555 = (flags & CLRCONV_RGB555) ? true : false;
|
||||
clrconv->palette = xnew(rdpPalette);
|
||||
|
||||
return clrconv;
|
||||
}
|
||||
|
||||
void freerdp_clrconv_free(HCLRCONV clrconv)
|
||||
{
|
||||
if (clrconv != NULL)
|
||||
{
|
||||
if (clrconv->palette != NULL)
|
||||
xfree(clrconv->palette);
|
||||
|
||||
xfree(clrconv);
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
|
||||
int exponent_length;
|
||||
|
||||
s = stream_new(0);
|
||||
s->p = s->data = cert->data;
|
||||
stream_attach(s, cert->data, cert->length);
|
||||
|
||||
ber_read_sequence_tag(s, &length); /* Certificate (SEQUENCE) */
|
||||
|
||||
@ -195,6 +195,9 @@ void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
|
||||
stream_read(s, &info->exponent[4 - exponent_length], exponent_length);
|
||||
crypto_reverse(info->modulus.data, modulus_length);
|
||||
crypto_reverse(info->exponent, 4);
|
||||
|
||||
stream_detach(s);
|
||||
stream_free(s);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -224,16 +227,17 @@ void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_chain)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (x509_cert_chain == NULL)
|
||||
return;
|
||||
|
||||
for (i = 0; i < (int) x509_cert_chain->count; i++)
|
||||
if (x509_cert_chain != NULL)
|
||||
{
|
||||
if (x509_cert_chain->array[i].data != NULL)
|
||||
xfree(x509_cert_chain->array[i].data);
|
||||
}
|
||||
for (i = 0; i < (int) x509_cert_chain->count; i++)
|
||||
{
|
||||
if (x509_cert_chain->array[i].data != NULL)
|
||||
xfree(x509_cert_chain->array[i].data);
|
||||
}
|
||||
|
||||
xfree(x509_cert_chain);
|
||||
xfree(x509_cert_chain->array);
|
||||
xfree(x509_cert_chain);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean certificate_process_server_public_key(rdpCertificate* certificate, STREAM* s, uint32 length)
|
||||
@ -402,6 +406,7 @@ boolean certificate_read_server_x509_certificate_chain(rdpCertificate* certifica
|
||||
DEBUG_CERTIFICATE("License Server Certificate");
|
||||
certificate_read_x509_certificate(&certificate->x509_cert_chain->array[i], &cert_info);
|
||||
DEBUG_LICENSE("modulus length:%d", cert_info.modulus.length);
|
||||
freerdp_blob_free(&cert_info.modulus);
|
||||
}
|
||||
else if (numCertBlobs - i == 1)
|
||||
{
|
||||
@ -486,6 +491,10 @@ void certificate_free(rdpCertificate* certificate)
|
||||
if (certificate != NULL)
|
||||
{
|
||||
certificate_free_x509_certificate_chain(certificate->x509_cert_chain);
|
||||
|
||||
if (certificate->cert_info.modulus.data != NULL)
|
||||
freerdp_blob_free(&(certificate->cert_info.modulus));
|
||||
|
||||
xfree(certificate);
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ boolean rdp_client_connect(rdpRdp* rdp)
|
||||
|
||||
if ((selectedProtocol & PROTOCOL_TLS) || (selectedProtocol == PROTOCOL_RDP))
|
||||
{
|
||||
if ((settings->username != NULL) && ((settings->password != NULL) || (settings->password_cookie->length > 0)))
|
||||
if ((settings->username != NULL) && ((settings->password != NULL) || (settings->password_cookie != NULL && settings->password_cookie->length > 0)))
|
||||
settings->autologon = true;
|
||||
}
|
||||
|
||||
@ -149,36 +149,35 @@ boolean rdp_client_redirect(rdpRdp* rdp)
|
||||
if (redirection->flags & LB_TARGET_NET_ADDRESS)
|
||||
{
|
||||
xfree(settings->hostname);
|
||||
settings->hostname = redirection->targetNetAddress.ascii;
|
||||
settings->hostname = xstrdup(redirection->targetNetAddress.ascii);
|
||||
}
|
||||
else if (redirection->flags & LB_TARGET_FQDN)
|
||||
{
|
||||
xfree(settings->hostname);
|
||||
settings->hostname = redirection->targetFQDN.ascii;
|
||||
settings->hostname = xstrdup(redirection->targetFQDN.ascii);
|
||||
}
|
||||
else if (redirection->flags & LB_TARGET_NETBIOS_NAME)
|
||||
{
|
||||
xfree(settings->hostname);
|
||||
settings->hostname = redirection->targetNetBiosName.ascii;
|
||||
settings->hostname = xstrdup(redirection->targetNetBiosName.ascii);
|
||||
}
|
||||
}
|
||||
|
||||
if (redirection->flags & LB_USERNAME)
|
||||
{
|
||||
xfree(settings->username);
|
||||
settings->username = redirection->username.ascii;
|
||||
settings->username = xstrdup(redirection->username.ascii);
|
||||
}
|
||||
|
||||
if (redirection->flags & LB_DOMAIN)
|
||||
{
|
||||
xfree(settings->domain);
|
||||
settings->domain = redirection->domain.ascii;
|
||||
settings->domain = xstrdup(redirection->domain.ascii);
|
||||
}
|
||||
|
||||
if (redirection->flags & LB_PASSWORD)
|
||||
{
|
||||
freerdp_blob_free(settings->password_cookie);
|
||||
settings->password_cookie = redirection->password_cookie;
|
||||
settings->password_cookie = &redirection->password_cookie;
|
||||
}
|
||||
|
||||
return rdp_client_connect(rdp);
|
||||
|
@ -188,6 +188,7 @@ int credssp_authenticate(rdpCredssp* credssp)
|
||||
credssp->negoToken.length = stream_get_length(s);
|
||||
credssp_encrypt_public_key(credssp, &credssp->pubKeyAuth);
|
||||
credssp_send(credssp, &credssp->negoToken, NULL, &credssp->pubKeyAuth);
|
||||
freerdp_blob_free(&credssp->pubKeyAuth);
|
||||
|
||||
/* Encrypted Public Key +1 */
|
||||
if (credssp_recv(credssp, &credssp->negoToken, NULL, &credssp->pubKeyAuth) < 0)
|
||||
@ -206,6 +207,7 @@ int credssp_authenticate(rdpCredssp* credssp)
|
||||
credssp_encode_ts_credentials(credssp);
|
||||
credssp_encrypt_ts_credentials(credssp, &credssp->authInfo);
|
||||
credssp_send(credssp, NULL, &credssp->authInfo, NULL);
|
||||
freerdp_blob_free(&credssp->authInfo);
|
||||
|
||||
xfree(s);
|
||||
|
||||
@ -424,10 +426,11 @@ void credssp_encode_ts_credentials(rdpCredssp* credssp)
|
||||
s = stream_new(0);
|
||||
length = credssp_skip_ts_credentials(credssp);
|
||||
freerdp_blob_alloc(&credssp->ts_credentials, length);
|
||||
s->p = s->data = credssp->ts_credentials.data;
|
||||
s->size = length;
|
||||
stream_attach(s, credssp->ts_credentials.data, length);
|
||||
|
||||
credssp_write_ts_credentials(credssp, s);
|
||||
stream_detach(s);
|
||||
stream_free(s);
|
||||
}
|
||||
|
||||
int credssp_skip_nego_token(int length)
|
||||
@ -528,6 +531,7 @@ void credssp_send(rdpCredssp* credssp, rdpBlob* negoToken, rdpBlob* authInfo, rd
|
||||
}
|
||||
|
||||
transport_write(credssp->transport, s);
|
||||
stream_free(s);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,6 +187,10 @@ void freerdp_context_new(freerdp* instance)
|
||||
void freerdp_context_free(freerdp* instance)
|
||||
{
|
||||
IFCALL(instance->ContextFree, instance, instance->context);
|
||||
|
||||
rdp_free(instance->context->rdp);
|
||||
graphics_free(instance->context->graphics);
|
||||
xfree(instance->context);
|
||||
}
|
||||
|
||||
uint32 freerdp_error_info(freerdp* instance)
|
||||
@ -213,7 +217,7 @@ void freerdp_free(freerdp* freerdp)
|
||||
{
|
||||
if (freerdp)
|
||||
{
|
||||
rdp_free(freerdp->context->rdp);
|
||||
freerdp_context_free(freerdp);
|
||||
xfree(freerdp);
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,18 @@ void Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
|
||||
void Pointer_Free(rdpContext* context, rdpPointer* pointer)
|
||||
{
|
||||
if (pointer != NULL)
|
||||
{
|
||||
pointer->Free(context, pointer);
|
||||
|
||||
if (pointer->xorMaskData)
|
||||
xfree(pointer->xorMaskData);
|
||||
|
||||
if (pointer->andMaskData)
|
||||
xfree(pointer->andMaskData);
|
||||
|
||||
xfree(pointer);
|
||||
}
|
||||
}
|
||||
|
||||
/* static method */
|
||||
@ -207,6 +218,7 @@ void graphics_free(rdpGraphics* graphics)
|
||||
{
|
||||
xfree(graphics->Bitmap_Prototype);
|
||||
xfree(graphics->Pointer_Prototype);
|
||||
xfree(graphics->Glyph_Prototype);
|
||||
xfree(graphics);
|
||||
}
|
||||
}
|
||||
|
@ -477,6 +477,7 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
|
||||
uint16 cbAlternateShell;
|
||||
uint8* workingDir;
|
||||
uint16 cbWorkingDir;
|
||||
boolean usedPasswordCookie = false;
|
||||
|
||||
flags = INFO_MOUSE |
|
||||
INFO_UNICODE |
|
||||
@ -505,8 +506,9 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
|
||||
userName = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->username, &length);
|
||||
cbUserName = length;
|
||||
|
||||
if (settings->password_cookie->length > 0)
|
||||
if (settings->password_cookie && settings->password_cookie->length > 0)
|
||||
{
|
||||
usedPasswordCookie = true;
|
||||
password = (uint8*)settings->password_cookie->data;
|
||||
cbPassword = settings->password_cookie->length - 2;
|
||||
}
|
||||
@ -553,10 +555,12 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
|
||||
|
||||
xfree(domain);
|
||||
xfree(userName);
|
||||
xfree(password);
|
||||
xfree(alternateShell);
|
||||
xfree(workingDir);
|
||||
|
||||
if (!usedPasswordCookie)
|
||||
xfree(password);
|
||||
|
||||
if (settings->rdp_version >= 5)
|
||||
rdp_write_extended_info_packet(s, settings); /* extraInfo */
|
||||
}
|
||||
|
@ -832,6 +832,7 @@ void license_send_platform_challenge_response_packet(rdpLicense* license)
|
||||
buffer = (uint8*) xmalloc(HWID_LENGTH);
|
||||
rc4 = crypto_rc4_init(license->licensing_encryption_key, LICENSING_ENCRYPTION_KEY_LENGTH);
|
||||
crypto_rc4(rc4, HWID_LENGTH, license->hwid, buffer);
|
||||
crypto_rc4_free(rc4);
|
||||
|
||||
#ifdef WITH_DEBUG_LICENSE
|
||||
printf("Licensing Encryption Key:\n");
|
||||
|
@ -1239,15 +1239,17 @@ struct rdp_mppc* mppc_new(rdpRdp* rdp)
|
||||
{
|
||||
struct rdp_mppc* ptr;
|
||||
|
||||
ptr = (struct rdp_mppc *) xmalloc(sizeof (struct rdp_mppc));
|
||||
ptr = (struct rdp_mppc*) xmalloc(sizeof(struct rdp_mppc));
|
||||
|
||||
if (!ptr)
|
||||
{
|
||||
printf("mppc_new(): system out of memory\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr->history_buf = (uint8 *) xmalloc(RDP6_HISTORY_BUF_SIZE);
|
||||
ptr->offset_cache = (uint16 *) xzalloc(RDP6_OFFSET_CACHE_SIZE);
|
||||
ptr->history_buf = (uint8*) xmalloc(RDP6_HISTORY_BUF_SIZE);
|
||||
ptr->offset_cache = (uint16*) xzalloc(RDP6_OFFSET_CACHE_SIZE);
|
||||
|
||||
if (!ptr->history_buf)
|
||||
{
|
||||
printf("mppc_new(): system out of memory\n");
|
||||
@ -1257,6 +1259,7 @@ struct rdp_mppc* mppc_new(rdpRdp* rdp)
|
||||
|
||||
ptr->history_ptr = ptr->history_buf;
|
||||
ptr->history_buf_end = ptr->history_buf + RDP6_HISTORY_BUF_SIZE - 1;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -1279,5 +1282,11 @@ void mppc_free(rdpRdp* rdp)
|
||||
rdp->mppc->history_buf = NULL;
|
||||
rdp->mppc->history_ptr = NULL;
|
||||
}
|
||||
|
||||
if (rdp->mppc->offset_cache)
|
||||
{
|
||||
xfree(rdp->mppc->offset_cache);
|
||||
}
|
||||
|
||||
xfree(rdp->mppc);
|
||||
}
|
||||
|
@ -106,13 +106,12 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s)
|
||||
{
|
||||
uint32 passwordLength;
|
||||
stream_read_uint32(s, passwordLength);
|
||||
redirection->password_cookie = xnew(rdpBlob);
|
||||
freerdp_blob_alloc(redirection->password_cookie, passwordLength);
|
||||
stream_read(s, redirection->password_cookie->data, passwordLength);
|
||||
freerdp_blob_alloc(&redirection->password_cookie, passwordLength);
|
||||
stream_read(s, redirection->password_cookie.data, passwordLength);
|
||||
|
||||
#ifdef WITH_DEBUG_REDIR
|
||||
DEBUG_REDIR("password_cookie:");
|
||||
freerdp_hexdump(redirection->password_cookie->data, redirection->password_cookie->length);
|
||||
freerdp_hexdump(redirection->password_cookie.data, redirection->password_cookie.length);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -203,7 +202,7 @@ void redirection_free(rdpRedirection* redirection)
|
||||
freerdp_string_free(&redirection->tsvUrl);
|
||||
freerdp_string_free(&redirection->username);
|
||||
freerdp_string_free(&redirection->domain);
|
||||
freerdp_blob_free(redirection->password_cookie);
|
||||
freerdp_blob_free(&redirection->password_cookie);
|
||||
freerdp_string_free(&redirection->targetFQDN);
|
||||
freerdp_string_free(&redirection->targetNetBiosName);
|
||||
freerdp_string_free(&redirection->targetNetAddress);
|
||||
|
@ -50,7 +50,7 @@ struct rdp_redirection
|
||||
rdpString tsvUrl;
|
||||
rdpString username;
|
||||
rdpString domain;
|
||||
rdpBlob* password_cookie;
|
||||
rdpBlob password_cookie;
|
||||
rdpString targetFQDN;
|
||||
rdpBlob loadBalanceInfo;
|
||||
rdpString targetNetBiosName;
|
||||
|
@ -172,7 +172,6 @@ rdpSettings* settings_new(void* instance)
|
||||
settings->server_auto_reconnect_cookie = xnew(ARC_SC_PRIVATE_PACKET);
|
||||
|
||||
settings->client_time_zone = xnew(TIME_ZONE_INFO);
|
||||
settings->password_cookie = xnew(rdpBlob);
|
||||
settings->server_random = xnew(rdpBlob);
|
||||
settings->server_certificate = xnew(rdpBlob);
|
||||
|
||||
@ -190,8 +189,6 @@ void settings_free(rdpSettings* settings)
|
||||
xfree(settings->hostname);
|
||||
xfree(settings->username);
|
||||
xfree(settings->password);
|
||||
freerdp_blob_free(settings->password_cookie);
|
||||
xfree(settings->password_cookie);
|
||||
xfree(settings->domain);
|
||||
xfree(settings->shell);
|
||||
xfree(settings->directory);
|
||||
@ -212,6 +209,9 @@ void settings_free(rdpSettings* settings)
|
||||
xfree(settings->glyphCache);
|
||||
xfree(settings->fragCache);
|
||||
key_free(settings->server_key);
|
||||
xfree(settings->config_path);
|
||||
xfree(settings->current_path);
|
||||
xfree(settings->development_path);
|
||||
xfree(settings);
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/gdi/gdi.h>
|
||||
#include <freerdp/codec/color.h>
|
||||
|
||||
#include <freerdp/gdi/region.h>
|
||||
|
||||
@ -47,6 +48,39 @@ HGDI_DC gdi_GetDC()
|
||||
return hDC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a device context.\n
|
||||
* @msdn{dd144871}
|
||||
* @return new device context
|
||||
*/
|
||||
|
||||
HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp)
|
||||
{
|
||||
HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC));
|
||||
|
||||
hDC->drawMode = GDI_R2_BLACK;
|
||||
hDC->clip = gdi_CreateRectRgn(0, 0, 0, 0);
|
||||
hDC->clip->null = 1;
|
||||
hDC->hwnd = NULL;
|
||||
|
||||
hDC->bitsPerPixel = bpp;
|
||||
hDC->bytesPerPixel = bpp / 8;
|
||||
|
||||
hDC->alpha = clrconv->alpha;
|
||||
hDC->invert = clrconv->invert;
|
||||
hDC->rgb555 = clrconv->rgb555;
|
||||
|
||||
hDC->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
|
||||
hDC->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
|
||||
hDC->hwnd->invalid->null = 1;
|
||||
|
||||
hDC->hwnd->count = 32;
|
||||
hDC->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * hDC->hwnd->count);
|
||||
hDC->hwnd->ninvalid = 0;
|
||||
|
||||
return hDC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new device context compatible with the given device context.\n
|
||||
* @msdn{dd183489}
|
||||
@ -182,8 +216,12 @@ int gdi_DeleteDC(HGDI_DC hdc)
|
||||
{
|
||||
if (hdc->hwnd)
|
||||
{
|
||||
free(hdc->hwnd->cinvalid);
|
||||
free(hdc->hwnd->invalid);
|
||||
if (hdc->hwnd->cinvalid != NULL)
|
||||
free(hdc->hwnd->cinvalid);
|
||||
|
||||
if (hdc->hwnd->invalid != NULL)
|
||||
free(hdc->hwnd->invalid);
|
||||
|
||||
free(hdc->hwnd);
|
||||
}
|
||||
|
||||
|
@ -537,13 +537,18 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
|
||||
i = 0;
|
||||
while (index < argc && strcmp("--", argv[index]) != 0)
|
||||
{
|
||||
plugin_data = (RDP_PLUGIN_DATA*)xrealloc(plugin_data, sizeof(RDP_PLUGIN_DATA) * (i + 2));
|
||||
if (plugin_data == NULL)
|
||||
plugin_data = (RDP_PLUGIN_DATA*) xmalloc(sizeof(RDP_PLUGIN_DATA) * (i + 2));
|
||||
else
|
||||
plugin_data = (RDP_PLUGIN_DATA*) xrealloc(plugin_data, sizeof(RDP_PLUGIN_DATA) * (i + 2));
|
||||
|
||||
plugin_data[i].size = sizeof(RDP_PLUGIN_DATA);
|
||||
plugin_data[i].data[0] = NULL;
|
||||
plugin_data[i].data[1] = NULL;
|
||||
plugin_data[i].data[2] = NULL;
|
||||
plugin_data[i].data[3] = NULL;
|
||||
plugin_data[i + 1].size = 0;
|
||||
|
||||
for (j = 0, p = argv[index]; j < 4 && p != NULL; j++)
|
||||
{
|
||||
if (*p == '\'')
|
||||
|
@ -65,7 +65,12 @@ void stream_extend(STREAM* stream, int request_size)
|
||||
original_size = stream->size;
|
||||
increased_size = (request_size > original_size ? request_size : original_size);
|
||||
stream->size += increased_size;
|
||||
stream->data = (uint8*) xrealloc(stream->data, stream->size);
|
||||
|
||||
if (original_size == 0)
|
||||
stream->data = (uint8*) xmalloc(stream->size);
|
||||
else
|
||||
stream->data = (uint8*) xrealloc(stream->data, stream->size);
|
||||
|
||||
memset(stream->data + original_size, 0, increased_size);
|
||||
stream_set_pos(stream, pos);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user