wfreerdp-server: manual merge

This commit is contained in:
Corey C
2012-10-02 20:03:32 -04:00
390 changed files with 18149 additions and 3687 deletions

9
.gitignore vendored
View File

@@ -6,9 +6,11 @@ install_manifest.txt
CTestTestfile.cmake
freerdp.pc
Makefile
Testing
cmake_install.cmake
CPackConfig.cmake
CPackSourceConfig.cmake
DartConfiguration.tcl
# Eclipse
*.project
@@ -25,9 +27,12 @@ client/X11/xfreerdp.1
# Windows
*.vcxproj
*.vcxproj.*
*.vcproj
*.vcproj.*
*.sdf
*.sln
*.suo
*.ncb
*.opensdf
ipch
Debug
@@ -41,9 +46,9 @@ RelWithDebInfo
cunit/test_freerdp
client/X11/xfreerdp
client/Mac/xcode
client/test/freerdp-test
client/Sample/sfreerdp
client/DirectFB/dfreerdp
server/test/tfreerdp-server
server/Sample/sfreerdp-server
server/X11/xfreerdp-server
xcode

View File

@@ -41,14 +41,17 @@ include(GNUInstallDirsWrapper)
# Soname versioning
set(FREERDP_VERSION_MAJOR "1")
set(FREERDP_VERSION_MINOR "0")
set(FREERDP_VERSION_REVISION "1")
set(FREERDP_VERSION_MINOR "1")
set(FREERDP_VERSION_REVISION "0")
set(FREERDP_VERSION "${FREERDP_VERSION_MAJOR}.${FREERDP_VERSION_MINOR}")
set(FREERDP_VERSION_FULL "${FREERDP_VERSION}.${FREERDP_VERSION_REVISION}")
include(GetGitRevisionDescription)
git_describe(GIT_REVISION --match "[0-9]*" --abbrev=4 --tags --always)
message(STATUS "Git Revision ${GIT_REVISION}")
# Turn on solution folders (2.8.4+)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Default to release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
@@ -59,6 +62,24 @@ if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
if(NOT BUILD_SHARED_LIBS AND WITH_MONOLITHIC_BUILD)
set(WITH_STATIC_PLUGINS ON)
endif()
# Configure MSVC Runtime
if(MSVC)
include(MSVCRuntime)
if(NOT DEFINED MSVC_RUNTIME)
set(MSVC_RUNTIME "dynamic")
endif()
if(${MSVC_RUNTIME} STREQUAL "static")
message(STATUS "Use the MSVC static runtime option carefully!")
message(STATUS "OpenSSL uses /MD by default, and is very picky")
message(STATUS "Random freeing errors are a common sign of runtime issues")
endif()
configure_msvc_runtime()
endif()
# Compiler-specific flags
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
@@ -99,23 +120,6 @@ if(MSVC)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
endif()
# This forces the MSVC runtime to be statically linked
if(WITH_MSVC_STATIC)
foreach(flag_var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
endforeach(flag_var)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "MSVC C Debug MT flags " FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "MSVC CXX Debug MT flags " FORCE)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "MSVC C Release MT flags " FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "MSVC CXX Release MT flags " FORCE)
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}" CACHE STRING "MSVC C Debug MT flags " FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}" CACHE STRING "MSVC C Release MT flags " FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" CACHE STRING "MSVC CXX Debug MT flags " FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE STRING "MSVC CXX Release MT flags " FORCE)
endif()
# config.h definition for installable headers
check_include_files(limits.h FREERDP_HAVE_LIMITS_H)
check_include_files(stdint.h FREERDP_HAVE_STDINT_H)
@@ -135,11 +139,6 @@ check_include_files(sys/strtio.h HAVE_SYS_STRTIO_H)
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
# Libraries that we have a hard dependency on
if(NOT DEFINED OPENSSL_INCLUDE_DIR OR NOT DEFINED OPENSSL_LIBRARIES)
find_required_package(OpenSSL)
endif()
# Mac OS X
if(APPLE)
if(IS_DIRECTORY /opt/local/include)
@@ -178,6 +177,8 @@ set(FREERDP_KEYMAP_PATH "${FREERDP_DATA_PATH}/keymaps")
# Path to put plugins
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp")
set(FREERDP_CLIENT_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}/client")
set(FREERDP_SERVER_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}/server")
# Path to put extensions
set(FREERDP_EXTENSION_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp/extensions")
@@ -186,15 +187,25 @@ set(FREERDP_EXTENSION_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp/extensions")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
# WinPR
set(WINPR_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/winpr/include")
include_directories(${WINPR_INCLUDE_DIR})
# Configure files
add_definitions("-DHAVE_CONFIG_H")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/freerdp/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/freerdp/config.h)
# Unit Tests
INCLUDE(CTest)
if(BUILD_TESTING)
enable_testing()
endif()
# WinPR
set(WINPR_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/winpr/include")
include_directories(${WINPR_INCLUDE_DIR})
add_subdirectory(winpr)
# Generate pkg-config
if(NOT MSVC)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc @ONLY)
@@ -205,9 +216,9 @@ endif()
#find_optional_package(IPP)
# Build CUnit
find_optional_package(CUnit)
if(WITH_CUNIT)
enable_testing()
add_subdirectory(cunit)
endif()
@@ -215,8 +226,6 @@ endif()
add_subdirectory(include)
add_subdirectory(winpr)
add_subdirectory(libfreerdp)
if(WITH_CHANNELS)
@@ -246,3 +255,4 @@ string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_lower)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME_lower}-${FREERDP_VERSION_FULL}")
include(CPack)

View File

@@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,13 +15,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
add_subdirectory(cliprdr)
add_subdirectory(drdynvc)
add_subdirectory(rail)
add_subdirectory(rdpdbg)
add_subdirectory(skel)
set(FILENAME "ChannelOptions.cmake")
file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}")
if(NOT WIN32)
add_subdirectory(rdpdr)
add_subdirectory(rdpsnd)
foreach(FILEPATH ${FILEPATHS})
if(${FILEPATH} MATCHES "^([^/]*)//${FILENAME}")
string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" DIR ${FILEPATH})
set(CHANNEL_OPTION)
include(${FILEPATH})
if(${CHANNEL_OPTION})
message(STATUS "Adding ${CHANNEL_TYPE} channel \"${CHANNEL_SHORT_NAME}\": ${CHANNEL_LONG_NAME}")
add_subdirectory(${DIR})
endif()
endif()
endforeach(FILEPATH)
if(WITH_SERVER_CHANNELS)
add_subdirectory(server)
endif()

View File

@@ -0,0 +1,31 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# 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.
set(MODULE_NAME "audin")
set(MODULE_PREFIX "CHANNEL_AUDIN")
if(WITH_CLIENT_CHANNELS)
add_subdirectory(client)
endif()
if(WITH_SERVER_CHANNELS)
add_subdirectory(server)
set(${MODULE_PREFIX}_SERVER_SRCS ${${MODULE_PREFIX}_SERVER_SRCS} PARENT_SCOPE)
set(${MODULE_PREFIX}_SERVER_LIBS ${${MODULE_PREFIX}_SERVER_LIBS} PARENT_SCOPE)
set(CHANNEL_BUILTIN_SERVER_MODULES ${CHANNEL_BUILTIN_SERVER_MODULES} ${MODULE_NAME} PARENT_SCOPE)
endif()

View File

@@ -0,0 +1,10 @@
set(CHANNEL_TYPE "dynamic")
set(CHANNEL_SHORT_NAME "audin")
set(CHANNEL_LONG_NAME "Audio Input Redirection Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPEAI]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)

View File

@@ -41,4 +41,3 @@ endif()
if(WITH_PULSEAUDIO)
add_subdirectory(pulse)
endif()

View File

@@ -20,7 +20,19 @@
#ifndef __AUDIN_MAIN_H
#define __AUDIN_MAIN_H
#include "drdynvc_types.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/utils/debug.h>
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
#else
#define DEBUG_DVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#endif
typedef boolean (*AudinReceive) (uint8* data, int size, void* user_data);

View File

@@ -1,9 +1,7 @@
# WinPR: Windows Portable Runtime
# winpr-reg cmake build script
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,15 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
add_executable(winpr-reg
reg.c)
set(MODULE_PREFIX "CHANNEL_AUDIN_SERVER")
set(${MODULE_PREFIX}_SRCS
audin.c
PARENT_SCOPE)
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(winpr-reg winpr)
set(${MODULE_PREFIX}_LIBS freerdp PARENT_SCOPE)
else()
target_link_libraries(winpr-reg winpr-utils)
if(NOT WIN32)
target_link_libraries(winpr-reg winpr-registry)
endif()
set(${MODULE_PREFIX}_LIBS freerdp-utils freerdp-channels PARENT_SCOPE)
endif()

View File

@@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,20 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(CLIPRDR_SRCS
cliprdr_constants.h
cliprdr_format.c
cliprdr_format.h
cliprdr_main.c
cliprdr_main.h)
add_library(cliprdr ${CLIPRDR_SRCS})
set_target_properties(cliprdr PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(cliprdr freerdp)
else()
target_link_libraries(cliprdr freerdp-utils)
if(WITH_CLIENT_CHANNELS)
add_subdirectory(client)
endif()
install(TARGETS cliprdr DESTINATION ${FREERDP_PLUGIN_PATH})

View File

@@ -0,0 +1,10 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "cliprdr")
set(CHANNEL_LONG_NAME "Clipboard Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPECLIP]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)

View File

@@ -1,5 +1,5 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP Test Server cmake build script
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
@@ -17,18 +17,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
add_executable(tfreerdp-server
tfreerdp.c)
set(CLIPRDR_SRCS
cliprdr_constants.h
cliprdr_format.c
cliprdr_format.h
cliprdr_main.c
cliprdr_main.h)
add_library(cliprdr ${CLIPRDR_SRCS})
set_target_properties(cliprdr PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(tfreerdp-server
freerdp
freerdp-server-channels)
target_link_libraries(cliprdr freerdp)
else()
target_link_libraries(tfreerdp-server
freerdp-core
freerdp-utils
freerdp-codec
freerdp-channels
freerdp-server-channels)
target_link_libraries(cliprdr freerdp-utils)
endif()
install(TARGETS cliprdr DESTINATION ${FREERDP_PLUGIN_PATH})

View File

@@ -143,8 +143,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint3
}
else
{
format_name->name = freerdp_uniconv_in(cliprdr->uniconv, s->p, 32);
format_name->length = strlen(format_name->name);
format_name->length = freerdp_UnicodeToAsciiAlloc((WCHAR*) s->p, &format_name->name, 32 / 2);
}
stream_seek(s, 32);
@@ -187,8 +186,7 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint32
break;
}
format_name->name = freerdp_uniconv_in(cliprdr->uniconv, stream_get_tail(s), name_len);
format_name->length = strlen(format_name->name);
format_name->length = freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &format_name->name, name_len / 2);
stream_seek(s, name_len + 2);
}
}

View File

@@ -82,8 +82,6 @@ void cliprdr_packet_send(cliprdrPlugin* cliprdr, STREAM* s)
static void cliprdr_process_connect(rdpSvcPlugin* plugin)
{
DEBUG_CLIPRDR("connecting");
((cliprdrPlugin*) plugin)->uniconv = freerdp_uniconv_new();
}
void cliprdr_print_general_capability_flags(uint32 flags)
@@ -267,11 +265,6 @@ 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);
}

