From 82ea77158c5e9147aff3ce979f34d35458081d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Fri, 21 Oct 2011 16:45:35 -0400 Subject: [PATCH] wfreerdp: fix compilation on windows --- client/Windows/CMakeLists.txt | 2 + client/Windows/wf_event.h | 2 +- client/Windows/wf_gdi.c | 99 +------------- client/Windows/wf_gdi.h | 2 +- client/Windows/wf_graphics.c | 226 ++++++++++++++++++++++++++++++++ client/Windows/wf_graphics.h | 31 +++++ client/Windows/wfreerdp.c | 113 +++------------- client/Windows/wfreerdp.h | 9 +- libfreerdp-cache/CMakeLists.txt | 1 + libfreerdp-gdi/CMakeLists.txt | 1 + libfreerdp-utils/pcap.c | 23 +++- 11 files changed, 316 insertions(+), 193 deletions(-) create mode 100644 client/Windows/wf_graphics.c create mode 100644 client/Windows/wf_graphics.h diff --git a/client/Windows/CMakeLists.txt b/client/Windows/CMakeLists.txt index f4612c1f0..68b46713f 100644 --- a/client/Windows/CMakeLists.txt +++ b/client/Windows/CMakeLists.txt @@ -22,6 +22,8 @@ add_executable(wfreerdp WIN32 wf_gdi.h wf_event.c wf_event.h + wf_graphics.c + wf_graphics.h wfreerdp.c wfreerdp.h) diff --git a/client/Windows/wf_event.h b/client/Windows/wf_event.h index 7924e4e8b..57ada3f9c 100644 --- a/client/Windows/wf_event.h +++ b/client/Windows/wf_event.h @@ -33,4 +33,4 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam #define DEBUG_KBD(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__) #endif -#endif +#endif /* __WF_EVENT_H */ diff --git a/client/Windows/wf_gdi.c b/client/Windows/wf_gdi.c index 80121af02..58d60b6f9 100644 --- a/client/Windows/wf_gdi.c +++ b/client/Windows/wf_gdi.c @@ -27,8 +27,10 @@ #include #include #include +#include #include "wfreerdp.h" +#include "wf_graphics.h" const uint8 wf_rop2_table[] = { @@ -63,72 +65,6 @@ boolean wf_set_rop2(HDC hdc, int rop2) return True; } -HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, uint8* data) -{ - HDC hdc; - int negHeight; - HBITMAP bitmap; - BITMAPINFO bmi; - uint8* cdata = NULL; - - /** - * See: http://msdn.microsoft.com/en-us/library/dd183376 - * if biHeight is positive, the bitmap is bottom-up - * if biHeight is negative, the bitmap is top-down - * Since we get top-down bitmaps, let's keep it that way - */ - - negHeight = (height < 0) ? height : height * (-1); - - hdc = GetDC(NULL); - bmi.bmiHeader.biSize = sizeof(BITMAPINFO); - bmi.bmiHeader.biWidth = width; - bmi.bmiHeader.biHeight = negHeight; - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 24; - bmi.bmiHeader.biCompression = BI_RGB; - bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &cdata, NULL, 0); - - if (data != NULL) - freerdp_image_convert(data, cdata, width, height, bpp, 24, wfi->clrconv); - - ReleaseDC(NULL, hdc); - GdiFlush(); - - return bitmap; -} - -wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, uint8* data) -{ - HDC hdc; - wfBitmap* image; - - hdc = GetDC(NULL); - image = (wfBitmap*) malloc(sizeof(wfBitmap)); - image->hdc = CreateCompatibleDC(hdc); - - if (data == NULL) - image->bitmap = CreateCompatibleBitmap(hdc, width, height); - else - image->bitmap = wf_create_dib(wfi, width, height, bpp, data); - - image->org_bitmap = (HBITMAP) SelectObject(image->hdc, image->bitmap); - ReleaseDC(NULL, hdc); - - return image; -} - -void wf_image_free(wfBitmap* image) -{ - if (image != 0) - { - SelectObject(image->hdc, image->org_bitmap); - DeleteObject(image->bitmap); - DeleteDC(image->hdc); - free(image); - } -} - wfBitmap* wf_glyph_new(wfInfo* wfi, GLYPH_DATA* glyph) { wfBitmap* glyph_bmp; @@ -160,6 +96,7 @@ void wf_toggle_fullscreen(wfInfo* wfi) SetForegroundWindow(wfi->hwnd); } +#if 0 void wf_gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap) { int i; @@ -183,6 +120,7 @@ void wf_gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap) wf_image_free(wf_bmp); } } +#endif void wf_gdi_palette_update(rdpUpdate* update, PALETTE_UPDATE* palette) { @@ -369,35 +307,8 @@ void wf_gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_c } -void wf_gdi_bitmap_decompress(rdpUpdate* update, rdpBitmap* bitmap_data) -{ - uint16 dstSize; - - dstSize = bitmap_data->width * bitmap_data->height * (bitmap_data->bpp / 8); - - if (bitmap_data->dstData == NULL) - bitmap_data->dstData = (uint8*) xmalloc(dstSize); - else - bitmap_data->dstData = (uint8*) xrealloc(bitmap_data->dstData, dstSize); - - if (bitmap_data->compressed) - { - bitmap_decompress(bitmap_data->srcData, bitmap_data->dstData, - bitmap_data->width, bitmap_data->height, bitmap_data->length, - bitmap_data->bpp, bitmap_data->bpp); - } - else - { - freerdp_image_flip(bitmap_data->srcData, bitmap_data->dstData, - bitmap_data->width, bitmap_data->height, bitmap_data->bpp); - } - - bitmap_data->compressed = False; -} - void wf_gdi_register_update_callbacks(rdpUpdate* update) { - update->BitmapUpdate = wf_gdi_bitmap_update; update->Palette = wf_gdi_palette_update; update->SetBounds = wf_gdi_set_bounds; update->DstBlt = wf_gdi_dstblt; @@ -429,6 +340,4 @@ void wf_gdi_register_update_callbacks(rdpUpdate* update) update->CacheBrush = wf_gdi_cache_brush; update->SurfaceBits = wf_gdi_surface_bits; - - update->BitmapDecompress = wf_gdi_bitmap_decompress; } diff --git a/client/Windows/wf_gdi.h b/client/Windows/wf_gdi.h index c6a9d01d2..df35f6d99 100644 --- a/client/Windows/wf_gdi.h +++ b/client/Windows/wf_gdi.h @@ -24,7 +24,7 @@ #include "wfreerdp.h" -HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, uint8* data); +void wf_invalidate_region(wfInfo* wfi, int x, int y, int width, int height); wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, uint8* data); void wf_image_free(wfBitmap* image); void wf_toggle_fullscreen(wfInfo* wfi); diff --git a/client/Windows/wf_graphics.c b/client/Windows/wf_graphics.c new file mode 100644 index 000000000..862f0022c --- /dev/null +++ b/client/Windows/wf_graphics.c @@ -0,0 +1,226 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * Windows Graphical Objects + * + * Copyright 2010-2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "wf_gdi.h" +#include "wf_graphics.h" + +HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, uint8* data) +{ + HDC hdc; + int negHeight; + HBITMAP bitmap; + BITMAPINFO bmi; + uint8* cdata = NULL; + + /** + * See: http://msdn.microsoft.com/en-us/library/dd183376 + * if biHeight is positive, the bitmap is bottom-up + * if biHeight is negative, the bitmap is top-down + * Since we get top-down bitmaps, let's keep it that way + */ + + negHeight = (height < 0) ? height : height * (-1); + + hdc = GetDC(NULL); + bmi.bmiHeader.biSize = sizeof(BITMAPINFO); + bmi.bmiHeader.biWidth = width; + bmi.bmiHeader.biHeight = negHeight; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 24; + bmi.bmiHeader.biCompression = BI_RGB; + bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &cdata, NULL, 0); + + if (data != NULL) + freerdp_image_convert(data, cdata, width, height, bpp, 24, wfi->clrconv); + + ReleaseDC(NULL, hdc); + GdiFlush(); + + return bitmap; +} + +wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, uint8* data) +{ + HDC hdc; + wfBitmap* image; + + hdc = GetDC(NULL); + image = (wfBitmap*) malloc(sizeof(wfBitmap)); + image->hdc = CreateCompatibleDC(hdc); + + if (data == NULL) + image->bitmap = CreateCompatibleBitmap(hdc, width, height); + else + image->bitmap = wf_create_dib(wfi, width, height, bpp, data); + + image->org_bitmap = (HBITMAP) SelectObject(image->hdc, image->bitmap); + ReleaseDC(NULL, hdc); + + return image; +} + +void wf_image_free(wfBitmap* image) +{ + if (image != 0) + { + SelectObject(image->hdc, image->org_bitmap); + DeleteObject(image->bitmap); + DeleteDC(image->hdc); + free(image); + } +} + +/* Bitmap Class */ + +void wf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap) +{ + HDC hdc; + wfBitmap* wf_bitmap = (wfBitmap*) bitmap; + wfInfo* wfi = ((wfContext*) context)->wfi; + + if (bitmap->ephemeral) + return; + + hdc = GetDC(NULL); + wf_bitmap = (wfBitmap*) bitmap; + wf_bitmap->hdc = CreateCompatibleDC(hdc); + + if (bitmap->data == NULL) + wf_bitmap->bitmap = CreateCompatibleBitmap(hdc, bitmap->width, bitmap->height); + else + wf_bitmap->bitmap = wf_create_dib(wfi, bitmap->width, bitmap->height, bitmap->bpp, bitmap->data); + + wf_bitmap->org_bitmap = (HBITMAP) SelectObject(wf_bitmap->hdc, wf_bitmap->bitmap); + ReleaseDC(NULL, hdc); +} + +void wf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap) +{ + wfBitmap* wf_bitmap = (wfBitmap*) bitmap; + + if (wf_bitmap != 0) + { + SelectObject(wf_bitmap->hdc, wf_bitmap->org_bitmap); + DeleteObject(wf_bitmap->bitmap); + DeleteDC(wf_bitmap->hdc); + } +} + +void wf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap) +{ + int width, height; + wfBitmap* wf_bitmap = (wfBitmap*) bitmap; + wfInfo* wfi = ((wfContext*) context)->wfi; + + width = bitmap->right - bitmap->left + 1; + height = bitmap->bottom - bitmap->top + 1; + + BitBlt(wfi->primary->hdc, bitmap->left, bitmap->top, + width, height, wf_bitmap->hdc, 0, 0, GDI_SRCCOPY); + + wf_invalidate_region(wfi, bitmap->left, bitmap->top, width, height); +} + +void wf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, + uint8* data, int width, int height, int bpp, int length, boolean compressed) +{ + uint16 size; + + size = width * height * (bpp / 8); + + if (bitmap->data == NULL) + bitmap->data = (uint8*) xmalloc(size); + else + bitmap->data = (uint8*) xrealloc(bitmap->data, size); + + if (bitmap->compressed) + { + boolean status; + + status = bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp); + + if (status != True) + { + printf("Bitmap Decompression Failed\n"); + } + } + else + { + freerdp_image_flip(data, bitmap->data, width, height, bpp); + } + + bitmap->compressed = False; + bitmap->length = size; + bitmap->bpp = bpp; +} + +void wf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, boolean primary) +{ + wfInfo* wfi = ((wfContext*) context)->wfi; + + if (primary) + wfi->drawing = wfi->primary; + else + wfi->drawing = (wfBitmap*) bitmap; +} + +/* Pointer Class */ + +void wf_Pointer_New(rdpContext* context, rdpPointer* pointer) +{ + +} + +void wf_Pointer_Free(rdpContext* context, rdpPointer* pointer) +{ + +} + +void wf_Pointer_Set(rdpContext* context, rdpPointer* pointer) +{ + +} + +/* Graphics Module */ + +void wf_register_graphics(rdpGraphics* graphics) +{ + rdpBitmap bitmap; + rdpPointer pointer; + + memset(&bitmap, 0, sizeof(rdpBitmap)); + bitmap.size = sizeof(wfBitmap); + bitmap.New = wf_Bitmap_New; + bitmap.Free = wf_Bitmap_Free; + bitmap.Paint = wf_Bitmap_Paint; + bitmap.Decompress = wf_Bitmap_Decompress; + bitmap.SetSurface = wf_Bitmap_SetSurface; + + memset(&pointer, 0, sizeof(rdpPointer)); + pointer.size = sizeof(wfPointer); + pointer.New = wf_Pointer_New; + pointer.Free = wf_Pointer_Free; + pointer.Set = wf_Pointer_Set; + + graphics_register_bitmap(graphics, &bitmap); + graphics_register_pointer(graphics, &pointer); +} diff --git a/client/Windows/wf_graphics.h b/client/Windows/wf_graphics.h new file mode 100644 index 000000000..65f03b260 --- /dev/null +++ b/client/Windows/wf_graphics.h @@ -0,0 +1,31 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * Windows Graphical Objects + * + * Copyright 2010-2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __WF_GRAPHICS_H +#define __WF_GRAPHICS_H + +#include "wfreerdp.h" + +HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, uint8* data); +wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, uint8* data); +void wf_image_free(wfBitmap* image); + +void wf_register_graphics(rdpGraphics* graphics); + +#endif /* WF_GRAPHICS */ diff --git a/client/Windows/wfreerdp.c b/client/Windows/wfreerdp.c index 270eb7ef2..8e266b87c 100644 --- a/client/Windows/wfreerdp.c +++ b/client/Windows/wfreerdp.c @@ -28,9 +28,11 @@ #include #include #include +#include #include #include "wf_gdi.h" +#include "wf_graphics.h" #include "wfreerdp.h" @@ -46,21 +48,14 @@ HCURSOR g_default_cursor; volatile int g_thread_count = 0; LPCTSTR g_wnd_class_name = L"wfreerdp"; -void wf_context_size(freerdp* instance, uint32* size) +void wf_context_new(freerdp* instance, rdpContext* context) { - *size = sizeof(wfContext); -} - -void wf_context_new(freerdp* instance, wfContext* context) -{ - rdpContext* _context = (rdpContext*) &context->_p; - context->channels = freerdp_channels_new(); } -void wf_context_free(freerdp* instance, wfContext* context) +void wf_context_free(freerdp* instance, rdpContext* context) { - rdpContext* _context = (rdpContext*) &context->_p; + } int wf_create_console(void) @@ -129,69 +124,6 @@ void wf_hw_end_paint(rdpUpdate* update) } -void wf_bitmap_size(rdpUpdate* update, uint32* size) -{ - *size = sizeof(wfBitmap); -} - -void wf_bitmap_new(rdpUpdate* update, wfBitmap* bitmap) -{ - HDC hdc; - uint8* data; - rdpBitmap* _bitmap; - wfInfo* wfi = ((wfContext*) update->context)->wfi; - - hdc = GetDC(NULL); - bitmap->hdc = CreateCompatibleDC(hdc); - - _bitmap = &(bitmap->_p); - data = _bitmap->dstData; - - if (data == NULL) - bitmap->bitmap = CreateCompatibleBitmap(hdc, _bitmap->width, _bitmap->height); - else - bitmap->bitmap = wf_create_dib(wfi, _bitmap->width, _bitmap->height, _bitmap->bpp, data); - - bitmap->org_bitmap = (HBITMAP) SelectObject(bitmap->hdc, bitmap->bitmap); - ReleaseDC(NULL, hdc); -} - -void wf_offscreen_bitmap_new(rdpUpdate* update, wfBitmap* bitmap) -{ - HDC hdc; - rdpBitmap* _bitmap; - wfInfo* wfi = ((wfContext*) update->context)->wfi; - - hdc = GetDC(NULL); - bitmap->hdc = CreateCompatibleDC(hdc); - - _bitmap = &(bitmap->_p); - bitmap->bitmap = CreateCompatibleBitmap(hdc, _bitmap->width, _bitmap->height); - - bitmap->org_bitmap = (HBITMAP) SelectObject(bitmap->hdc, bitmap->bitmap); - ReleaseDC(NULL, hdc); -} - -void wf_set_surface(rdpUpdate* update, wfBitmap* bitmap, boolean primary) -{ - wfInfo* wfi = ((wfContext*) update->context)->wfi; - - if (primary) - wfi->drawing = wfi->primary; - else - wfi->drawing = bitmap; -} - -void wf_bitmap_free(rdpUpdate* update, wfBitmap* bitmap) -{ - if (bitmap != 0) - { - SelectObject(bitmap->hdc, bitmap->org_bitmap); - DeleteObject(bitmap->bitmap); - DeleteDC(bitmap->hdc); - } -} - boolean wf_pre_connect(freerdp* instance) { int i1; @@ -268,7 +200,7 @@ boolean wf_pre_connect(freerdp* instance) } settings->kbd_layout = (int) GetKeyboardLayout(0) & 0x0000FFFF; - freerdp_channels_pre_connect(context->channels, instance); + freerdp_channels_pre_connect(instance->context->channels, instance); return True; } @@ -292,6 +224,8 @@ boolean wf_post_connect(freerdp* instance) width = settings->width; height = settings->height; + wf_register_graphics(instance->context->graphics); + if (wfi->sw_gdi) { gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, NULL); @@ -373,21 +307,16 @@ boolean wf_post_connect(freerdp* instance) instance->update->EndPaint = wf_hw_end_paint; } + pointer_cache_register_callbacks(instance->update); + if (wfi->sw_gdi != True) { + brush_cache_register_callbacks(instance->update); bitmap_cache_register_callbacks(instance->update); - cache->bitmap->BitmapSize = (cbBitmapSize) wf_bitmap_size; - cache->bitmap->BitmapNew = (cbBitmapNew) wf_bitmap_new; - cache->bitmap->BitmapFree = (cbBitmapFree) wf_bitmap_free; - offscreen_cache_register_callbacks(instance->update); - cache->offscreen->BitmapSize = (cbBitmapSize) wf_bitmap_size; - cache->offscreen->BitmapNew = (cbBitmapNew) wf_offscreen_bitmap_new; - cache->offscreen->BitmapFree = (cbBitmapFree) wf_bitmap_free; - cache->offscreen->SetSurface = (cbSetSurface) wf_set_surface; } - freerdp_channels_post_connect(context->channels, instance); + freerdp_channels_post_connect(instance->context->channels, instance); return True; } @@ -433,7 +362,7 @@ int wf_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_D return 1; } -int wf_process_ui_args(rdpSettings* settings, const char* opt, const char* val, void* user_data) +int wf_process_client_args(rdpSettings* settings, const char* opt, const char* val, void* user_data) { return 0; } @@ -458,7 +387,7 @@ int wfreerdp_run(freerdp* instance) if (freerdp_connect(instance) != True) return 0; - channels = ((wfContext*) instance->context)->channels; + channels = instance->context->channels; /* program main loop */ while (1) @@ -608,8 +537,6 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine thread_data* data; WSADATA wsa_data; WNDCLASSEX wnd_cls; - wfContext* context; - rdpChannels* channels; if (WSAStartup(0x101, &wsa_data) != 0) return 1; @@ -645,13 +572,13 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine instance->VerifyCertificate = wf_verify_certificate; instance->ReceiveChannelData = wf_receive_channel_data; - instance->ContextSize = (pContextSize) wf_context_size; - instance->ContextNew = (pcContextNew) wf_context_new; - instance->ContextFree = (pcContextFree) wf_context_free; + instance->context_size = sizeof(wfContext); + instance->ContextNew = wf_context_new; + instance->ContextFree = wf_context_free; freerdp_context_new(instance); - context = (wfContext*) instance->context; - channels = context->channels; + instance->context->argc = __argc; + instance->context->argv = __argv; if (!CreateThread(NULL, 0, kbd_thread_func, NULL, 0, NULL)) printf("error creating keyboard handler thread"); @@ -662,7 +589,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine data->instance = instance; freerdp_parse_args(instance->settings, __argc, __argv, - wf_process_plugin_args, channels, wf_process_ui_args, NULL); + wf_process_plugin_args, instance->context->channels, wf_process_client_args, NULL); if (CreateThread(NULL, 0, thread_func, data, 0, NULL) != 0) g_thread_count++; diff --git a/client/Windows/wfreerdp.h b/client/Windows/wfreerdp.h index bcd29df3f..5d6eeaced 100644 --- a/client/Windows/wfreerdp.h +++ b/client/Windows/wfreerdp.h @@ -42,13 +42,19 @@ struct wf_bitmap { - rdpBitmap _p; + rdpBitmap _bitmap; HDC hdc; HBITMAP bitmap; HBITMAP org_bitmap; }; typedef struct wf_bitmap wfBitmap; +struct wf_pointer +{ + rdpPointer pointer; +}; +typedef struct wf_pointer wfPointer; + typedef struct wf_info wfInfo; struct wf_context @@ -56,7 +62,6 @@ struct wf_context rdpContext _p; wfInfo* wfi; - rdpChannels* channels; }; typedef struct wf_context wfContext; diff --git a/libfreerdp-cache/CMakeLists.txt b/libfreerdp-cache/CMakeLists.txt index ac9464a7c..1b0918c82 100644 --- a/libfreerdp-cache/CMakeLists.txt +++ b/libfreerdp-cache/CMakeLists.txt @@ -30,6 +30,7 @@ add_library(freerdp-cache ${FREERDP_CACHE_SRCS}) set_target_properties(freerdp-cache PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") +target_link_libraries(freerdp-cache freerdp-core) target_link_libraries(freerdp-cache freerdp-utils) install(TARGETS freerdp-cache DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/libfreerdp-gdi/CMakeLists.txt b/libfreerdp-gdi/CMakeLists.txt index b6c9d3a38..599134821 100644 --- a/libfreerdp-gdi/CMakeLists.txt +++ b/libfreerdp-gdi/CMakeLists.txt @@ -38,6 +38,7 @@ set(FREERDP_GDI_SRCS add_library(freerdp-gdi ${FREERDP_GDI_SRCS}) +target_link_libraries(freerdp-gdi freerdp-core) target_link_libraries(freerdp-gdi freerdp-cache) target_link_libraries(freerdp-gdi freerdp-codec) diff --git a/libfreerdp-utils/pcap.c b/libfreerdp-utils/pcap.c index 96a43495c..152e93c85 100644 --- a/libfreerdp-utils/pcap.c +++ b/libfreerdp-utils/pcap.c @@ -17,10 +17,31 @@ * limitations under the License. */ -#include #include #include +#ifndef _WIN32 +#include +#else +#include +#include + +struct timeval +{ + long tv_sec; + long tv_usec; +}; + +int gettimeofday(struct timeval* tp, void* tz) +{ + struct _timeb timebuffer; + _ftime (&timebuffer); + tp->tv_sec = (long) timebuffer.time; + tp->tv_usec = timebuffer.millitm * 1000; + return 0; +} +#endif + #include #include