From 3d98273185f3587d6b2a53ede176bbe8b63615f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sun, 7 Oct 2012 10:21:54 -0400 Subject: [PATCH] channels: fix export of symbols on Windows --- CMakeLists.txt | 13 ++++++++++++- channels/cliprdr/client/CMakeLists.txt | 4 ++++ channels/cliprdr/client/module.def | 3 +++ channels/disk/client/CMakeLists.txt | 7 +++++++ channels/disk/client/disk_file.c | 19 +++++++++++++------ channels/disk/client/module.def | 3 +++ channels/parallel/client/CMakeLists.txt | 1 + channels/printer/client/CMakeLists.txt | 1 + channels/rdpdr/client/CMakeLists.txt | 4 ++++ channels/rdpdr/client/module.def | 3 +++ channels/rdpdr/client/rdpdr_main.c | 3 ++- channels/rdpdr/client/rdpdr_main.h | 1 + channels/serial/client/CMakeLists.txt | 1 + channels/smartcard/client/CMakeLists.txt | 1 + client/Windows/CMakeLists.txt | 3 +-- 15 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 channels/cliprdr/client/module.def create mode 100644 channels/disk/client/module.def create mode 100644 channels/rdpdr/client/module.def diff --git a/CMakeLists.txt b/CMakeLists.txt index 28074ce7f..3b216c556 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,12 +173,23 @@ if(NOT WIN32) endif() endif() +if(WIN32) + set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}) + set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}) + set(CMAKE_INSTALL_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX}) +endif() + # Path to put FreeRDP data set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/freerdp") set(FREERDP_KEYMAP_PATH "${FREERDP_DATA_PATH}/keymaps") # Path to put plugins -set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp") +if(WIN32) + set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}") +else() + set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp") +endif() + set(FREERDP_CLIENT_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}/client") set(FREERDP_SERVER_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}/server") diff --git a/channels/cliprdr/client/CMakeLists.txt b/channels/cliprdr/client/CMakeLists.txt index c67038cd5..9716083cd 100644 --- a/channels/cliprdr/client/CMakeLists.txt +++ b/channels/cliprdr/client/CMakeLists.txt @@ -25,6 +25,10 @@ set(${MODULE_PREFIX}_SRCS cliprdr_main.c cliprdr_main.h) +if(MSVC AND (NOT WITH_STATIC_PLUGINS)) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) +endif() + add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") diff --git a/channels/cliprdr/client/module.def b/channels/cliprdr/client/module.def new file mode 100644 index 000000000..7336368ec --- /dev/null +++ b/channels/cliprdr/client/module.def @@ -0,0 +1,3 @@ +LIBRARY "cliprdr" +EXPORTS + VirtualChannelEntry @1 diff --git a/channels/disk/client/CMakeLists.txt b/channels/disk/client/CMakeLists.txt index 1282048a5..a2c9d6b01 100644 --- a/channels/disk/client/CMakeLists.txt +++ b/channels/disk/client/CMakeLists.txt @@ -30,6 +30,10 @@ if(WIN32) dirent.h) endif() +if(MSVC AND (NOT WITH_STATIC_PLUGINS)) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) +endif() + include_directories(../../rdpdr/client) add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -45,3 +49,6 @@ target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") + + diff --git a/channels/disk/client/disk_file.c b/channels/disk/client/disk_file.c index 48430a75b..efcb52d2c 100644 --- a/channels/disk/client/disk_file.c +++ b/channels/disk/client/disk_file.c @@ -38,6 +38,8 @@ #include #include +#include + #include #include #include @@ -112,7 +114,7 @@ static char* disk_file_combine_fullpath(const char* base_path, const char* path) { char* fullpath; - fullpath = xmalloc(strlen(base_path) + strlen(path) + 1); + fullpath = (char*) malloc(strlen(base_path) + strlen(path) + 1); strcpy(fullpath, base_path); strcat(fullpath, path); disk_file_fix_path(fullpath); @@ -123,9 +125,9 @@ static char* disk_file_combine_fullpath(const char* base_path, const char* path) static boolean disk_file_remove_dir(const char* path) { DIR* dir; - struct dirent* pdirent; - struct STAT st; char* p; + struct STAT st; + struct dirent* pdirent; boolean ret = true; dir = opendir(path); @@ -143,8 +145,9 @@ static boolean disk_file_remove_dir(const char* path) continue; } - p = xmalloc(strlen(path) + strlen(pdirent->d_name) + 2); + p = (char*) malloc(strlen(path) + strlen(pdirent->d_name) + 2); sprintf(p, "%s/%s", path, pdirent->d_name); + if (STAT(p, &st) != 0) { DEBUG_WARN("stat %s failed.", p); @@ -160,8 +163,11 @@ static boolean disk_file_remove_dir(const char* path) ret = false; } else + { ret = true; - xfree(p); + } + + free(p); if (!ret) break; @@ -170,6 +176,7 @@ static boolean disk_file_remove_dir(const char* path) } closedir(dir); + if (ret) { if (rmdir(path) < 0) @@ -559,7 +566,7 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui xfree(file->pattern); if (path[0]) - file->pattern = strdup(strrchr(path, '\\') + 1); + file->pattern = _strdup(strrchr(path, '\\') + 1); else file->pattern = NULL; } diff --git a/channels/disk/client/module.def b/channels/disk/client/module.def new file mode 100644 index 000000000..dd2815569 --- /dev/null +++ b/channels/disk/client/module.def @@ -0,0 +1,3 @@ +LIBRARY "disk" +EXPORTS + DeviceServiceEntry @1 diff --git a/channels/parallel/client/CMakeLists.txt b/channels/parallel/client/CMakeLists.txt index 8ef794dc2..70d08bfe8 100644 --- a/channels/parallel/client/CMakeLists.txt +++ b/channels/parallel/client/CMakeLists.txt @@ -35,3 +35,4 @@ endif() install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/printer/client/CMakeLists.txt b/channels/printer/client/CMakeLists.txt index 80eaac1c1..b4174cf64 100644 --- a/channels/printer/client/CMakeLists.txt +++ b/channels/printer/client/CMakeLists.txt @@ -55,3 +55,4 @@ endif() install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/rdpdr/client/CMakeLists.txt b/channels/rdpdr/client/CMakeLists.txt index bbff041b4..18856aad8 100644 --- a/channels/rdpdr/client/CMakeLists.txt +++ b/channels/rdpdr/client/CMakeLists.txt @@ -30,6 +30,10 @@ set(${MODULE_PREFIX}_SRCS rdpdr_main.c rdpdr_main.h) +if(MSVC AND (NOT WITH_STATIC_PLUGINS)) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) +endif() + add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") diff --git a/channels/rdpdr/client/module.def b/channels/rdpdr/client/module.def new file mode 100644 index 000000000..0954fbe47 --- /dev/null +++ b/channels/rdpdr/client/module.def @@ -0,0 +1,3 @@ +LIBRARY "rdpdr" +EXPORTS + VirtualChannelEntry @1 diff --git a/channels/rdpdr/client/rdpdr_main.c b/channels/rdpdr/client/rdpdr_main.c index e38048ae4..188999a0e 100644 --- a/channels/rdpdr/client/rdpdr_main.c +++ b/channels/rdpdr/client/rdpdr_main.c @@ -26,8 +26,8 @@ #include #include -#include #include +#include #include #include #include @@ -63,6 +63,7 @@ static void rdpdr_process_connect(rdpSvcPlugin* plugin) { devman_load_device_service(rdpdr->devman, data); } + data = (RDP_PLUGIN_DATA*) (((uint8*) data) + data->size); } } diff --git a/channels/rdpdr/client/rdpdr_main.h b/channels/rdpdr/client/rdpdr_main.h index af867fbf5..23d58bfce 100644 --- a/channels/rdpdr/client/rdpdr_main.h +++ b/channels/rdpdr/client/rdpdr_main.h @@ -26,6 +26,7 @@ #include "rdpdr_types.h" typedef struct rdpdr_plugin rdpdrPlugin; + struct rdpdr_plugin { rdpSvcPlugin plugin; diff --git a/channels/serial/client/CMakeLists.txt b/channels/serial/client/CMakeLists.txt index 6bfb3b033..fcd3039c0 100644 --- a/channels/serial/client/CMakeLists.txt +++ b/channels/serial/client/CMakeLists.txt @@ -37,3 +37,4 @@ endif() install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/smartcard/client/CMakeLists.txt b/channels/smartcard/client/CMakeLists.txt index 3cd2573d4..239bbe69f 100644 --- a/channels/smartcard/client/CMakeLists.txt +++ b/channels/smartcard/client/CMakeLists.txt @@ -38,3 +38,4 @@ target_link_libraries(${MODULE_NAME} ${PCSC_LIBRARIES}) install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/client/Windows/CMakeLists.txt b/client/Windows/CMakeLists.txt index 8f3a921e5..ae8f5b298 100644 --- a/client/Windows/CMakeLists.txt +++ b/client/Windows/CMakeLists.txt @@ -39,7 +39,7 @@ add_executable(${MODULE_NAME} WIN32 ${${MODULE_PREFIX}_SRCS}) if(WITH_MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp) - if(WITH_RDPDR) + if(WITH_RDPDR AND WITH_STATIC_PLUGINS) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} rdpdr disk printer) endif() else() @@ -55,4 +55,3 @@ target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Windows") -