View File

@@ -35,7 +35,6 @@ typedef struct _CLIPRDR_FORMAT_NAME CLIPRDR_FORMAT_NAME;
struct cliprdr_plugin
{
rdpSvcPlugin plugin;
UNICONV* uniconv;
boolean received_caps;
boolean use_long_format_names;
boolean stream_fileclip_enabled;

View File

@@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,27 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(DRDYNVC_SRCS
drdynvc_main.c
drdynvc_main.h
drdynvc_types.h
dvcman.c
dvcman.h
)
add_library(drdynvc ${DRDYNVC_SRCS})
set_target_properties(drdynvc PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(drdynvc freerdp)
else()
target_link_libraries(drdynvc freerdp-utils)
if(WITH_CLIENT_CHANNELS)
add_subdirectory(client)
endif()
install(TARGETS drdynvc DESTINATION ${FREERDP_PLUGIN_PATH})
if(NOT WIN32)
add_subdirectory(tsmf)
endif()
add_subdirectory(audin)

View File

@@ -0,0 +1,9 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "drdynvc")
set(CHANNEL_LONG_NAME "Dynamic Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPEDYC]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)

View File

@@ -17,20 +17,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(DISK_SRCS
disk_file.c
disk_file.h
disk_main.c)
set(DRDYNVC_SRCS
drdynvc_main.c
drdynvc_main.h
drdynvc_types.h
dvcman.c
dvcman.h
)
include_directories(..)
add_library(disk ${DISK_SRCS})
set_target_properties(disk PROPERTIES PREFIX "")
add_library(drdynvc ${DRDYNVC_SRCS})
set_target_properties(drdynvc PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(disk freerdp)
target_link_libraries(drdynvc freerdp)
else()
target_link_libraries(disk freerdp-utils)
target_link_libraries(drdynvc freerdp-utils)
endif()
install(TARGETS disk DESTINATION ${FREERDP_PLUGIN_PATH})
install(TARGETS drdynvc DESTINATION ${FREERDP_PLUGIN_PATH})

View File

@@ -50,6 +50,7 @@ struct drdynvc_plugin
int PriorityCharge1;
int PriorityCharge2;
int PriorityCharge3;
int channel_error;
IWTSVirtualChannelManager* channel_mgr;
};
@@ -70,7 +71,7 @@ static int drdynvc_write_variable_uint(STREAM* stream, uint32 val)
}
else
{
cb = 3;
cb = 2;
stream_write_uint32(stream, val);
}
return cb;
@@ -87,11 +88,22 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui
DEBUG_DVC("ChannelId=%d size=%d", ChannelId, data_size);
if (drdynvc->channel_error != CHANNEL_RC_OK)
return 1;
data_out = stream_new(CHANNEL_CHUNK_LENGTH);
stream_set_pos(data_out, 1);
cbChId = drdynvc_write_variable_uint(data_out, ChannelId);
if (data_size <= CHANNEL_CHUNK_LENGTH - pos)
if(data_size == 0)
{
pos = stream_get_pos(data_out);
stream_set_pos(data_out, 0);
stream_write_uint8(data_out, 0x40 | cbChId);
stream_set_pos(data_out, pos);
error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out);
}
else if (data_size <= CHANNEL_CHUNK_LENGTH - pos)
{
pos = stream_get_pos(data_out);
stream_set_pos(data_out, 0);
@@ -136,6 +148,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui
}
if (error != CHANNEL_RC_OK)
{
drdynvc->channel_error = error;
DEBUG_WARN("VirtualChannelWrite failed %d", error);
return 1;
}
@@ -179,6 +192,8 @@ static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, in
DEBUG_WARN("VirtualChannelWrite failed %d", error);
return 1;
}
drdynvc->channel_error = error;
return 0;
}
@@ -326,6 +341,7 @@ static void drdynvc_process_connect(rdpSvcPlugin* plugin)
DEBUG_DVC("connecting");
drdynvc->channel_mgr = dvcman_new(drdynvc);
drdynvc->channel_error = 0;
dvcman_load_plugin(drdynvc->channel_mgr, svc_plugin_get_data(plugin));
dvcman_init(drdynvc->channel_mgr);
}

View File

@@ -27,6 +27,7 @@
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/utils/debug.h>
#include <pthread.h>
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
@@ -35,3 +36,4 @@
#endif
#endif

View File

@@ -83,6 +83,8 @@ struct _DVCMAN_CHANNEL
IWTSVirtualChannelCallback* channel_callback;
STREAM* dvc_data;
pthread_mutex_t dvc_chan_mutex;
};
static int dvcman_get_configuration(IWTSListener* pListener, void** ppPropertyBag)
@@ -179,6 +181,28 @@ RDP_PLUGIN_DATA* dvcman_get_plugin_data(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
return ((DVCMAN_ENTRY_POINTS*) pEntryPoints)->plugin_data;
}
uint32 dvcman_get_channel_id(IWTSVirtualChannel * channel)
{
return ((DVCMAN_CHANNEL*)channel)->channel_id;
}
IWTSVirtualChannel* dvcman_find_channel_by_id(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId)
{
LIST_ITEM* curr;
DVCMAN* dvcman = (DVCMAN*) pChannelMgr;
for (curr = dvcman->channels->head; curr; curr = curr->next)
{
if (((DVCMAN_CHANNEL*) curr->data)->channel_id == ChannelId)
{
return (IWTSVirtualChannel*)curr->data;
}
}
return NULL;
}
IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
{
DVCMAN* dvcman;
@@ -186,6 +210,8 @@ IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
dvcman = xnew(DVCMAN);
dvcman->iface.CreateListener = dvcman_create_listener;
dvcman->iface.PushEvent = dvcman_push_event;
dvcman->iface.FindChannelById = dvcman_find_channel_by_id;
dvcman->iface.GetChannelId = dvcman_get_channel_id;
dvcman->drdynvc = plugin;
dvcman->channels = list_new();
@@ -276,8 +302,13 @@ int dvcman_init(IWTSVirtualChannelManager* pChannelMgr)
static int dvcman_write_channel(IWTSVirtualChannel* pChannel, uint32 cbSize, uint8* pBuffer, void* pReserved)
{
DVCMAN_CHANNEL* channel = (DVCMAN_CHANNEL*) pChannel;
int error;
return drdynvc_write_data(channel->dvcman->drdynvc, channel->channel_id, pBuffer, cbSize);
pthread_mutex_lock(&channel->dvc_chan_mutex);
error = drdynvc_write_data(channel->dvcman->drdynvc, channel->channel_id, pBuffer, cbSize);
pthread_mutex_unlock(&channel->dvc_chan_mutex);
return error;
}
static int dvcman_close_channel_iface(IWTSVirtualChannel* pChannel)
@@ -315,6 +346,7 @@ int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 Channel
channel->iface.Close = dvcman_close_channel_iface;
channel->dvcman = dvcman;
channel->channel_id = ChannelId;
pthread_mutex_init(&channel->dvc_chan_mutex, NULL);
bAccept = 1;
pCallback = NULL;
@@ -341,28 +373,13 @@ int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 Channel
return 1;
}
static DVCMAN_CHANNEL* dvcman_find_channel_by_id(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId)
{
LIST_ITEM* curr;
DVCMAN* dvcman = (DVCMAN*) pChannelMgr;
for (curr = dvcman->channels->head; curr; curr = curr->next)
{
if (((DVCMAN_CHANNEL*) curr->data)->channel_id == ChannelId)
{
return (DVCMAN_CHANNEL*)curr->data;
}
}
return NULL;
}
int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId)
{
DVCMAN_CHANNEL* channel;
IWTSVirtualChannel* ichannel;
channel = dvcman_find_channel_by_id(pChannelMgr, ChannelId);
channel = (DVCMAN_CHANNEL*)dvcman_find_channel_by_id(pChannelMgr, ChannelId);
if (channel == NULL)
{
@@ -387,7 +404,7 @@ int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, ui
{
DVCMAN_CHANNEL* channel;
channel = dvcman_find_channel_by_id(pChannelMgr, ChannelId);
channel = (DVCMAN_CHANNEL*)dvcman_find_channel_by_id(pChannelMgr, ChannelId);
if (channel == NULL)
{
@@ -408,7 +425,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, uint32 C
int error = 0;
DVCMAN_CHANNEL* channel;
channel = dvcman_find_channel_by_id(pChannelMgr, ChannelId);
channel = (DVCMAN_CHANNEL*)dvcman_find_channel_by_id(pChannelMgr, ChannelId);
if (channel == NULL)
{

View File

@@ -33,3 +33,4 @@ int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, ui
int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint8* data, uint32 data_size);
#endif

View File

@@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,20 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(RAIL_SRCS
rail_main.c
rail_main.h
rail_orders.c
rail_orders.h)
add_library(rail ${RAIL_SRCS})
set_target_properties(rail PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(rail freerdp)
else()
target_link_libraries(rail freerdp-utils)
if(WITH_CLIENT_CHANNELS)
add_subdirectory(client)
endif()
install(TARGETS rail DESTINATION ${FREERDP_PLUGIN_PATH})

View File

@@ -0,0 +1,9 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "rail")
set(CHANNEL_LONG_NAME "Remote Programs Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPERP]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)

View File

@@ -17,17 +17,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(RDPDBG_SRCS
rdpdbg_main.c
)
set(RAIL_SRCS
rail_main.c
rail_main.h
rail_orders.c
rail_orders.h)
add_library(rdpdbg ${RDPDBG_SRCS})
set_target_properties(rdpdbg PROPERTIES PREFIX "")
add_library(rail ${RAIL_SRCS})
set_target_properties(rail PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(rdpdbg freerdp)
target_link_libraries(rail freerdp)
else()
target_link_libraries(rdpdbg freerdp-utils)
target_link_libraries(rail freerdp-utils)
endif()
install(TARGETS rdpdbg DESTINATION ${FREERDP_PLUGIN_PATH})
install(TARGETS rail DESTINATION ${FREERDP_PLUGIN_PATH})

View File

@@ -29,7 +29,6 @@
struct rdp_rail_order
{
UNICONV* uniconv;
RDP_PLUGIN_DATA* plugin_data;
void* plugin;
RAIL_HANDSHAKE_ORDER handshake;

View File

@@ -24,6 +24,7 @@
#include <freerdp/utils/rail.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/unicode.h>
#include "rail_orders.h"
@@ -66,8 +67,8 @@ static const char* const RAIL_ORDER_TYPE_STRINGS[] =
void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_UNICODE_STRING* unicode_string)
{
char* buffer;
size_t length = 0;
WCHAR* buffer;
int length = 0;
if (unicode_string->string != NULL)
xfree(unicode_string->string);
@@ -78,7 +79,7 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_
if (string == NULL || strlen(string) < 1)
return;
buffer = freerdp_uniconv_out(rail_order->uniconv, string, &length);
length = freerdp_AsciiToUnicodeAlloc(string, &buffer, 0) * 2;
unicode_string->string = (uint8*) buffer;
unicode_string->length = (uint16) length;
@@ -253,15 +254,24 @@ void rail_write_client_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
break;
case SPI_SET_WORK_AREA:
freerdp_write_rectangle_16(s, &sysparam->workArea);
stream_write_uint16(s, sysparam->workArea.left); /* left (2 bytes) */
stream_write_uint16(s, sysparam->workArea.top); /* top (2 bytes) */
stream_write_uint16(s, sysparam->workArea.right); /* right (2 bytes) */
stream_write_uint16(s, sysparam->workArea.bottom); /* bottom (2 bytes) */
break;
case SPI_DISPLAY_CHANGE:
freerdp_write_rectangle_16(s, &sysparam->displayChange);
stream_write_uint16(s, sysparam->displayChange.left); /* left (2 bytes) */
stream_write_uint16(s, sysparam->displayChange.top); /* top (2 bytes) */
stream_write_uint16(s, sysparam->displayChange.right); /* right (2 bytes) */
stream_write_uint16(s, sysparam->displayChange.bottom); /* bottom (2 bytes) */
break;
case SPI_TASKBAR_POS:
freerdp_write_rectangle_16(s, &sysparam->taskbarPos);
stream_write_uint16(s, sysparam->taskbarPos.left); /* left (2 bytes) */
stream_write_uint16(s, sysparam->taskbarPos.top); /* top (2 bytes) */
stream_write_uint16(s, sysparam->taskbarPos.right); /* right (2 bytes) */
stream_write_uint16(s, sysparam->taskbarPos.bottom); /* bottom (2 bytes) */
break;
case SPI_SET_HIGH_CONTRAST:
@@ -631,7 +641,7 @@ rdpRailOrder* rail_order_new()
if (rail_order != NULL)
{
rail_order->uniconv = freerdp_uniconv_new();
}
return rail_order;
@@ -641,7 +651,7 @@ void rail_order_free(rdpRailOrder* rail_order)
{
if (rail_order != NULL)
{
freerdp_uniconv_free(rail_order->uniconv);
xfree(rail_order);
}
}

View File

@@ -1,74 +0,0 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* Debugging Virtual Channel
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2011 Vic Lee
*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <freerdp/constants.h>
#include <freerdp/types.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/svc_plugin.h>
typedef struct rdpdbg_plugin rdpdbgPlugin;
struct rdpdbg_plugin
{
rdpSvcPlugin plugin;
};
static void rdpdbg_process_connect(rdpSvcPlugin* plugin)
{
DEBUG_WARN("connecting");
}
static void rdpdbg_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
{
STREAM* data_out;
DEBUG_WARN("size %d", stream_get_size(data_in));
stream_free(data_in);
data_out = stream_new(8);
stream_write(data_out, "senddata", 8);
svc_plugin_send(plugin, data_out);
}
static void rdpdbg_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
{
DEBUG_WARN("event_type %d", event->event_type);
freerdp_event_free(event);
event = freerdp_event_new(RDP_EVENT_CLASS_DEBUG, 0, NULL, NULL);
svc_plugin_send_event(plugin, event);
}
static void rdpdbg_process_terminate(rdpSvcPlugin* plugin)
{
DEBUG_WARN("terminating");
xfree(plugin);
}
DEFINE_SVC_PLUGIN(rdpdbg, "rdpdbg",
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL)

View File

@@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,36 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(RDPDR_SRCS
rdpdr_constants.h
rdpdr_types.h
rdpdr_capabilities.c
rdpdr_capabilities.h
devman.c
devman.h
irp.c
irp.h
rdpdr_main.c
rdpdr_main.h)
add_library(rdpdr ${RDPDR_SRCS})
set_target_properties(rdpdr PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(rdpdr freerdp)
else()
target_link_libraries(rdpdr freerdp-utils)
if(WITH_CLIENT_CHANNELS)
add_subdirectory(client)
endif()
install(TARGETS rdpdr DESTINATION ${FREERDP_PLUGIN_PATH})
if(NOT WIN32)
add_subdirectory(disk)
add_subdirectory(printer)
add_subdirectory(parallel)
add_subdirectory(serial)
endif()
if(WITH_PCSC)
add_subdirectory(smartcard)
endif()

View File

@@ -0,0 +1,14 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "rdpdr")
set(CHANNEL_LONG_NAME "Device Redirection Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
if(WIN32)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
endif()

View File

@@ -0,0 +1,52 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# 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.
set(RDPDR_SRCS
rdpdr_constants.h
rdpdr_types.h
rdpdr_capabilities.c
rdpdr_capabilities.h
devman.c
devman.h
irp.c
irp.h
rdpdr_main.c
rdpdr_main.h)
add_library(rdpdr ${RDPDR_SRCS})
set_target_properties(rdpdr PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(rdpdr freerdp)
else()
target_link_libraries(rdpdr freerdp-utils)
endif()
install(TARGETS rdpdr DESTINATION ${FREERDP_PLUGIN_PATH})
add_subdirectory(disk)
add_subdirectory(printer)
if(NOT WIN32)
add_subdirectory(parallel)
add_subdirectory(serial)
endif()
if(WITH_PCSC)
add_subdirectory(smartcard)
endif()

View File

@@ -0,0 +1,47 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# 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.
set(MODULE_NAME "disk")
set(MODULE_PREFIX "CHANNEL_DEVICE_DISK")
set(${MODULE_PREFIX}_SRCS
disk_file.c
disk_file.h
disk_main.c)
if(WIN32)
set(${MODULE_PREFIX}_SRCS
statvfs.c
statvfs.h
dirent.h)
endif()
include_directories(..)
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
set(${MODULE_PREFIX}_LIBS freerdp winpr)
else()
set(${MODULE_PREFIX}_LIBS freerdp-utils winpr-synch winpr-thread)
endif()
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})

View File

@@ -0,0 +1,374 @@
/*****************************************************************************
* dirent.h - dirent API for Microsoft Visual Studio
*
* Copyright (C) 2006 Toni Ronkko
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* ``Software''), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Mar 15, 2011, Toni Ronkko
* Defined FILE_ATTRIBUTE_DEVICE for MSVC 6.0.
*
* Aug 11, 2010, Toni Ronkko
* Added d_type and d_namlen fields to dirent structure. The former is
* especially useful for determining whether directory entry represents a
* file or a directory. For more information, see
* http://www.delorie.com/gnu/docs/glibc/libc_270.html
*
* Aug 11, 2010, Toni Ronkko
* Improved conformance to the standards. For example, errno is now set
* properly on failure and assert() is never used. Thanks to Peter Brockam
* for suggestions.
*
* Aug 11, 2010, Toni Ronkko
* Fixed a bug in rewinddir(): when using relative directory names, change
* of working directory no longer causes rewinddir() to fail.
*
* Dec 15, 2009, John Cunningham
* Added rewinddir member function
*
* Jan 18, 2008, Toni Ronkko
* Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string
* between multi-byte and unicode representations. This makes the
* code simpler and also allows the code to be compiled under MingW. Thanks
* to Azriel Fasten for the suggestion.
*
* Mar 4, 2007, Toni Ronkko
* Bug fix: due to the strncpy_s() function this file only compiled in
* Visual Studio 2005. Using the new string functions only when the
* compiler version allows.
*
* Nov 2, 2006, Toni Ronkko
* Major update: removed support for Watcom C, MS-DOS and Turbo C to
* simplify the file, updated the code to compile cleanly on Visual
* Studio 2005 with both unicode and multi-byte character strings,
* removed rewinddir() as it had a bug.
*
* Aug 20, 2006, Toni Ronkko
* Removed all remarks about MSVC 1.0, which is antiqued now. Simplified
* comments by removing SGML tags.
*
* May 14 2002, Toni Ronkko
* Embedded the function definitions directly to the header so that no
* source modules need to be included in the Visual Studio project. Removed
* all the dependencies to other projects so that this very header can be
* used independently.
*
* May 28 1998, Toni Ronkko
* First version.
*****************************************************************************/
#ifndef DIRENT_H
#define DIRENT_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
/* Entries missing from MSVC 6.0 */
#if !defined(FILE_ATTRIBUTE_DEVICE)
# define FILE_ATTRIBUTE_DEVICE 0x40
#endif
/* File type and permission flags for stat() */
#if defined(_MSC_VER) && !defined(S_IREAD)
# define S_IFMT _S_IFMT /* file type mask */
# define S_IFDIR _S_IFDIR /* directory */
# define S_IFCHR _S_IFCHR /* character device */
# define S_IFFIFO _S_IFFIFO /* pipe */
# define S_IFREG _S_IFREG /* regular file */
# define S_IREAD _S_IREAD /* read permission */
# define S_IWRITE _S_IWRITE /* write permission */
# define S_IEXEC _S_IEXEC /* execute permission */
#endif
#define S_IFBLK 0 /* block device */
#define S_IFLNK 0 /* link */
#define S_IFSOCK 0 /* socket */
#if defined(_MSC_VER)
# define S_IRUSR S_IREAD /* read, user */
# define S_IWUSR S_IWRITE /* write, user */
# define S_IXUSR 0 /* execute, user */
# define S_IRGRP 0 /* read, group */
# define S_IWGRP 0 /* write, group */
# define S_IXGRP 0 /* execute, group */
# define S_IROTH 0 /* read, others */
# define S_IWOTH 0 /* write, others */
# define S_IXOTH 0 /* execute, others */
#endif
/* Indicates that d_type field is available in dirent structure */
#define _DIRENT_HAVE_D_TYPE
/* File type flags for d_type */
#define DT_UNKNOWN 0
#define DT_REG S_IFREG
#define DT_DIR S_IFDIR
#define DT_FIFO S_IFFIFO
#define DT_SOCK S_IFSOCK
#define DT_CHR S_IFCHR
#define DT_BLK S_IFBLK
/* Macros for converting between st_mode and d_type */
#define IFTODT(mode) ((mode) & S_IFMT)
#define DTTOIF(type) (type)
/*
* File type macros. Note that block devices, sockets and links cannot be
* distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
* only defined for compatibility. These macros should always return false
* on Windows.
*/
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO)
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
#ifdef __cplusplus
extern "C" {
#endif
typedef struct dirent
{
char d_name[MAX_PATH + 1]; /* File name */
size_t d_namlen; /* Length of name without \0 */
int d_type; /* File type */
} dirent;
typedef struct DIR
{
dirent curentry; /* Current directory entry */
WIN32_FIND_DATAA find_data; /* Private file data */
int cached; /* True if data is valid */
HANDLE search_handle; /* Win32 search handle */
char patt[MAX_PATH + 3]; /* Initial directory name */
} DIR;
/* Forward declarations */
static DIR *opendir(const char *dirname);
static struct dirent *readdir(DIR *dirp);
static int closedir(DIR *dirp);
static void rewinddir(DIR* dirp);
/* Use the new safe string functions introduced in Visual Studio 2005 */
#if defined(_MSC_VER) && _MSC_VER >= 1400
# define DIRENT_STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE)
#else
# define DIRENT_STRNCPY(dest,src,size) strncpy((dest),(src),(size))
#endif
/* Set errno variable */
#if defined(_MSC_VER)
#define DIRENT_SET_ERRNO(x) _set_errno (x)
#else
#define DIRENT_SET_ERRNO(x) (errno = (x))
#endif
/*****************************************************************************
* Open directory stream DIRNAME for read and return a pointer to the
* internal working area that is used to retrieve individual directory
* entries.
*/
static DIR *opendir(const char *dirname)
{
DIR *dirp;
/* ensure that the resulting search pattern will be a valid file name */
if (dirname == NULL) {
DIRENT_SET_ERRNO (ENOENT);
return NULL;
}
if (strlen (dirname) + 3 >= MAX_PATH) {
DIRENT_SET_ERRNO (ENAMETOOLONG);
return NULL;
}
/* construct new DIR structure */
dirp = (DIR*) malloc (sizeof (struct DIR));
if (dirp != NULL) {
int error;
/*
* Convert relative directory name to an absolute one. This
* allows rewinddir() to function correctly when the current working
* directory is changed between opendir() and rewinddir().
*/
if (GetFullPathNameA (dirname, MAX_PATH, dirp->patt, NULL)) {
char *p;
/* append the search pattern "\\*\0" to the directory name */
p = strchr (dirp->patt, '\0');
if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') {
*p++ = '\\';
}
*p++ = '*';
*p = '\0';
/* open directory stream and retrieve the first entry */
dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->find_data);
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
/* a directory entry is now waiting in memory */
dirp->cached = 1;
error = 0;
} else {
/* search pattern is not a directory name? */
DIRENT_SET_ERRNO (ENOENT);
error = 1;
}
} else {
/* buffer too small */
DIRENT_SET_ERRNO (ENOMEM);
error = 1;
}
if (error) {
free (dirp);
dirp = NULL;
}
}
return dirp;
}
/*****************************************************************************
* Read a directory entry, and return a pointer to a dirent structure
* containing the name of the entry in d_name field. Individual directory
* entries returned by this very function include regular files,
* sub-directories, pseudo-directories "." and "..", but also volume labels,
* hidden files and system files may be returned.
*/
static struct dirent *readdir(DIR *dirp)
{
DWORD attr;
if (dirp == NULL) {
/* directory stream did not open */
DIRENT_SET_ERRNO (EBADF);
return NULL;
}
/* get next directory entry */
if (dirp->cached != 0) {
/* a valid directory entry already in memory */
dirp->cached = 0;
} else {
/* get the next directory entry from stream */
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
return NULL;
}
if (FindNextFileA (dirp->search_handle, &dirp->find_data) == FALSE) {
/* the very last entry has been processed or an error occured */
FindClose (dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
return NULL;
}
}
/* copy as a multibyte character string */
DIRENT_STRNCPY ( dirp->curentry.d_name,
dirp->find_data.cFileName,
sizeof(dirp->curentry.d_name) );
dirp->curentry.d_name[MAX_PATH] = '\0';
/* compute the length of name */
dirp->curentry.d_namlen = strlen (dirp->curentry.d_name);
/* determine file type */
attr = dirp->find_data.dwFileAttributes;
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
dirp->curentry.d_type = DT_CHR;
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
dirp->curentry.d_type = DT_DIR;
} else {
dirp->curentry.d_type = DT_REG;
}
return &dirp->curentry;
}
/*****************************************************************************
* Close directory stream opened by opendir() function. Close of the
* directory stream invalidates the DIR structure as well as any previously
* read directory entry.
*/
static int closedir(DIR *dirp)
{
if (dirp == NULL) {
/* invalid directory stream */
DIRENT_SET_ERRNO (EBADF);
return -1;
}
/* release search handle */
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
FindClose (dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
}
/* release directory structure */
free (dirp);
return 0;
}
/*****************************************************************************
* Resets the position of the directory stream to which dirp refers to the
* beginning of the directory. It also causes the directory stream to refer
* to the current state of the corresponding directory, as a call to opendir()
* would have done. If dirp does not refer to a directory stream, the effect
* is undefined.
*/
static void rewinddir(DIR* dirp)
{
if (dirp != NULL) {
/* release search handle */
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
FindClose (dirp->search_handle);
}
/* open new search handle and retrieve the first entry */
dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->find_data);
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
/* a directory entry is now waiting in memory */
dirp->cached = 1;
} else {
/* failed to re-open directory: no directory entry in memory */
dirp->cached = 0;
}
}
}
#ifdef __cplusplus
}
#endif
#endif /*DIRENT_H*/

View File

@@ -4,6 +4,7 @@
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2010-2011 Vic Lee
* Copyright 2012 Gerald Richter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,8 +37,10 @@
#include <string.h>
#include <time.h>
#include <sys/stat.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/unicode.h>
#include <freerdp/utils/svc_plugin.h>
#ifdef HAVE_UNISTD_H
@@ -116,10 +119,12 @@ static boolean disk_file_remove_dir(const char* path)
boolean ret = true;
dir = opendir(path);
if (dir == NULL)
return false;
pdirent = readdir(dir);
while (pdirent)
{
if (strcmp(pdirent->d_name, ".") == 0 || strcmp(pdirent->d_name, "..") == 0)
@@ -172,6 +177,7 @@ static void disk_file_set_fullpath(DISK_FILE* file, char* fullpath)
xfree(file->fullpath);
file->fullpath = fullpath;
file->filename = strrchr(file->fullpath, '/');
if (file->filename == NULL)
file->filename = file->fullpath;
else
@@ -180,10 +186,12 @@ static void disk_file_set_fullpath(DISK_FILE* file, char* fullpath)
static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 CreateDisposition, uint32 CreateOptions)
{
const static int mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
struct STAT st;
boolean exists;
#ifndef WIN32
#ifdef WIN32
const static int mode = _S_IREAD | _S_IWRITE ;
#else
const static int mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
boolean largeFile = false;
#endif
int oflag = 0;
@@ -421,11 +429,11 @@ boolean disk_file_query_information(DISK_FILE* file, uint32 FsInformationClass,
boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, uint32 Length, STREAM* input)
{
char* s;
mode_t m;
mode_t m;
uint64 size;
char* fullpath;
struct STAT st;
UNICONV* uniconv;
struct timeval tv[2];
uint64 LastWriteTime;
uint32 FileAttributes;
@@ -448,7 +456,9 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui
tv[0].tv_usec = 0;
tv[1].tv_sec = (LastWriteTime > 0 ? FILE_TIME_RDP_TO_SYSTEM(LastWriteTime) : st.st_mtime);
tv[1].tv_usec = 0;
futimes(file->fd, tv);
#ifndef WIN32
/* TODO on win32 */
futimes(file->fd, tv);
if (FileAttributes > 0)
{
@@ -460,7 +470,8 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui
if (m != st.st_mode)
fchmod(file->fd, st.st_mode);
}
break;
#endif
break;
case FileEndOfFileInformation:
/* http://msdn.microsoft.com/en-us/library/cc232067.aspx */
@@ -485,21 +496,21 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui
stream_seek_uint8(input); /* ReplaceIfExists */
stream_seek_uint8(input); /* RootDirectory */
stream_read_uint32(input, FileNameLength);
uniconv = freerdp_uniconv_new();
s = freerdp_uniconv_in(uniconv, stream_get_tail(input), FileNameLength);
freerdp_uniconv_free(uniconv);
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(input), &s, FileNameLength / 2);
fullpath = disk_file_combine_fullpath(file->basepath, s);
xfree(s);
if (rename(file->fullpath, fullpath) == 0)
/* TODO rename does not work on win32 */
if (rename(file->fullpath, fullpath) == 0)
{
DEBUG_SVC("renamed %s to %s", file->fullpath, fullpath);
disk_file_set_fullpath(file, fullpath);
}
else
{
DEBUG_WARN("rename %s to %s failed", file->fullpath, fullpath);
DEBUG_WARN("rename %s to %s failed, errno = %d", file->fullpath, fullpath, errno);
free(fullpath);
return false;
}
@@ -517,12 +528,11 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui
boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, uint8 InitialQuery,
const char* path, STREAM* output)
{
struct dirent* ent;
char* ent_path;
struct STAT st;
UNICONV* uniconv;
size_t len;
int length;
boolean ret;
WCHAR* ent_path;
struct STAT st;
struct dirent* ent;
DEBUG_SVC("path %s FsInformationClass %d InitialQuery %d", path, FsInformationClass, InitialQuery);
@@ -549,6 +559,7 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
do
{
ent = readdir(file->dir);
if (ent == NULL)
continue;
@@ -570,27 +581,27 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
}
memset(&st, 0, sizeof(struct STAT));
ent_path = xmalloc(strlen(file->fullpath) + strlen(ent->d_name) + 2);
sprintf(ent_path, "%s/%s", file->fullpath, ent->d_name);
if (STAT(ent_path, &st) != 0)
ent_path = (WCHAR*) malloc(strlen(file->fullpath) + strlen(ent->d_name) + 2);
sprintf((char*) ent_path, "%s/%s", file->fullpath, ent->d_name);
if (STAT((char*) ent_path, &st) != 0)
{
DEBUG_WARN("stat %s failed. errno = %d", ent_path, errno);
DEBUG_WARN("stat %s failed. errno = %d", (char*) ent_path, errno);
}
DEBUG_SVC(" pattern %s matched %s", file->pattern, ent_path);
xfree(ent_path);
uniconv = freerdp_uniconv_new();
ent_path = freerdp_uniconv_out(uniconv, ent->d_name, &len);
freerdp_uniconv_free(uniconv);
length = freerdp_AsciiToUnicodeAlloc(ent->d_name, &ent_path, 0) * 2;
ret = true;
switch (FsInformationClass)
{
case FileDirectoryInformation:
/* http://msdn.microsoft.com/en-us/library/cc232097.aspx */
stream_write_uint32(output, 64 + len); /* Length */
stream_check_size(output, 64 + len);
stream_write_uint32(output, 64 + length); /* Length */
stream_check_size(output, 64 + length);
stream_write_uint32(output, 0); /* NextEntryOffset */
stream_write_uint32(output, 0); /* FileIndex */
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
@@ -600,14 +611,14 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
stream_write_uint64(output, st.st_size); /* EndOfFile */
stream_write_uint64(output, st.st_size); /* AllocationSize */
stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
stream_write_uint32(output, len); /* FileNameLength */
stream_write(output, ent_path, len);
stream_write_uint32(output, length); /* FileNameLength */
stream_write(output, ent_path, length);
break;
case FileFullDirectoryInformation:
/* http://msdn.microsoft.com/en-us/library/cc232068.aspx */
stream_write_uint32(output, 68 + len); /* Length */
stream_check_size(output, 68 + len);
stream_write_uint32(output, 68 + length); /* Length */
stream_check_size(output, 68 + length);
stream_write_uint32(output, 0); /* NextEntryOffset */
stream_write_uint32(output, 0); /* FileIndex */
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
@@ -617,15 +628,15 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
stream_write_uint64(output, st.st_size); /* EndOfFile */
stream_write_uint64(output, st.st_size); /* AllocationSize */
stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
stream_write_uint32(output, len); /* FileNameLength */
stream_write_uint32(output, length); /* FileNameLength */
stream_write_uint32(output, 0); /* EaSize */
stream_write(output, ent_path, len);
stream_write(output, ent_path, length);
break;
case FileBothDirectoryInformation:
/* http://msdn.microsoft.com/en-us/library/cc232095.aspx */
stream_write_uint32(output, 93 + len); /* Length */
stream_check_size(output, 93 + len);
stream_write_uint32(output, 93 + length); /* Length */
stream_check_size(output, 93 + length);
stream_write_uint32(output, 0); /* NextEntryOffset */
stream_write_uint32(output, 0); /* FileIndex */
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
@@ -635,22 +646,22 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
stream_write_uint64(output, st.st_size); /* EndOfFile */
stream_write_uint64(output, st.st_size); /* AllocationSize */
stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
stream_write_uint32(output, len); /* FileNameLength */
stream_write_uint32(output, length); /* FileNameLength */
stream_write_uint32(output, 0); /* EaSize */
stream_write_uint8(output, 0); /* ShortNameLength */
/* Reserved(1), MUST NOT be added! */
stream_write_zero(output, 24); /* ShortName */
stream_write(output, ent_path, len);
stream_write(output, ent_path, length);
break;
case FileNamesInformation:
/* http://msdn.microsoft.com/en-us/library/cc232077.aspx */
stream_write_uint32(output, 12 + len); /* Length */
stream_check_size(output, 12 + len);
stream_write_uint32(output, 12 + length); /* Length */
stream_check_size(output, 12 + length);
stream_write_uint32(output, 0); /* NextEntryOffset */
stream_write_uint32(output, 0); /* FileIndex */
stream_write_uint32(output, len); /* FileNameLength */
stream_write(output, ent_path, len);
stream_write_uint32(output, length); /* FileNameLength */
stream_write(output, ent_path, length);
break;
default:

View File

@@ -4,6 +4,7 @@
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2010-2011 Vic Lee
* Copyright 2012 Gerald Richter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,17 +25,33 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifndef _WIN32
#ifdef _WIN32
#include <direct.h>
#include <io.h>
#include "dirent.h"
#include "statvfs.h"
#else
#include <dirent.h>
#include <sys/statvfs.h>
#endif
#ifdef _WIN32
#define STAT stat
#define OPEN open
#define LSEEK lseek
#define OPEN _open
#define close _close
#define read _read
#define write _write
#define LSEEK _lseek
#define FSTAT fstat
#define STATVFS statvfs
#define mkdir(a,b) _mkdir(a)
#define rmdir _rmdir
#define unlink(a) _unlink(a)
#define ftruncate(a,b) _chsize(a,b)
typedef uint32 ssize_t ;
typedef uint32 mode_t ;
#elif defined(__APPLE__) || defined(__FreeBSD__)
#define STAT stat
#define OPEN open

View File

@@ -39,14 +39,17 @@
#include <freerdp/utils/stream.h>
#include <freerdp/utils/unicode.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/thread.h>
#include <freerdp/utils/svc_plugin.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include "rdpdr_constants.h"
#include "rdpdr_types.h"
#include "disk_file.h"
typedef struct _DISK_DEVICE DISK_DEVICE;
struct _DISK_DEVICE
{
DEVICE device;
@@ -54,15 +57,17 @@ struct _DISK_DEVICE
char* path;
LIST* files;
HANDLE mutex;
HANDLE thread;
LIST* irp_list;
freerdp_thread* thread;
HANDLE irpEvent;
HANDLE stopEvent;
DEVMAN* devman;
pcRegisterDevice UnregisterDevice;
};
static uint32
disk_map_posix_err(int fs_errno)
static uint32 disk_map_posix_err(int fs_errno)
{
uint32 rc;
@@ -90,7 +95,9 @@ disk_map_posix_err(int fs_errno)
rc = STATUS_UNSUCCESSFUL;
break;
}
DEBUG_SVC("errno 0x%x mapped to 0x%x", fs_errno, rc);
return rc;
}
@@ -101,7 +108,8 @@ static DISK_FILE* disk_get_file_by_id(DISK_DEVICE* disk, uint32 id)
for (item = disk->files->head; item; item = item->next)
{
file = (DISK_FILE*)item->data;
file = (DISK_FILE*) item->data;
if (file->id == id)
return file;
}
@@ -115,7 +123,6 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp)
uint32 CreateDisposition;
uint32 CreateOptions;
uint32 PathLength;
UNICONV* uniconv;
char* path;
uint32 FileId;
uint8 Information;
@@ -126,9 +133,7 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp)
stream_read_uint32(irp->input, CreateOptions);
stream_read_uint32(irp->input, PathLength);
uniconv = freerdp_uniconv_new();
path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength);
freerdp_uniconv_free(uniconv);
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
FileId = irp->devman->id_sequence++;
@@ -238,7 +243,7 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp)
}
else
{
buffer = (uint8*)xmalloc(Length);
buffer = (uint8*) xmalloc(Length);
if (!disk_file_read(file, buffer, &Length))
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
@@ -255,11 +260,13 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp)
}
stream_write_uint32(irp->output, Length);
if (Length > 0)
{
stream_check_size(irp->output, Length);
stream_check_size(irp->output, (int)Length);
stream_write(irp->output, buffer, Length);
}
xfree(buffer);
irp->Complete(irp);
@@ -378,11 +385,10 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir
STREAM* output = irp->output;
struct STATVFS svfst;
struct STAT st;
UNICONV* uniconv;
char *volumeLabel = {"FREERDP"}; /* TODO:: Add sub routine to correctly pick up Volume Label name for each O/S supported*/
char *diskType = {"FAT32"};
char* outStr;
size_t len;
char* volumeLabel = {"FREERDP"};
char* diskType = {"FAT32"};
WCHAR* outStr;
int length;
stream_read_uint32(irp->input, FsInformationClass);
@@ -393,17 +399,15 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir
{
case FileFsVolumeInformation:
/* http://msdn.microsoft.com/en-us/library/cc232108.aspx */
uniconv = freerdp_uniconv_new();
outStr = freerdp_uniconv_out(uniconv, volumeLabel, &len);
freerdp_uniconv_free(uniconv);
stream_write_uint32(output, 17 + len); /* Length */
stream_check_size(output, 17 + len);
length = freerdp_AsciiToUnicodeAlloc(volumeLabel, &outStr, 0) * 2;
stream_write_uint32(output, 17 + length); /* Length */
stream_check_size(output, 17 + length);
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* VolumeCreationTime */
stream_write_uint32(output, svfst.f_fsid); /* VolumeSerialNumber */
stream_write_uint32(output, len); /* VolumeLabelLength */
stream_write_uint32(output, length); /* VolumeLabelLength */
stream_write_uint8(output, 0); /* SupportsObjects */
/* Reserved(1), MUST NOT be added! */
stream_write(output, outStr, len); /* VolumeLabel (Unicode) */
stream_write(output, outStr, length); /* VolumeLabel (Unicode) */
xfree(outStr);
break;
@@ -419,19 +423,16 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir
case FileFsAttributeInformation:
/* http://msdn.microsoft.com/en-us/library/cc232101.aspx */
uniconv = freerdp_uniconv_new();
outStr = freerdp_uniconv_out(uniconv, diskType, &len);
freerdp_uniconv_free(uniconv);
stream_write_uint32(output, 12 + len); /* Length */
stream_check_size(output, 12 + len);
length = freerdp_AsciiToUnicodeAlloc(diskType, &outStr, 0) * 2;
stream_write_uint32(output, 12 + length); /* Length */
stream_check_size(output, 12 + length);
stream_write_uint32(output,
FILE_CASE_SENSITIVE_SEARCH |
FILE_CASE_PRESERVED_NAMES |
FILE_UNICODE_ON_DISK); /* FileSystemAttributes */
stream_write_uint32(output, svfst.f_namemax/*510*/); /* MaximumComponentNameLength */
stream_write_uint32(output, len); /* FileSystemNameLength */
stream_write(output, outStr, len); /* FileSystemName (Unicode) */
stream_write_uint32(output, length); /* FileSystemNameLength */
stream_write(output, outStr, length); /* FileSystemName (Unicode) */
xfree(outStr);
break;
@@ -470,7 +471,6 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp)
uint32 FsInformationClass;
uint8 InitialQuery;
uint32 PathLength;
UNICONV* uniconv;
char* path;
stream_read_uint32(irp->input, FsInformationClass);
@@ -478,9 +478,7 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp)
stream_read_uint32(irp->input, PathLength);
stream_seek(irp->input, 23); /* Padding */
uniconv = freerdp_uniconv_new();
path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength);
freerdp_uniconv_free(uniconv);
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
file = disk_get_file_by_id(disk, irp->FileId);
@@ -581,12 +579,14 @@ static void disk_process_irp_list(DISK_DEVICE* disk)
while (1)
{
if (freerdp_thread_is_stopped(disk->thread))
if (WaitForSingleObject(disk->stopEvent, 0) == WAIT_OBJECT_0)
break;
freerdp_thread_lock(disk->thread);
irp = (IRP*)list_dequeue(disk->irp_list);
freerdp_thread_unlock(disk->thread);
WaitForSingleObject(disk->mutex, INFINITE);
irp = (IRP*) list_dequeue(disk->irp_list);
ReleaseMutex(disk->mutex);
if (irp == NULL)
break;
@@ -597,63 +597,75 @@ static void disk_process_irp_list(DISK_DEVICE* disk)
static void* disk_thread_func(void* arg)
{
DISK_DEVICE* disk = (DISK_DEVICE*)arg;
DISK_DEVICE* disk = (DISK_DEVICE*) arg;
while (1)
{
freerdp_thread_wait(disk->thread);
WaitForSingleObject(disk->irpEvent, INFINITE);
if (freerdp_thread_is_stopped(disk->thread))
if (WaitForSingleObject(disk->stopEvent, 0) == WAIT_OBJECT_0)
break;
freerdp_thread_reset(disk->thread);
ResetEvent(disk->irpEvent);
disk_process_irp_list(disk);
}
freerdp_thread_quit(disk->thread);
return NULL;
}
static void disk_irp_request(DEVICE* device, IRP* irp)
{
DISK_DEVICE* disk = (DISK_DEVICE*)device;
DISK_DEVICE* disk = (DISK_DEVICE*) device;
freerdp_thread_lock(disk->thread);
WaitForSingleObject(disk->mutex, INFINITE);
list_enqueue(disk->irp_list, irp);
freerdp_thread_unlock(disk->thread);
ReleaseMutex(disk->mutex);
freerdp_thread_signal(disk->thread);
SetEvent(disk->irpEvent);
}
static void disk_free(DEVICE* device)
{
DISK_DEVICE* disk = (DISK_DEVICE*)device;
IRP* irp;
DISK_FILE* file;
DISK_DEVICE* disk = (DISK_DEVICE*) device;
freerdp_thread_stop(disk->thread);
freerdp_thread_free(disk->thread);
SetEvent(disk->stopEvent);
CloseHandle(disk->thread);
CloseHandle(disk->irpEvent);
CloseHandle(disk->mutex);
while ((irp = (IRP*)list_dequeue(disk->irp_list)) != NULL)
while ((irp = (IRP*) list_dequeue(disk->irp_list)) != NULL)
irp->Discard(irp);
list_free(disk->irp_list);
while ((file = (DISK_FILE*)list_dequeue(disk->files)) != NULL)
while ((file = (DISK_FILE*) list_dequeue(disk->files)) != NULL)
disk_file_free(file);
list_free(disk->files);
xfree(disk);
}
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char *name, char *path)
{
DISK_DEVICE* disk;
char* name;
char* path;
int i, len;
int i, length ;
name = (char*)pEntryPoints->plugin_data->data[1];
path = (char*)pEntryPoints->plugin_data->data[2];
#ifdef WIN32
/*
* We cannot enter paths like c:\ because : is an arg separator
* thus, paths are entered as c+\ and the + is substituted here
*/
if ( path[1] == '+' )
{
if ( (path[0]>='a' && path[0]<='z') || (path[0]>='A' && path[0]<='Z') )
{
path[1] = ':';
}
}
#endif
if (name[0] && path[0])
{
@@ -664,21 +676,82 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
disk->device.IRPRequest = disk_irp_request;
disk->device.Free = disk_free;
len = strlen(name);
disk->device.data = stream_new(len + 1);
for (i = 0; i <= len; i++)
length = strlen(name);
disk->device.data = stream_new(length + 1);
for (i = 0; i <= length; i++)
stream_write_uint8(disk->device.data, name[i] < 0 ? '_' : name[i]);
disk->path = path;
disk->files = list_new();
disk->irp_list = list_new();
disk->thread = freerdp_thread_new();
disk->mutex = CreateMutex(NULL, FALSE, NULL);
disk->irpEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
disk->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
disk->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) disk_thread_func, disk, CREATE_SUSPENDED, NULL);
pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*)disk);
pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*) disk);
freerdp_thread_start(disk->thread, disk_thread_func, disk);
ResumeThread(disk->thread);
}
return 0;
}
#ifdef WITH_STATIC_PLUGINS
int disk_entry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
#else
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
#endif
{
char* name;
char* path;
#ifdef WIN32
char devlist[512], buf[512];
char *dev;
int len ;
#endif
name = (char*) pEntryPoints->plugin_data->data[1];
path = (char*) pEntryPoints->plugin_data->data[2];
#ifndef WIN32
disk_register_disk_path(pEntryPoints, name, path);
#else
/* Special case: path[0] == '*' -> export all drives */
/* Special case: path[0] == '%' -> user home dir */
if( path[0] == '%' )
{
_snprintf(buf, sizeof(buf), "%s\\", getenv("USERPROFILE"));
disk_register_disk_path(pEntryPoints, name, xstrdup(buf));
}
else if( path[0] == '*' )
{
int i;
/* Enumerate all devices: */
GetLogicalDriveStringsA(sizeof(devlist) - 1, devlist);
for (dev = devlist, i = 0; *dev; dev += 4, i++)
{
if (*dev > 'B')
{
/* Suppress disk drives A and B to avoid pesty messages */
_snprintf(buf, sizeof(buf) - 4, "%s", name);
len = strlen(buf);
buf[len] = '_';
buf[len + 1] = dev[0];
buf[len + 2] = 0;
buf[len + 3] = 0;
disk_register_disk_path(pEntryPoints, xstrdup(buf), xstrdup(dev));
}
}
}
else
{
disk_register_disk_path(pEntryPoints, name, path);
}
#endif
return 0;
}

View File

@@ -0,0 +1,57 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* statvfs emulation für windows
*
* Copyright 2012 Gerald Richter
*
* 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 <string.h>
#include <malloc.h>
#include <winpr/crt.h>
#include <winpr/windows.h>
#include "statvfs.h"
int statvfs(const char *path, struct statvfs *buf)
{
BOOL res;
int len;
LPWSTR unicodestr;
DWORD lpSectorsPerCluster;
DWORD lpBytesPerSector;
DWORD lpNumberOfFreeClusters;
DWORD lpTotalNumberOfClusters;
len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
unicodestr = (LPWSTR) malloc(len);
MultiByteToWideChar(CP_ACP, 0, path, -1, unicodestr, len);
res = GetDiskFreeSpace(unicodestr, &lpSectorsPerCluster, &lpBytesPerSector, &lpNumberOfFreeClusters, &lpTotalNumberOfClusters);
buf->f_bsize = lpBytesPerSector; /* file system block size */
buf->f_frsize = 0; /* fragment size */
buf->f_blocks = lpTotalNumberOfClusters; /* size of fs in f_frsize units */
buf->f_bfree = lpNumberOfFreeClusters; /* # free blocks */
buf->f_bavail = lpNumberOfFreeClusters; /* # free blocks for unprivileged users */
buf->f_files = 0; /* # inodes */
buf->f_ffree = 0; /* # free inodes */
buf->f_favail = 0; /* # free inodes for unprivileged users */
buf->f_fsid = lpNumberOfFreeClusters & 0xffff; /* file system ID */
buf->f_flag = 0; /* mount flags */
buf->f_namemax = 250; /* maximum filename length */
return res;
}

View File

@@ -0,0 +1,50 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* statvfs emulation for windows
*
* Copyright 2012 Gerald Richter
*
* 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 RDPDR_DISK_STATVFS_H
#define RDPDR_DISK_STATVFS_H
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long long fsblkcnt_t;
typedef unsigned long long fsfilcnt_t;
struct statvfs {
unsigned long f_bsize; /* file system block size */
unsigned long f_frsize; /* fragment size */
fsblkcnt_t f_blocks; /* size of fs in f_frsize units */
fsblkcnt_t f_bfree; /* # free blocks */
fsblkcnt_t f_bavail; /* # free blocks for unprivileged users */
fsfilcnt_t f_files; /* # inodes */
fsfilcnt_t f_ffree; /* # free inodes */
fsfilcnt_t f_favail; /* # free inodes for unprivileged users */
unsigned long f_fsid; /* file system ID */
unsigned long f_flag; /* mount flags */
unsigned long f_namemax; /* maximum filename length */
};
int statvfs(const char *path, struct statvfs *buf);
#ifdef __cplusplus
}
#endif
#endif /* RDPDR_DISK_STATVFS_H */

View File

@@ -50,6 +50,7 @@
#include <freerdp/utils/thread.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/unicode.h>
#include <freerdp/utils/svc_plugin.h>
#include "rdpdr_constants.h"
@@ -70,18 +71,15 @@ typedef struct _PARALLEL_DEVICE PARALLEL_DEVICE;
static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
{
uint32 PathLength;
char* path;
UNICONV* uniconv;
uint32 PathLength;
stream_seek(irp->input, 28);
/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */
/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
stream_read_uint32(irp->input, PathLength);
uniconv = freerdp_uniconv_new();
path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength);
freerdp_uniconv_free(uniconv);
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
parallel->id = irp->devman->id_sequence++;
parallel->file = open(parallel->path, O_RDWR);

View File

@@ -31,6 +31,13 @@ if(WITH_CUPS)
add_definitions(-DWITH_CUPS)
endif()
if(WIN32)
set(PRINTER_SRCS
${PRINTER_SRCS}
printer_win.c
printer_win.h)
endif()
include_directories(..)
add_library(printer ${PRINTER_SRCS})

View File

@@ -40,6 +40,10 @@
#include "printer_main.h"
#ifdef WIN32
#include "printer_win.h"
#endif
typedef struct _PRINTER_DEVICE PRINTER_DEVICE;
struct _PRINTER_DEVICE
{
@@ -230,16 +234,15 @@ static void printer_free(DEVICE* device)
void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* printer)
{
PRINTER_DEVICE* printer_dev;
char* port;
UNICONV* uniconv;
uint32 Flags;
size_t DriverNameLen;
char* DriverName;
size_t PrintNameLen;
char* PrintName;
int DriverNameLen;
WCHAR* DriverName;
int PrintNameLen;
WCHAR* PrintName;
uint32 CachedFieldsLen;
uint8* CachedPrinterConfigData;
PRINTER_DEVICE* printer_dev;
port = xmalloc(10);
snprintf(port, 10, "PRN%d", printer->id);
@@ -259,13 +262,12 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
DEBUG_SVC("Printer %s registered", printer->name);
Flags = 0;
if (printer->is_default)
Flags |= RDPDR_PRINTER_ANNOUNCE_FLAG_DEFAULTPRINTER;
uniconv = freerdp_uniconv_new();
DriverName = freerdp_uniconv_out(uniconv, printer->driver, &DriverNameLen);
PrintName = freerdp_uniconv_out(uniconv, printer->name, &PrintNameLen);
freerdp_uniconv_free(uniconv);
DriverNameLen = freerdp_AsciiToUnicodeAlloc(printer->driver, &DriverName, 0) * 2;
PrintNameLen = freerdp_AsciiToUnicodeAlloc(printer->name, &PrintName, 0) * 2;
printer_dev->device.data = stream_new(28 + DriverNameLen + PrintNameLen + CachedFieldsLen);
@@ -279,6 +281,7 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
stream_write_uint16(printer_dev->device.data, 0);
stream_write(printer_dev->device.data, PrintName, PrintNameLen);
stream_write_uint16(printer_dev->device.data, 0);
if (CachedFieldsLen > 0)
{
stream_write(printer_dev->device.data, CachedPrinterConfigData, CachedFieldsLen);
@@ -295,7 +298,11 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
freerdp_thread_start(printer_dev->thread, printer_thread_func, printer_dev);
}
#ifdef WITH_STATIC_PLUGINS
int printer_entry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
#else
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
#endif
{
rdpPrinterDriver* driver = NULL;
rdpPrinter** printers;
@@ -306,6 +313,9 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
#ifdef WITH_CUPS
driver = printer_cups_get_driver();
#endif
#ifdef WIN32
driver = printer_win_get_driver();
#endif
if (driver == NULL)
{

View File

@@ -0,0 +1,283 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* Print Virtual Channel - WIN driver
*
* Copyright 2012 Gerald Richter
*
* 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 <windows.h>
#include <winspool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "config.h"
#include <freerdp/utils/memory.h>
#include <freerdp/utils/svc_plugin.h>
#include "rdpdr_types.h"
#include "printer_main.h"
#include "printer_win.h"
typedef struct rdp_win_printer_driver rdpWinPrinterDriver;
typedef struct rdp_win_printer rdpWinPrinter;
typedef struct rdp_win_print_job rdpWinPrintJob;
struct rdp_win_printer_driver
{
rdpPrinterDriver driver;
int id_sequence;
};
struct rdp_win_printer
{
rdpPrinter printer;
HANDLE hPrinter;
rdpWinPrintJob* printjob;
};
struct rdp_win_print_job
{
rdpPrintJob printjob;
DOC_INFO_1 di;
DWORD handle;
void* printjob_object;
int printjob_id;
};
static void printer_win_get_printjob_name(char* buf, int size)
{
time_t tt;
struct tm* t;
DEBUG_WINPR("");
tt = time(NULL);
t = localtime(&tt);
snprintf(buf, size - 1, "FreeRDP Print Job %d%02d%02d%02d%02d%02d",
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
DEBUG_WINPR("buf: %s", buf);
}
static void printer_win_write_printjob(rdpPrintJob* printjob, uint8* data, int size)
{
rdpWinPrintJob* win_printjob = (rdpWinPrintJob*)printjob;
LPVOID pBuf = data;
DWORD cbBuf = size;
DWORD pcWritten;
if( ! WritePrinter( ((rdpWinPrinter*)printjob->printer)->hPrinter, pBuf, cbBuf, &pcWritten ) )
DEBUG_WINPR("WritePrinter failed");
;
}
static void printer_win_close_printjob(rdpPrintJob* printjob)
{
rdpWinPrintJob* win_printjob = (rdpWinPrintJob*)printjob;
DEBUG_WINPR("");
if ( ! EndPagePrinter( ((rdpWinPrinter*)printjob->printer)->hPrinter ) )
DEBUG_WINPR("EndPagePrinter failed");;
if ( ! ClosePrinter( ((rdpWinPrinter*)printjob->printer)->hPrinter ) )
DEBUG_WINPR("ClosePrinter failed");;
((rdpWinPrinter*)printjob->printer)->printjob = NULL;
xfree(win_printjob) ;
}
static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, uint32 id)
{
rdpWinPrinter* win_printer = (rdpWinPrinter*)printer;
rdpWinPrintJob* win_printjob;
DEBUG_WINPR("");
if (win_printer->printjob != NULL)
return NULL;
win_printjob = xnew(rdpWinPrintJob);
win_printjob->printjob.id = id;
win_printjob->printjob.printer = printer;
win_printjob->di.pDocName = L"FREERDPjob";
win_printjob->di.pDatatype= NULL;
win_printjob->di.pOutputFile = NULL;
win_printjob->handle = StartDocPrinter(win_printer->hPrinter, 1, (LPBYTE)&(win_printjob->di) );
if(! win_printjob->handle) DEBUG_WINPR("StartDocPrinter failed");
if ( ! StartPagePrinter(win_printer->hPrinter) )
DEBUG_WINPR("ClosePrinter failed");
win_printjob->printjob.Write = printer_win_write_printjob;
win_printjob->printjob.Close = printer_win_close_printjob;
win_printer->printjob = win_printjob;
return (rdpPrintJob*)win_printjob;
}
static rdpPrintJob* printer_win_find_printjob(rdpPrinter* printer, uint32 id)
{
rdpWinPrinter* win_printer = (rdpWinPrinter*)printer;
DEBUG_WINPR("");
if (win_printer->printjob == NULL)
return NULL;
if (win_printer->printjob->printjob.id != id)
return NULL;
return (rdpPrintJob*)win_printer->printjob;
}
static void printer_win_free_printer(rdpPrinter* printer)
{
rdpWinPrinter* win_printer = (rdpWinPrinter*)printer;
DEBUG_WINPR("");
if (win_printer->printjob)
win_printer->printjob->printjob.Close((rdpPrintJob*)win_printer->printjob);
xfree(printer->name);
xfree(printer);
}
static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, const char* name, const wchar_t* drivername, boolean is_default)
{
rdpWinPrinter* win_printer;
wchar_t wname[256];
DWORD needed;
PRINTER_INFO_2 *prninfo=NULL;
size_t charsConverted;
DEBUG_WINPR("");
win_printer = xnew(rdpWinPrinter);
win_printer->printer.id = win_driver->id_sequence++;
win_printer->printer.name = xstrdup(name);
win_printer->printer.is_default = is_default;
win_printer->printer.CreatePrintJob = printer_win_create_printjob;
win_printer->printer.FindPrintJob = printer_win_find_printjob;
win_printer->printer.Free = printer_win_free_printer;
swprintf(wname, 256, L"%hs", name);
OpenPrinter(wname, &(win_printer->hPrinter), NULL);
DEBUG_WINPR("handle: 0x%08X", win_printer->hPrinter);
GetPrinter(win_printer->hPrinter, 2, (LPBYTE) prninfo, 0, &needed);
prninfo = (PRINTER_INFO_2*) GlobalAlloc(GPTR,needed);
GetPrinter(win_printer->hPrinter, 2, (LPBYTE) prninfo, needed, &needed);
win_printer->printer.driver = xmalloc(1000);
wcstombs_s(&charsConverted, win_printer->printer.driver, 1000, prninfo->pDriverName, _TRUNCATE);
return (rdpPrinter*)win_printer;
}
static rdpPrinter** printer_win_enum_printers(rdpPrinterDriver* driver)
{
rdpPrinter** printers;
int num_printers;
int i;
char pname[1000];
size_t charsConverted;
PRINTER_INFO_2 *prninfo=NULL;
DWORD needed, returned;
DEBUG_WINPR("");
//find required size for the buffer
EnumPrinters(PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS, NULL, 2, NULL, 0, &needed, &returned);
//allocate array of PRINTER_INFO structures
prninfo = (PRINTER_INFO_2*) GlobalAlloc(GPTR,needed);
//call again
if ( !EnumPrinters(PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS, NULL, 2, (LPBYTE) prninfo, needed, &needed, &returned) ) {
DEBUG_WINPR("EnumPrinters failed");
} ; /* eRROR... */
DEBUG_WINPR("printers found: %d", returned);
printers = (rdpPrinter**)xzalloc(sizeof(rdpPrinter*) * (returned + 1));
num_printers = 0;
for (i = 0; i < (int)returned; i++)
{
wcstombs_s(&charsConverted, pname, 1000, prninfo[i].pPrinterName, _TRUNCATE);
printers[num_printers++] = printer_win_new_printer((rdpWinPrinterDriver*)driver,
pname, prninfo[i].pDriverName, 0);
}
GlobalFree(prninfo);
return printers;
}
static rdpPrinter* printer_win_get_printer(rdpPrinterDriver* driver, const char* name)
{
rdpWinPrinterDriver* win_driver = (rdpWinPrinterDriver*)driver;
rdpPrinter *myPrinter = NULL;
DEBUG_WINPR("printer %s", name);
myPrinter = printer_win_new_printer(win_driver, name, L"", win_driver->id_sequence == 1 ? true : false);
return myPrinter;
}
static rdpWinPrinterDriver* win_driver = NULL;
rdpPrinterDriver* printer_win_get_driver(void)
{
DEBUG_WINPR("");
if (win_driver == NULL)
{
win_driver = xnew(rdpWinPrinterDriver);
win_driver->driver.EnumPrinters = printer_win_enum_printers;
win_driver->driver.GetPrinter = printer_win_get_printer;
win_driver->id_sequence = 1;
//#ifdef _win_API_1_4
// DEBUG_SVC("using win API 1.4");
//#else
// DEBUG_SVC("using win API 1.2");
//#endif
}
return (rdpPrinterDriver*)win_driver;
}

View File

@@ -1,8 +1,8 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* Packed Encoding Rules (PER) Unit Tests
* FreeRDP: A Remote Desktop Protocol client.
* Print Virtual Channel - win driver
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2012 Gerald Richter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,21 @@
* limitations under the License.
*/
#include "test_freerdp.h"
#ifndef __PRINTER_WIN_H
#define __PRINTER_WIN_H
int init_per_suite(void);
int clean_per_suite(void);
int add_per_suite(void);
void test_per_write_length(void);
void test_per_write_object_identifier(void);
rdpPrinterDriver* printer_win_get_driver(void);
#ifdef WITH_DEBUG_WINPR
#define DEBUG_WINPR(fmt, ...) DEBUG_CLASS(WINPR, fmt, ## __VA_ARGS__)
#else
#define DEBUG_WINPR(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#endif
#endif
#ifdef WIN32
#define snprintf _snprintf
#endif

View File

@@ -94,17 +94,15 @@ static void rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
{
char* s;
STREAM* data_out;
UNICONV* uniconv;
WCHAR* computerNameW;
size_t computerNameLenW;
uniconv = freerdp_uniconv_new();
if (!rdpdr->computerName[0])
gethostname(rdpdr->computerName, sizeof(rdpdr->computerName) - 1);
s = freerdp_uniconv_out(uniconv, rdpdr->computerName, &computerNameLenW);
computerNameLenW = freerdp_AsciiToUnicodeAlloc(rdpdr->computerName, &computerNameW, 0) * 2;
data_out = stream_new(16 + computerNameLenW + 2);
stream_write_uint16(data_out, RDPDR_CTYP_CORE);
@@ -113,11 +111,10 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
stream_write_uint32(data_out, 1); /* unicodeFlag, 0 for ASCII and 1 for Unicode */
stream_write_uint32(data_out, 0); /* codePage, must be set to zero */
stream_write_uint32(data_out, computerNameLenW + 2); /* computerNameLen, including null terminator */
stream_write(data_out, s, computerNameLenW);
stream_write(data_out, computerNameW, computerNameLenW);
stream_write_uint16(data_out, 0); /* null terminator */
xfree(s);
freerdp_uniconv_free(uniconv);
xfree(computerNameW);
svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out);
}
@@ -235,11 +232,11 @@ static boolean rdpdr_process_irp(rdpdrPlugin* rdpdr, STREAM* data_in)
static void rdpdr_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
{
rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin;
uint16 component;
uint16 packetID;
uint32 deviceID;
uint32 status;
rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin;
stream_read_uint16(data_in, component);
stream_read_uint16(data_in, packetID);

View File

@@ -79,23 +79,21 @@ static boolean serial_check_fds(SERIAL_DEVICE* serial);
static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
{
char* path;
SERIAL_TTY* tty;
uint32 PathLength;
uint32 FileId;
char* path;
UNICONV* uniconv;
stream_seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */
/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
stream_read_uint32(irp->input, PathLength);
uniconv = freerdp_uniconv_new();
path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength);
freerdp_uniconv_free(uniconv);
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
FileId = irp->devman->id_sequence++;
tty = serial_tty_new(serial->path, FileId);
if (tty == NULL)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
@@ -122,6 +120,7 @@ static void serial_process_irp_close(SERIAL_DEVICE* serial, IRP* irp)
SERIAL_TTY* tty;
tty = serial->tty;
if (tty == NULL)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
@@ -153,6 +152,7 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
DEBUG_SVC("length %u offset %llu", Length, Offset);
tty = serial->tty;
if (tty == NULL)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
@@ -179,11 +179,13 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
}
stream_write_uint32(irp->output, Length);
if (Length > 0)
{
stream_check_size(irp->output, Length);
stream_write(irp->output, buffer, Length);
}
xfree(buffer);
irp->Complete(irp);
@@ -202,6 +204,7 @@ static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp)
DEBUG_SVC("length %u offset %llu", Length, Offset);
tty = serial->tty;
if (tty == NULL)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
@@ -243,6 +246,7 @@ static void serial_process_irp_device_control(SERIAL_DEVICE* serial, IRP* irp)
stream_seek(irp->input, 20); /* Padding */
tty = serial->tty;
if (tty == NULL)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;

View File

@@ -37,33 +37,34 @@
#include "scard_main.h"
static void
scard_free(DEVICE* dev)
static void scard_free(DEVICE* dev)
{
SCARD_DEVICE* scard = (SCARD_DEVICE*)dev;
IRP* irp;
COMPLETIONIDINFO* CompletionIdInfo;
SCARD_DEVICE* scard = (SCARD_DEVICE*) dev;
freerdp_thread_stop(scard->thread);
freerdp_thread_free(scard->thread);
while ((irp = (IRP*)list_dequeue(scard->irp_list)) != NULL)
while ((irp = (IRP*) list_dequeue(scard->irp_list)) != NULL)
irp->Discard(irp);
list_free(scard->irp_list);
/* Begin TS Client defect workaround. */
while ((CompletionIdInfo = (COMPLETIONIDINFO*)list_dequeue(scard->CompletionIds)) != NULL)
while ((CompletionIdInfo = (COMPLETIONIDINFO*) list_dequeue(scard->CompletionIds)) != NULL)
xfree(CompletionIdInfo);
list_free(scard->CompletionIds);
/* End TS Client defect workaround. */
xfree(dev);
return;
}
static void
scard_process_irp(SCARD_DEVICE* scard, IRP* irp)
static void scard_process_irp(SCARD_DEVICE* scard, IRP* irp)
{
switch (irp->MajorFunction)
{
@@ -80,16 +81,14 @@ scard_process_irp(SCARD_DEVICE* scard, IRP* irp)
}
}
static void
scard_process_irp_list(SCARD_DEVICE* scard)
static void scard_process_irp_list(SCARD_DEVICE* scard)
{
IRP *irp;
IRP* irp;
while (!freerdp_thread_is_stopped(scard->thread))
{
freerdp_thread_lock(scard->thread);
irp = (IRP *) list_dequeue(scard->irp_list);
irp = (IRP*) list_dequeue(scard->irp_list);
freerdp_thread_unlock(scard->thread);
if (irp == NULL)
@@ -99,16 +98,14 @@ scard_process_irp_list(SCARD_DEVICE* scard)
}
}
struct scard_irp_thread_args {
struct scard_irp_thread_args
{
SCARD_DEVICE* scard;
IRP* irp;
freerdp_thread* thread;
};
static void
scard_process_irp_thread_func(struct scard_irp_thread_args* args)
static void scard_process_irp_thread_func(struct scard_irp_thread_args* args)
{
scard_process_irp(args->scard, args->irp);
@@ -116,9 +113,7 @@ scard_process_irp_thread_func(struct scard_irp_thread_args* args)
xfree(args);
}
static void *
scard_thread_func(void* arg)
static void* scard_thread_func(void* arg)
{
SCARD_DEVICE* scard = (SCARD_DEVICE*) arg;
@@ -138,16 +133,14 @@ scard_thread_func(void* arg)
return NULL;
}
/* Begin TS Client defect workaround. */
static COMPLETIONIDINFO*
scard_mark_duplicate_id(SCARD_DEVICE* scard, uint32 CompletionId)
static COMPLETIONIDINFO* scard_mark_duplicate_id(SCARD_DEVICE* scard, uint32 CompletionId)
{
/*
* Search from the beginning of the LIST for one outstanding "CompletionID"
* that matches the one passed in. If there is one, mark it as a duplicate
* if it is not already marked.
*/
/*
* Search from the beginning of the LIST for one outstanding "CompletionID"
* that matches the one passed in. If there is one, mark it as a duplicate
* if it is not already marked.
*/
LIST_ITEM* item;
COMPLETIONIDINFO* CompletionIdInfo;
@@ -164,18 +157,18 @@ scard_mark_duplicate_id(SCARD_DEVICE* scard, uint32 CompletionId)
return CompletionIdInfo;
}
}
return NULL; /* Either no items in the list or no match. */
}
static boolean
scard_check_for_duplicate_id(SCARD_DEVICE* scard, uint32 CompletionId)
static boolean scard_check_for_duplicate_id(SCARD_DEVICE* scard, uint32 CompletionId)
{
/*
* Search from the end of the LIST for one outstanding "CompletionID"
* that matches the one passed in. Remove it from the list and free the
* memory associated with it. Return whether or not it was marked
* as a duplicate.
*/
/*
* Search from the end of the LIST for one outstanding "CompletionID"
* that matches the one passed in. Remove it from the list and free the
* memory associated with it. Return whether or not it was marked
* as a duplicate.
*/
LIST_ITEM* item;
COMPLETIONIDINFO* CompletionIdInfo;
boolean duplicate;
@@ -195,21 +188,22 @@ scard_check_for_duplicate_id(SCARD_DEVICE* scard, uint32 CompletionId)
return duplicate;
}
}
/* This function should only be called when there is
* at least one outstanding CompletionID item in the list.
*/
DEBUG_WARN("Error!!! No CompletionIDs (or no matching IDs) in the list!");
return false;
}
static void
scard_irp_complete(IRP* irp)
static void scard_irp_complete(IRP* irp)
{
/* This function is (mostly) a copy of the statically-declared "irp_complete()"
* function except that this function adds extra operations for the
* smart card's handling of duplicate "CompletionID"s. This function needs
* to be in this file so that "scard_irp_request()" can reference it.
*/
/* This function is (mostly) a copy of the statically-declared "irp_complete()"
* function except that this function adds extra operations for the
* smart card's handling of duplicate "CompletionID"s. This function needs
* to be in this file so that "scard_irp_request()" can reference it.
*/
int pos;
boolean duplicate;
SCARD_DEVICE* scard = (SCARD_DEVICE*)irp->device;
@@ -247,13 +241,10 @@ scard_irp_complete(IRP* irp)
}
/* End TS Client defect workaround. */
static void
scard_irp_request(DEVICE* device, IRP* irp)
static void scard_irp_request(DEVICE* device, IRP* irp)
{
COMPLETIONIDINFO* CompletionIdInfo;
SCARD_DEVICE* scard = (SCARD_DEVICE*)device;
SCARD_DEVICE* scard = (SCARD_DEVICE*) device;
/* Begin TS Client defect workaround. */
CompletionIdInfo= xnew(COMPLETIONIDINFO);

View File

@@ -28,12 +28,14 @@
#include <string.h>
#include <unistd.h>
#include <strings.h>
#include <semaphore.h>
#include <pthread.h>
#include <semaphore.h>
#define BOOL PCSC_BOOL
#include <PCSC/pcsclite.h>
#include <PCSC/reader.h>
#include <PCSC/winscard.h>
#undef BOOL
#include <freerdp/freerdp.h>
#include <freerdp/utils/hexdump.h>
@@ -1368,10 +1370,15 @@ boolean scard_async_op(IRP* irp)
void scard_device_control(SCARD_DEVICE* scard, IRP* irp)
{
uint32 output_len, input_len, ioctl_code;
uint32 stream_len, result;
uint32 pos, pad_len;
uint32 irp_result_pos, output_len_pos, result_pos;
uint32 pos;
uint32 result;
uint32 result_pos;
uint32 output_len;
uint32 input_len;
uint32 ioctl_code;
uint32 stream_len;
uint32 irp_result_pos;
uint32 output_len_pos;
const uint32 header_lengths = 16; /* MS-RPCE, Sections 2.2.6.1
* and 2.2.6.2.
*/

View File

@@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,30 +15,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(RDPSND_SRCS
rdpsnd_main.c
rdpsnd_main.h)
set(MODULE_NAME "rdpsnd")
set(MODULE_PREFIX "CHANNEL_RDPSND")
add_library(rdpsnd ${RDPSND_SRCS})
set_target_properties(rdpsnd PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(rdpsnd freerdp)
else()
target_link_libraries(rdpsnd freerdp-utils)
if(WITH_CLIENT_CHANNELS)
add_subdirectory(client)
endif()
install(TARGETS rdpsnd DESTINATION ${FREERDP_PLUGIN_PATH})
if(WITH_ALSA)
add_subdirectory(alsa)
if(WITH_SERVER_CHANNELS)
add_subdirectory(server)
set(${MODULE_PREFIX}_SERVER_SRCS ${${MODULE_PREFIX}_SERVER_SRCS} PARENT_SCOPE)
set(${MODULE_PREFIX}_SERVER_LIBS ${${MODULE_PREFIX}_SERVER_LIBS} PARENT_SCOPE)
set(CHANNEL_BUILTIN_SERVER_MODULES ${CHANNEL_BUILTIN_SERVER_MODULES} ${MODULE_NAME} PARENT_SCOPE)
endif()
if(WITH_PULSEAUDIO)
add_subdirectory(pulse)
endif()
if(WITH_MACAUDIO)
add_subdirectory(mac_audio)
endif()

View File

@@ -0,0 +1,14 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "rdpsnd")
set(CHANNEL_LONG_NAME "Audio Output Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPEA]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
if(WIN32)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
endif()

View File

@@ -1,5 +1,5 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP Test UI cmake build script
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
@@ -17,21 +17,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(FREERDP_CLIENT_TEST_SRCS
freerdp.c)
set(RDPSND_SRCS
rdpsnd_main.c
rdpsnd_main.h)
add_executable(freerdp-test ${FREERDP_CLIENT_TEST_SRCS})
set(FREERDP_CLIENT_TEST_LIBS ${FREERDP_CLIENT_TEST_LIBS} ${CMAKE_DL_LIBS})
add_library(rdpsnd ${RDPSND_SRCS})
set_target_properties(rdpsnd PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
set(FREERDP_CLIENT_TEST_LIBS ${FREERDP_CLIENT_TEST_LIBS} freerdp)
target_link_libraries(rdpsnd freerdp)
else()
set(FREERDP_CLIENT_TEST_LIBS ${FREERDP_CLIENT_TEST_LIBS}
freerdp-core
freerdp-gdi
freerdp-utils
freerdp-channels)
target_link_libraries(rdpsnd freerdp-utils)
endif()
install(TARGETS rdpsnd DESTINATION ${FREERDP_PLUGIN_PATH})
if(WITH_ALSA)
add_subdirectory(alsa)
endif()
if(WITH_PULSEAUDIO)
add_subdirectory(pulse)
endif()
if(WITH_MACAUDIO)
add_subdirectory(mac_audio)
endif()
target_link_libraries(freerdp-test ${FREERDP_CLIENT_TEST_LIBS})

View File

@@ -0,0 +1,29 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# 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.
set(MODULE_PREFIX "CHANNEL_RDPSND_SERVER")
set(${MODULE_PREFIX}_SRCS
rdpsnd.c
PARENT_SCOPE)
if(WITH_MONOLITHIC_BUILD)
set(${MODULE_PREFIX}_LIBS freerdp PARENT_SCOPE)
else()
set(${MODULE_PREFIX}_LIBS freerdp-utils PARENT_SCOPE)
endif()

View File

@@ -0,0 +1,21 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# 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.
if(WITH_CLIENT_CHANNELS)
add_subdirectory(client)
endif()

View File

@@ -0,0 +1,9 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "sample")
set(CHANNEL_LONG_NAME "Sample Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)

View File

@@ -0,0 +1,37 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# 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.
set(MODULE_NAME "freerdp-server-channels")
set(MODULE_PREFIX "FREERDP_SERVER_CHANNELS")
foreach(_MODULE_NAME ${CHANNEL_BUILTIN_SERVER_MODULES})
string(TOUPPER "CHANNEL_${_MODULE_NAME}" _MODULE_PREFIX)
message(STATUS "Adding built-in channel server module: ${_MODULE_NAME}")
foreach(SRC ${${_MODULE_PREFIX}_SERVER_SRCS})
set(CHANNEL_SERVER_SRCS ${CHANNEL_SERVER_SRCS} "../${_MODULE_NAME}/server/${SRC}")
endforeach()
set(CHANNEL_SERVER_LIBS ${CHANNEL_SERVER_LIBS} ${${_MODULE_PREFIX}_SERVER_LIBS})
endforeach()
add_library(${MODULE_NAME} ${CHANNEL_SERVER_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
target_link_libraries(${MODULE_NAME} ${CHANNEL_SERVER_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@@ -0,0 +1,22 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# 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.
if(WITH_CLIENT_CHANNELS)
add_subdirectory(client)
endif()

View File

@@ -0,0 +1,15 @@
set(CHANNEL_TYPE "dynamic")
set(CHANNEL_SHORT_NAME "tsmf")
set(CHANNEL_LONG_NAME "Video Redirection Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPEV]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
if(WIN32)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
endif()

Some files were not shown because too many files have changed in this diff Show More