Merge pull request #763 from FreeRDP/channels
Major Refactoring + Static Channel System
This commit is contained in:
commit
ce13f39de2
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
# CMake
|
||||
CMakeFiles/
|
||||
CMakeScripts/
|
||||
CMakeCache.txt
|
||||
config.h
|
||||
install_manifest.txt
|
||||
@ -23,6 +24,7 @@ client/X11/xfreerdp.1
|
||||
|
||||
# Mac OS X
|
||||
.DS_Store
|
||||
*.xcodeproj/
|
||||
|
||||
# Windows
|
||||
*.vcxproj
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2011 O.S. Systems Software Ltda.
|
||||
@ -18,8 +18,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(FreeRDP C)
|
||||
|
||||
set(CMAKE_COLOR_MAKEFILE ON)
|
||||
|
||||
# Include cmake modules
|
||||
@ -62,8 +64,8 @@ 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)
|
||||
if(NOT BUILD_SHARED_LIBS AND MONOLITHIC_BUILD)
|
||||
set(STATIC_CHANNELS ON)
|
||||
endif()
|
||||
|
||||
# Configure MSVC Runtime
|
||||
@ -171,12 +173,23 @@ if(NOT WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX})
|
||||
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX})
|
||||
set(CMAKE_INSTALL_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX})
|
||||
endif()
|
||||
|
||||
# Path to put FreeRDP data
|
||||
set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/freerdp")
|
||||
set(FREERDP_KEYMAP_PATH "${FREERDP_DATA_PATH}/keymaps")
|
||||
|
||||
# Path to put plugins
|
||||
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp")
|
||||
if(WIN32)
|
||||
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||
else()
|
||||
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp")
|
||||
endif()
|
||||
|
||||
set(FREERDP_CLIENT_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}/client")
|
||||
set(FREERDP_SERVER_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}/server")
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
set(FILENAME "ChannelOptions.cmake")
|
||||
file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}")
|
||||
|
||||
@ -30,6 +32,11 @@ foreach(FILEPATH ${FILEPATHS})
|
||||
endif()
|
||||
endforeach(FILEPATH)
|
||||
|
||||
if(WITH_CLIENT_CHANNELS)
|
||||
add_subdirectory(client)
|
||||
endif()
|
||||
|
||||
if(WITH_SERVER_CHANNELS)
|
||||
add_subdirectory(server)
|
||||
endif()
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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,22 +15,27 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(AUDIN_SRCS
|
||||
set(MODULE_NAME "audin")
|
||||
set(MODULE_PREFIX "CHANNEL_AUDIN_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
audin_main.c
|
||||
audin_main.h)
|
||||
|
||||
include_directories(..)
|
||||
|
||||
add_library(audin ${AUDIN_SRCS})
|
||||
set_target_properties(audin PROPERTIES PREFIX "")
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(audin freerdp)
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp)
|
||||
else()
|
||||
target_link_libraries(audin freerdp-utils)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils)
|
||||
endif()
|
||||
|
||||
install(TARGETS audin DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
||||
|
||||
if(WITH_ALSA)
|
||||
add_subdirectory(alsa)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2011 O.S. Systems Software Ltda.
|
||||
@ -26,7 +26,7 @@ include_directories(${ALSA_INCLUDE_DIRS})
|
||||
add_library(audin_alsa ${AUDIN_ALSA_SRCS})
|
||||
set_target_properties(audin_alsa PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(audin_alsa freerdp)
|
||||
else()
|
||||
target_link_libraries(audin_alsa freerdp-utils)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Input Redirection Virtual Channel - ALSA implementation
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -37,12 +37,12 @@ typedef struct _AudinALSADevice
|
||||
IAudinDevice iface;
|
||||
|
||||
char device_name[32];
|
||||
uint32 frames_per_packet;
|
||||
uint32 target_rate;
|
||||
uint32 actual_rate;
|
||||
UINT32 frames_per_packet;
|
||||
UINT32 target_rate;
|
||||
UINT32 actual_rate;
|
||||
snd_pcm_format_t format;
|
||||
uint32 target_channels;
|
||||
uint32 actual_channels;
|
||||
UINT32 target_channels;
|
||||
UINT32 actual_channels;
|
||||
int bytes_per_channel;
|
||||
int wformat;
|
||||
int block_size;
|
||||
@ -51,14 +51,14 @@ typedef struct _AudinALSADevice
|
||||
|
||||
freerdp_thread* thread;
|
||||
|
||||
uint8* buffer;
|
||||
BYTE* buffer;
|
||||
int buffer_frames;
|
||||
|
||||
AudinReceive receive;
|
||||
void* user_data;
|
||||
} AudinALSADevice;
|
||||
|
||||
static boolean audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_handle)
|
||||
static BOOL audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_handle)
|
||||
{
|
||||
int error;
|
||||
snd_pcm_hw_params_t* hw_params;
|
||||
@ -67,7 +67,7 @@ static boolean audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_h
|
||||
{
|
||||
DEBUG_WARN("snd_pcm_hw_params_malloc (%s)",
|
||||
snd_strerror(error));
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
snd_pcm_hw_params_any(capture_handle, hw_params);
|
||||
snd_pcm_hw_params_set_access(capture_handle, hw_params,
|
||||
@ -90,16 +90,16 @@ static boolean audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_h
|
||||
alsa->actual_rate, alsa->actual_channels,
|
||||
alsa->target_rate, alsa->target_channels);
|
||||
}
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static boolean audin_alsa_thread_receive(AudinALSADevice* alsa, uint8* src, int size)
|
||||
static BOOL audin_alsa_thread_receive(AudinALSADevice* alsa, BYTE* src, int size)
|
||||
{
|
||||
int frames;
|
||||
int cframes;
|
||||
int ret = 0;
|
||||
int encoded_size;
|
||||
uint8* encoded_data;
|
||||
BYTE* encoded_data;
|
||||
int rbytes_per_frame;
|
||||
int tbytes_per_frame;
|
||||
|
||||
@ -173,7 +173,7 @@ static boolean audin_alsa_thread_receive(AudinALSADevice* alsa, uint8* src, int
|
||||
static void* audin_alsa_thread_func(void* arg)
|
||||
{
|
||||
int error;
|
||||
uint8* buffer;
|
||||
BYTE* buffer;
|
||||
int rbytes_per_frame;
|
||||
int tbytes_per_frame;
|
||||
snd_pcm_t* capture_handle = NULL;
|
||||
@ -183,9 +183,9 @@ static void* audin_alsa_thread_func(void* arg)
|
||||
|
||||
rbytes_per_frame = alsa->actual_channels * alsa->bytes_per_channel;
|
||||
tbytes_per_frame = alsa->target_channels * alsa->bytes_per_channel;
|
||||
alsa->buffer = (uint8*) xzalloc(tbytes_per_frame * alsa->frames_per_packet);
|
||||
alsa->buffer = (BYTE*) xzalloc(tbytes_per_frame * alsa->frames_per_packet);
|
||||
alsa->buffer_frames = 0;
|
||||
buffer = (uint8*) xzalloc(rbytes_per_frame * alsa->frames_per_packet);
|
||||
buffer = (BYTE*) xzalloc(rbytes_per_frame * alsa->frames_per_packet);
|
||||
freerdp_dsp_context_reset_adpcm(alsa->dsp_context);
|
||||
do
|
||||
{
|
||||
@ -217,8 +217,8 @@ static void* audin_alsa_thread_func(void* arg)
|
||||
}
|
||||
} while (0);
|
||||
|
||||
xfree(buffer);
|
||||
xfree(alsa->buffer);
|
||||
free(buffer);
|
||||
free(alsa->buffer);
|
||||
alsa->buffer = NULL;
|
||||
if (capture_handle)
|
||||
snd_pcm_close(capture_handle);
|
||||
@ -236,10 +236,10 @@ static void audin_alsa_free(IAudinDevice* device)
|
||||
|
||||
freerdp_thread_free(alsa->thread);
|
||||
freerdp_dsp_context_free(alsa->dsp_context);
|
||||
xfree(alsa);
|
||||
free(alsa);
|
||||
}
|
||||
|
||||
static boolean audin_alsa_format_supported(IAudinDevice* device, audinFormat* format)
|
||||
static BOOL audin_alsa_format_supported(IAudinDevice* device, audinFormat* format)
|
||||
{
|
||||
switch (format->wFormatTag)
|
||||
{
|
||||
@ -249,7 +249,7 @@ static boolean audin_alsa_format_supported(IAudinDevice* device, audinFormat* fo
|
||||
(format->wBitsPerSample == 8 || format->wBitsPerSample == 16) &&
|
||||
(format->nChannels == 1 || format->nChannels == 2))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -258,14 +258,14 @@ static boolean audin_alsa_format_supported(IAudinDevice* device, audinFormat* fo
|
||||
(format->wBitsPerSample == 4) &&
|
||||
(format->nChannels == 1 || format->nChannels == 2))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void audin_alsa_set_format(IAudinDevice* device, audinFormat* format, uint32 FramesPerPacket)
|
||||
static void audin_alsa_set_format(IAudinDevice* device, audinFormat* format, UINT32 FramesPerPacket)
|
||||
{
|
||||
int bs;
|
||||
AudinALSADevice* alsa = (AudinALSADevice*) device;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Input Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -74,9 +74,9 @@ struct _AUDIN_PLUGIN
|
||||
AUDIN_LISTENER_CALLBACK* listener_callback;
|
||||
|
||||
/* Parsed plugin data */
|
||||
uint16 fixed_format;
|
||||
uint16 fixed_channel;
|
||||
uint32 fixed_rate;
|
||||
UINT16 fixed_format;
|
||||
UINT16 fixed_channel;
|
||||
UINT32 fixed_rate;
|
||||
|
||||
/* Device interface */
|
||||
IAudinDevice* device;
|
||||
@ -86,16 +86,16 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, S
|
||||
{
|
||||
int error;
|
||||
STREAM* out;
|
||||
uint32 Version;
|
||||
UINT32 Version;
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
|
||||
stream_read_uint32(s, Version);
|
||||
stream_read_UINT32(s, Version);
|
||||
|
||||
DEBUG_DVC("Version=%d", Version);
|
||||
|
||||
out = stream_new(5);
|
||||
stream_write_uint8(out, MSG_SNDIN_VERSION);
|
||||
stream_write_uint32(out, Version);
|
||||
stream_write_BYTE(out, MSG_SNDIN_VERSION);
|
||||
stream_write_UINT32(out, Version);
|
||||
error = callback->channel->Write(callback->channel, stream_get_length(s), stream_get_head(s), NULL);
|
||||
stream_free(out);
|
||||
|
||||
@ -104,7 +104,7 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, S
|
||||
|
||||
static int audin_send_incoming_data_pdu(IWTSVirtualChannelCallback* pChannelCallback)
|
||||
{
|
||||
uint8 out_data[1];
|
||||
BYTE out_data[1];
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
|
||||
out_data[0] = MSG_SNDIN_DATA_INCOMING;
|
||||
@ -115,22 +115,22 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, S
|
||||
{
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin;
|
||||
uint32 i;
|
||||
uint8* fm;
|
||||
UINT32 i;
|
||||
BYTE* fm;
|
||||
int error;
|
||||
STREAM* out;
|
||||
uint32 NumFormats;
|
||||
UINT32 NumFormats;
|
||||
audinFormat format;
|
||||
uint32 cbSizeFormatsPacket;
|
||||
UINT32 cbSizeFormatsPacket;
|
||||
|
||||
stream_read_uint32(s, NumFormats);
|
||||
stream_read_UINT32(s, NumFormats);
|
||||
DEBUG_DVC("NumFormats %d", NumFormats);
|
||||
if ((NumFormats < 1) || (NumFormats > 1000))
|
||||
{
|
||||
DEBUG_WARN("bad NumFormats %d", NumFormats);
|
||||
return 1;
|
||||
}
|
||||
stream_seek_uint32(s); /* cbSizeFormatsPacket */
|
||||
stream_seek_UINT32(s); /* cbSizeFormatsPacket */
|
||||
|
||||
callback->formats = (audinFormat*) xzalloc(NumFormats * sizeof(audinFormat));
|
||||
|
||||
@ -141,13 +141,13 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, S
|
||||
for (i = 0; i < NumFormats; i++)
|
||||
{
|
||||
stream_get_mark(s, fm);
|
||||
stream_read_uint16(s, format.wFormatTag);
|
||||
stream_read_uint16(s, format.nChannels);
|
||||
stream_read_uint32(s, format.nSamplesPerSec);
|
||||
stream_seek_uint32(s); /* nAvgBytesPerSec */
|
||||
stream_read_uint16(s, format.nBlockAlign);
|
||||
stream_read_uint16(s, format.wBitsPerSample);
|
||||
stream_read_uint16(s, format.cbSize);
|
||||
stream_read_UINT16(s, format.wFormatTag);
|
||||
stream_read_UINT16(s, format.nChannels);
|
||||
stream_read_UINT32(s, format.nSamplesPerSec);
|
||||
stream_seek_UINT32(s); /* nAvgBytesPerSec */
|
||||
stream_read_UINT16(s, format.nBlockAlign);
|
||||
stream_read_UINT16(s, format.wBitsPerSample);
|
||||
stream_read_UINT16(s, format.cbSize);
|
||||
format.data = stream_get_tail(s);
|
||||
stream_seek(s, format.cbSize);
|
||||
|
||||
@ -179,9 +179,9 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, S
|
||||
cbSizeFormatsPacket = stream_get_pos(out);
|
||||
stream_set_pos(out, 0);
|
||||
|
||||
stream_write_uint8(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */
|
||||
stream_write_uint32(out, callback->formats_count); /* NumFormats (4 bytes) */
|
||||
stream_write_uint32(out, cbSizeFormatsPacket); /* cbSizeFormatsPacket (4 bytes) */
|
||||
stream_write_BYTE(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */
|
||||
stream_write_UINT32(out, callback->formats_count); /* NumFormats (4 bytes) */
|
||||
stream_write_UINT32(out, cbSizeFormatsPacket); /* cbSizeFormatsPacket (4 bytes) */
|
||||
|
||||
error = callback->channel->Write(callback->channel, cbSizeFormatsPacket, stream_get_head(out), NULL);
|
||||
stream_free(out);
|
||||
@ -189,37 +189,37 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, S
|
||||
return error;
|
||||
}
|
||||
|
||||
static int audin_send_format_change_pdu(IWTSVirtualChannelCallback* pChannelCallback, uint32 NewFormat)
|
||||
static int audin_send_format_change_pdu(IWTSVirtualChannelCallback* pChannelCallback, UINT32 NewFormat)
|
||||
{
|
||||
int error;
|
||||
STREAM* out;
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
|
||||
out = stream_new(5);
|
||||
stream_write_uint8(out, MSG_SNDIN_FORMATCHANGE);
|
||||
stream_write_uint32(out, NewFormat);
|
||||
stream_write_BYTE(out, MSG_SNDIN_FORMATCHANGE);
|
||||
stream_write_UINT32(out, NewFormat);
|
||||
error = callback->channel->Write(callback->channel, 5, stream_get_head(out), NULL);
|
||||
stream_free(out);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static int audin_send_open_reply_pdu(IWTSVirtualChannelCallback* pChannelCallback, uint32 Result)
|
||||
static int audin_send_open_reply_pdu(IWTSVirtualChannelCallback* pChannelCallback, UINT32 Result)
|
||||
{
|
||||
int error;
|
||||
STREAM* out;
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
|
||||
out = stream_new(5);
|
||||
stream_write_uint8(out, MSG_SNDIN_OPEN_REPLY);
|
||||
stream_write_uint32(out, Result);
|
||||
stream_write_BYTE(out, MSG_SNDIN_OPEN_REPLY);
|
||||
stream_write_UINT32(out, Result);
|
||||
error = callback->channel->Write(callback->channel, 5, stream_get_head(out), NULL);
|
||||
stream_free(out);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static boolean audin_receive_wave_data(uint8* data, int size, void* user_data)
|
||||
static BOOL audin_receive_wave_data(BYTE* data, int size, void* user_data)
|
||||
{
|
||||
int error;
|
||||
STREAM* out;
|
||||
@ -228,15 +228,15 @@ static boolean audin_receive_wave_data(uint8* data, int size, void* user_data)
|
||||
error = audin_send_incoming_data_pdu((IWTSVirtualChannelCallback*) callback);
|
||||
|
||||
if (error != 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
out = stream_new(size + 1);
|
||||
stream_write_uint8(out, MSG_SNDIN_DATA);
|
||||
stream_write_BYTE(out, MSG_SNDIN_DATA);
|
||||
stream_write(out, data, size);
|
||||
error = callback->channel->Write(callback->channel, stream_get_length(out), stream_get_head(out), NULL);
|
||||
stream_free(out);
|
||||
|
||||
return (error == 0 ? true : false);
|
||||
return (error == 0 ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, STREAM* s)
|
||||
@ -244,16 +244,16 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, STRE
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin;
|
||||
audinFormat* format;
|
||||
uint32 initialFormat;
|
||||
uint32 FramesPerPacket;
|
||||
UINT32 initialFormat;
|
||||
UINT32 FramesPerPacket;
|
||||
|
||||
stream_read_uint32(s, FramesPerPacket);
|
||||
stream_read_uint32(s, initialFormat);
|
||||
stream_read_UINT32(s, FramesPerPacket);
|
||||
stream_read_UINT32(s, initialFormat);
|
||||
|
||||
DEBUG_DVC("FramesPerPacket=%d initialFormat=%d",
|
||||
FramesPerPacket, initialFormat);
|
||||
|
||||
if (initialFormat >= (uint32) callback->formats_count)
|
||||
if (initialFormat >= (UINT32) callback->formats_count)
|
||||
{
|
||||
DEBUG_WARN("invalid format index %d (total %d)",
|
||||
initialFormat, callback->formats_count);
|
||||
@ -277,14 +277,14 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb
|
||||
{
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
AUDIN_PLUGIN * audin = (AUDIN_PLUGIN*) callback->plugin;
|
||||
uint32 NewFormat;
|
||||
UINT32 NewFormat;
|
||||
audinFormat* format;
|
||||
|
||||
stream_read_uint32(s, NewFormat);
|
||||
stream_read_UINT32(s, NewFormat);
|
||||
|
||||
DEBUG_DVC("NewFormat=%d", NewFormat);
|
||||
|
||||
if (NewFormat >= (uint32) callback->formats_count)
|
||||
if (NewFormat >= (UINT32) callback->formats_count)
|
||||
{
|
||||
DEBUG_WARN("invalid format index %d (total %d)",
|
||||
NewFormat, callback->formats_count);
|
||||
@ -305,16 +305,16 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, uint32 cbSize, uint8* pBuffer)
|
||||
static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, UINT32 cbSize, BYTE* pBuffer)
|
||||
{
|
||||
int error;
|
||||
STREAM* s;
|
||||
uint8 MessageId;
|
||||
BYTE MessageId;
|
||||
|
||||
s = stream_new(0);
|
||||
stream_attach(s, pBuffer, cbSize);
|
||||
|
||||
stream_read_uint8(s, MessageId);
|
||||
stream_read_BYTE(s, MessageId);
|
||||
|
||||
DEBUG_DVC("MessageId=0x%x", MessageId);
|
||||
|
||||
@ -358,14 +358,14 @@ static int audin_on_close(IWTSVirtualChannelCallback* pChannelCallback)
|
||||
if (audin->device)
|
||||
IFCALL(audin->device->Close, audin->device);
|
||||
|
||||
xfree(callback->formats);
|
||||
xfree(callback);
|
||||
free(callback->formats);
|
||||
free(callback);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int audin_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
|
||||
IWTSVirtualChannel* pChannel, uint8* Data, int* pbAccept,
|
||||
IWTSVirtualChannel* pChannel, BYTE* Data, int* pbAccept,
|
||||
IWTSVirtualChannelCallback** ppCallback)
|
||||
{
|
||||
AUDIN_CHANNEL_CALLBACK* callback;
|
||||
@ -415,8 +415,8 @@ static int audin_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
audin->device = NULL;
|
||||
}
|
||||
|
||||
xfree(audin->listener_callback);
|
||||
xfree(audin);
|
||||
free(audin->listener_callback);
|
||||
free(audin);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -436,7 +436,7 @@ static void audin_register_device_plugin(IWTSPlugin* pPlugin, IAudinDevice* devi
|
||||
audin->device = device;
|
||||
}
|
||||
|
||||
static boolean audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, RDP_PLUGIN_DATA* data)
|
||||
static BOOL audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, RDP_PLUGIN_DATA* data)
|
||||
{
|
||||
char* fullname;
|
||||
PFREERDP_AUDIN_DEVICE_ENTRY entry;
|
||||
@ -452,11 +452,11 @@ static boolean audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, R
|
||||
strcpy(fullname, "audin_");
|
||||
strcat(fullname, name);
|
||||
entry = (PFREERDP_AUDIN_DEVICE_ENTRY) freerdp_load_plugin(fullname, AUDIN_DEVICE_EXPORT_FUNC_NAME);
|
||||
xfree(fullname);
|
||||
free(fullname);
|
||||
}
|
||||
|
||||
if (entry == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
entryPoints.plugin = pPlugin;
|
||||
entryPoints.pRegisterAudinDevice = audin_register_device_plugin;
|
||||
@ -465,15 +465,15 @@ static boolean audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, R
|
||||
if (entry(&entryPoints) != 0)
|
||||
{
|
||||
DEBUG_WARN("%s entry returns error.", name);
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static boolean audin_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data)
|
||||
static BOOL audin_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data)
|
||||
{
|
||||
boolean ret;
|
||||
BOOL ret;
|
||||
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) pPlugin;
|
||||
RDP_PLUGIN_DATA default_data[2] = { { 0 }, { 0 } };
|
||||
|
||||
@ -482,17 +482,17 @@ static boolean audin_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* d
|
||||
if (data->data[1] && strcmp((char*)data->data[1], "format") == 0)
|
||||
{
|
||||
audin->fixed_format = atoi(data->data[2]);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
else if (data->data[1] && strcmp((char*)data->data[1], "rate") == 0)
|
||||
{
|
||||
audin->fixed_rate = atoi(data->data[2]);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
else if (data->data[1] && strcmp((char*)data->data[1], "channel") == 0)
|
||||
{
|
||||
audin->fixed_channel = atoi(data->data[2]);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
else if (data->data[1] && ((char*)data->data[1])[0])
|
||||
{
|
||||
@ -520,7 +520,7 @@ static boolean audin_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* d
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Input Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -34,26 +34,26 @@
|
||||
#define DEBUG_DVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
typedef boolean (*AudinReceive) (uint8* data, int size, void* user_data);
|
||||
typedef BOOL (*AudinReceive) (BYTE* data, int size, void* user_data);
|
||||
|
||||
typedef struct audin_format audinFormat;
|
||||
struct audin_format
|
||||
{
|
||||
uint16 wFormatTag;
|
||||
uint16 nChannels;
|
||||
uint32 nSamplesPerSec;
|
||||
uint16 nBlockAlign;
|
||||
uint16 wBitsPerSample;
|
||||
uint16 cbSize;
|
||||
uint8* data;
|
||||
UINT16 wFormatTag;
|
||||
UINT16 nChannels;
|
||||
UINT32 nSamplesPerSec;
|
||||
UINT16 nBlockAlign;
|
||||
UINT16 wBitsPerSample;
|
||||
UINT16 cbSize;
|
||||
BYTE* data;
|
||||
};
|
||||
|
||||
typedef struct _IAudinDevice IAudinDevice;
|
||||
struct _IAudinDevice
|
||||
{
|
||||
void (*Open) (IAudinDevice* devplugin, AudinReceive receive, void* user_data);
|
||||
boolean (*FormatSupported) (IAudinDevice* devplugin, audinFormat* format);
|
||||
void (*SetFormat) (IAudinDevice* devplugin, audinFormat* format, uint32 FramesPerPacket);
|
||||
BOOL (*FormatSupported) (IAudinDevice* devplugin, audinFormat* format);
|
||||
void (*SetFormat) (IAudinDevice* devplugin, audinFormat* format, UINT32 FramesPerPacket);
|
||||
void (*Close) (IAudinDevice* devplugin);
|
||||
void (*Free) (IAudinDevice* devplugin);
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2011 O.S. Systems Software Ltda.
|
||||
@ -27,7 +27,7 @@ include_directories(${PULSEAUDIO_INCLUDE_DIR})
|
||||
add_library(audin_pulse ${AUDIN_PULSE_SRCS})
|
||||
set_target_properties(audin_pulse PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(audin_pulse freerdp)
|
||||
else()
|
||||
target_link_libraries(audin_pulse freerdp-utils)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Input Redirection Virtual Channel - PulseAudio implementation
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -37,7 +37,7 @@ typedef struct _AudinPulseDevice
|
||||
IAudinDevice iface;
|
||||
|
||||
char device_name[32];
|
||||
uint32 frames_per_packet;
|
||||
UINT32 frames_per_packet;
|
||||
pa_threaded_mainloop* mainloop;
|
||||
pa_context* context;
|
||||
pa_sample_spec sample_spec;
|
||||
@ -48,7 +48,7 @@ typedef struct _AudinPulseDevice
|
||||
FREERDP_DSP_CONTEXT* dsp_context;
|
||||
|
||||
int bytes_per_frame;
|
||||
uint8* buffer;
|
||||
BYTE* buffer;
|
||||
int buffer_frames;
|
||||
|
||||
AudinReceive receive;
|
||||
@ -80,19 +80,19 @@ static void audin_pulse_context_state_callback(pa_context* context, void* userda
|
||||
}
|
||||
}
|
||||
|
||||
static boolean audin_pulse_connect(IAudinDevice* device)
|
||||
static BOOL audin_pulse_connect(IAudinDevice* device)
|
||||
{
|
||||
pa_context_state_t state;
|
||||
AudinPulseDevice* pulse = (AudinPulseDevice*) device;
|
||||
|
||||
if (!pulse->context)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
if (pa_context_connect(pulse->context, NULL, 0, NULL))
|
||||
{
|
||||
DEBUG_WARN("pa_context_connect failed (%d)",
|
||||
pa_context_errno(pulse->context));
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
pa_threaded_mainloop_lock(pulse->mainloop);
|
||||
if (pa_threaded_mainloop_start(pulse->mainloop) < 0)
|
||||
@ -100,7 +100,7 @@ static boolean audin_pulse_connect(IAudinDevice* device)
|
||||
pa_threaded_mainloop_unlock(pulse->mainloop);
|
||||
DEBUG_WARN("pa_threaded_mainloop_start failed (%d)",
|
||||
pa_context_errno(pulse->context));
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
@ -119,12 +119,12 @@ static boolean audin_pulse_connect(IAudinDevice* device)
|
||||
if (state == PA_CONTEXT_READY)
|
||||
{
|
||||
DEBUG_DVC("connected");
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pa_context_disconnect(pulse->context);
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,10 +152,10 @@ static void audin_pulse_free(IAudinDevice* device)
|
||||
pulse->mainloop = NULL;
|
||||
}
|
||||
freerdp_dsp_context_free(pulse->dsp_context);
|
||||
xfree(pulse);
|
||||
free(pulse);
|
||||
}
|
||||
|
||||
static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* format)
|
||||
static BOOL audin_pulse_format_supported(IAudinDevice* device, audinFormat* format)
|
||||
{
|
||||
AudinPulseDevice* pulse = (AudinPulseDevice*) device;
|
||||
|
||||
@ -170,7 +170,7 @@ static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* f
|
||||
(format->wBitsPerSample == 8 || format->wBitsPerSample == 16) &&
|
||||
(format->nChannels >= 1 && format->nChannels <= PA_CHANNELS_MAX))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -181,7 +181,7 @@ static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* f
|
||||
(format->wBitsPerSample == 8) &&
|
||||
(format->nChannels >= 1 && format->nChannels <= PA_CHANNELS_MAX))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -190,14 +190,14 @@ static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* f
|
||||
(format->wBitsPerSample == 4) &&
|
||||
(format->nChannels == 1 || format->nChannels == 2))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void audin_pulse_set_format(IAudinDevice* device, audinFormat* format, uint32 FramesPerPacket)
|
||||
static void audin_pulse_set_format(IAudinDevice* device, audinFormat* format, UINT32 FramesPerPacket)
|
||||
{
|
||||
int bs;
|
||||
pa_sample_spec sample_spec = { 0 };
|
||||
@ -279,11 +279,11 @@ static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length
|
||||
{
|
||||
int frames;
|
||||
int cframes;
|
||||
boolean ret;
|
||||
BOOL ret;
|
||||
const void* data;
|
||||
const uint8* src;
|
||||
const BYTE* src;
|
||||
int encoded_size;
|
||||
uint8* encoded_data;
|
||||
BYTE* encoded_data;
|
||||
AudinPulseDevice* pulse = (AudinPulseDevice*) userdata;
|
||||
|
||||
pa_stream_peek(stream, &data, &length);
|
||||
@ -291,7 +291,7 @@ static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length
|
||||
|
||||
DEBUG_DVC("length %d frames %d", (int) length, frames);
|
||||
|
||||
src = (const uint8*) data;
|
||||
src = (const BYTE*) data;
|
||||
while (frames > 0)
|
||||
{
|
||||
cframes = pulse->frames_per_packet - pulse->buffer_frames;
|
||||
@ -350,7 +350,7 @@ static void audin_pulse_close(IAudinDevice* device)
|
||||
pulse->user_data = NULL;
|
||||
if (pulse->buffer)
|
||||
{
|
||||
xfree(pulse->buffer);
|
||||
free(pulse->buffer);
|
||||
pulse->buffer = NULL;
|
||||
pulse->buffer_frames = 0;
|
||||
}
|
||||
@ -387,10 +387,10 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u
|
||||
audin_pulse_stream_state_callback, pulse);
|
||||
pa_stream_set_read_callback(pulse->stream,
|
||||
audin_pulse_stream_request_callback, pulse);
|
||||
buffer_attr.maxlength = (uint32_t) -1;
|
||||
buffer_attr.tlength = (uint32_t) -1;
|
||||
buffer_attr.prebuf = (uint32_t) -1;
|
||||
buffer_attr.minreq = (uint32_t) -1;
|
||||
buffer_attr.maxlength = (UINT32_t) -1;
|
||||
buffer_attr.tlength = (UINT32_t) -1;
|
||||
buffer_attr.prebuf = (UINT32_t) -1;
|
||||
buffer_attr.minreq = (UINT32_t) -1;
|
||||
/* 500ms latency */
|
||||
buffer_attr.fragsize = pa_usec_to_bytes(500000, &pulse->sample_spec);
|
||||
if (pa_stream_connect_record(pulse->stream,
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -21,7 +21,7 @@ set(${MODULE_PREFIX}_SRCS
|
||||
audin.c
|
||||
PARENT_SCOPE)
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
if(MONOLITHIC_BUILD)
|
||||
set(${MODULE_PREFIX}_LIBS freerdp PARENT_SCOPE)
|
||||
else()
|
||||
set(${MODULE_PREFIX}_LIBS freerdp-utils freerdp-channels PARENT_SCOPE)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Server Audio Input Virtual Channel
|
||||
*
|
||||
* Copyright 2012 Vic Lee
|
||||
@ -50,7 +50,7 @@ typedef struct _audin_server
|
||||
|
||||
FREERDP_DSP_CONTEXT* dsp_context;
|
||||
|
||||
boolean opened;
|
||||
BOOL opened;
|
||||
} audin_server;
|
||||
|
||||
static void audin_server_select_format(audin_server_context* context, int client_format_index)
|
||||
@ -68,33 +68,33 @@ static void audin_server_select_format(audin_server_context* context, int client
|
||||
|
||||
static void audin_server_send_version(audin_server* audin, STREAM* s)
|
||||
{
|
||||
stream_write_uint8(s, MSG_SNDIN_VERSION);
|
||||
stream_write_uint32(s, 1); /* Version (4 bytes) */
|
||||
stream_write_BYTE(s, MSG_SNDIN_VERSION);
|
||||
stream_write_UINT32(s, 1); /* Version (4 bytes) */
|
||||
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), stream_get_length(s), NULL);
|
||||
}
|
||||
|
||||
static boolean audin_server_recv_version(audin_server* audin, STREAM* s, uint32 length)
|
||||
static BOOL audin_server_recv_version(audin_server* audin, STREAM* s, UINT32 length)
|
||||
{
|
||||
uint32 Version;
|
||||
UINT32 Version;
|
||||
|
||||
if (length < 4)
|
||||
return false;
|
||||
stream_read_uint32(s, Version);
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, Version);
|
||||
if (Version < 1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void audin_server_send_formats(audin_server* audin, STREAM* s)
|
||||
{
|
||||
int i;
|
||||
uint32 nAvgBytesPerSec;
|
||||
UINT32 nAvgBytesPerSec;
|
||||
|
||||
stream_set_pos(s, 0);
|
||||
stream_write_uint8(s, MSG_SNDIN_FORMATS);
|
||||
stream_write_uint32(s, audin->context.num_server_formats); /* NumFormats (4 bytes) */
|
||||
stream_write_uint32(s, 0); /* cbSizeFormatsPacket (4 bytes), client-to-server only */
|
||||
stream_write_BYTE(s, MSG_SNDIN_FORMATS);
|
||||
stream_write_UINT32(s, audin->context.num_server_formats); /* NumFormats (4 bytes) */
|
||||
stream_write_UINT32(s, 0); /* cbSizeFormatsPacket (4 bytes), client-to-server only */
|
||||
|
||||
for (i = 0; i < audin->context.num_server_formats; i++)
|
||||
{
|
||||
@ -102,13 +102,13 @@ static void audin_server_send_formats(audin_server* audin, STREAM* s)
|
||||
audin->context.server_formats[i].nChannels *
|
||||
audin->context.server_formats[i].wBitsPerSample / 8;
|
||||
stream_check_size(s, 18);
|
||||
stream_write_uint16(s, audin->context.server_formats[i].wFormatTag);
|
||||
stream_write_uint16(s, audin->context.server_formats[i].nChannels);
|
||||
stream_write_uint32(s, audin->context.server_formats[i].nSamplesPerSec);
|
||||
stream_write_uint32(s, nAvgBytesPerSec);
|
||||
stream_write_uint16(s, audin->context.server_formats[i].nBlockAlign);
|
||||
stream_write_uint16(s, audin->context.server_formats[i].wBitsPerSample);
|
||||
stream_write_uint16(s, audin->context.server_formats[i].cbSize);
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].wFormatTag);
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].nChannels);
|
||||
stream_write_UINT32(s, audin->context.server_formats[i].nSamplesPerSec);
|
||||
stream_write_UINT32(s, nAvgBytesPerSec);
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].nBlockAlign);
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].wBitsPerSample);
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].cbSize);
|
||||
if (audin->context.server_formats[i].cbSize)
|
||||
{
|
||||
stream_check_size(s, audin->context.server_formats[i].cbSize);
|
||||
@ -120,37 +120,37 @@ static void audin_server_send_formats(audin_server* audin, STREAM* s)
|
||||
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), stream_get_length(s), NULL);
|
||||
}
|
||||
|
||||
static boolean audin_server_recv_formats(audin_server* audin, STREAM* s, uint32 length)
|
||||
static BOOL audin_server_recv_formats(audin_server* audin, STREAM* s, UINT32 length)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (length < 8)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
stream_read_uint32(s, audin->context.num_client_formats); /* NumFormats (4 bytes) */
|
||||
stream_seek_uint32(s); /* cbSizeFormatsPacket (4 bytes) */
|
||||
stream_read_UINT32(s, audin->context.num_client_formats); /* NumFormats (4 bytes) */
|
||||
stream_seek_UINT32(s); /* cbSizeFormatsPacket (4 bytes) */
|
||||
length -= 8;
|
||||
|
||||
if (audin->context.num_client_formats <= 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
audin->context.client_formats = xzalloc(audin->context.num_client_formats * sizeof(rdpsndFormat));
|
||||
for (i = 0; i < audin->context.num_client_formats; i++)
|
||||
{
|
||||
if (length < 18)
|
||||
{
|
||||
xfree(audin->context.client_formats);
|
||||
free(audin->context.client_formats);
|
||||
audin->context.client_formats = NULL;
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_uint16(s, audin->context.client_formats[i].wFormatTag);
|
||||
stream_read_uint16(s, audin->context.client_formats[i].nChannels);
|
||||
stream_read_uint32(s, audin->context.client_formats[i].nSamplesPerSec);
|
||||
stream_seek_uint32(s); /* nAvgBytesPerSec */
|
||||
stream_read_uint16(s, audin->context.client_formats[i].nBlockAlign);
|
||||
stream_read_uint16(s, audin->context.client_formats[i].wBitsPerSample);
|
||||
stream_read_uint16(s, audin->context.client_formats[i].cbSize);
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].wFormatTag);
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].nChannels);
|
||||
stream_read_UINT32(s, audin->context.client_formats[i].nSamplesPerSec);
|
||||
stream_seek_UINT32(s); /* nAvgBytesPerSec */
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].nBlockAlign);
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].wBitsPerSample);
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].cbSize);
|
||||
if (audin->context.client_formats[i].cbSize > 0)
|
||||
{
|
||||
stream_seek(s, audin->context.client_formats[i].cbSize);
|
||||
@ -159,7 +159,7 @@ static boolean audin_server_recv_formats(audin_server* audin, STREAM* s, uint32
|
||||
|
||||
IFCALL(audin->context.Opening, &audin->context);
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void audin_server_send_open(audin_server* audin, STREAM* s)
|
||||
@ -167,52 +167,52 @@ static void audin_server_send_open(audin_server* audin, STREAM* s)
|
||||
if (audin->context.selected_client_format < 0)
|
||||
return;
|
||||
|
||||
audin->opened = true;
|
||||
audin->opened = TRUE;
|
||||
|
||||
stream_set_pos(s, 0);
|
||||
stream_write_uint8(s, MSG_SNDIN_OPEN);
|
||||
stream_write_uint32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
|
||||
stream_write_uint32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */
|
||||
stream_write_BYTE(s, MSG_SNDIN_OPEN);
|
||||
stream_write_UINT32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
|
||||
stream_write_UINT32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */
|
||||
/*
|
||||
* [MS-RDPEAI] 3.2.5.1.6
|
||||
* The second format specify the format that SHOULD be used to capture data from
|
||||
* the actual audio input device.
|
||||
*/
|
||||
stream_write_uint16(s, 1); /* wFormatTag = PCM */
|
||||
stream_write_uint16(s, 2); /* nChannels */
|
||||
stream_write_uint32(s, 44100); /* nSamplesPerSec */
|
||||
stream_write_uint32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */
|
||||
stream_write_uint16(s, 4); /* nBlockAlign */
|
||||
stream_write_uint16(s, 16); /* wBitsPerSample */
|
||||
stream_write_uint16(s, 0); /* cbSize */
|
||||
stream_write_UINT16(s, 1); /* wFormatTag = PCM */
|
||||
stream_write_UINT16(s, 2); /* nChannels */
|
||||
stream_write_UINT32(s, 44100); /* nSamplesPerSec */
|
||||
stream_write_UINT32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */
|
||||
stream_write_UINT16(s, 4); /* nBlockAlign */
|
||||
stream_write_UINT16(s, 16); /* wBitsPerSample */
|
||||
stream_write_UINT16(s, 0); /* cbSize */
|
||||
|
||||
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), stream_get_length(s), NULL);
|
||||
}
|
||||
|
||||
static boolean audin_server_recv_open_reply(audin_server* audin, STREAM* s, uint32 length)
|
||||
static BOOL audin_server_recv_open_reply(audin_server* audin, STREAM* s, UINT32 length)
|
||||
{
|
||||
uint32 Result;
|
||||
UINT32 Result;
|
||||
|
||||
if (length < 4)
|
||||
return false;
|
||||
stream_read_uint32(s, Result);
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, Result);
|
||||
|
||||
IFCALL(audin->context.OpenResult, &audin->context, Result);
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static boolean audin_server_recv_data(audin_server* audin, STREAM* s, uint32 length)
|
||||
static BOOL audin_server_recv_data(audin_server* audin, STREAM* s, UINT32 length)
|
||||
{
|
||||
rdpsndFormat* format;
|
||||
int sbytes_per_sample;
|
||||
int sbytes_per_frame;
|
||||
uint8* src;
|
||||
BYTE* src;
|
||||
int size;
|
||||
int frames;
|
||||
|
||||
if (audin->context.selected_client_format < 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
format = &audin->context.client_formats[audin->context.selected_client_format];
|
||||
|
||||
@ -257,7 +257,7 @@ static boolean audin_server_recv_data(audin_server* audin, STREAM* s, uint32 len
|
||||
|
||||
IFCALL(audin->context.ReceiveSamples, &audin->context, src, frames);
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void* audin_server_thread_func(void* arg)
|
||||
@ -265,13 +265,13 @@ static void* audin_server_thread_func(void* arg)
|
||||
void* fd;
|
||||
STREAM* s;
|
||||
void* buffer;
|
||||
uint8 MessageId;
|
||||
boolean ready = false;
|
||||
uint32 bytes_returned = 0;
|
||||
BYTE MessageId;
|
||||
BOOL ready = FALSE;
|
||||
UINT32 bytes_returned = 0;
|
||||
audin_server* audin = (audin_server*) arg;
|
||||
freerdp_thread* thread = audin->audin_channel_thread;
|
||||
|
||||
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == true)
|
||||
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE)
|
||||
{
|
||||
fd = *((void**)buffer);
|
||||
WTSFreeMemory(buffer);
|
||||
@ -285,9 +285,9 @@ static void* audin_server_thread_func(void* arg)
|
||||
if (freerdp_thread_is_stopped(thread))
|
||||
break;
|
||||
|
||||
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualChannelReady, &buffer, &bytes_returned) == false)
|
||||
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualChannelReady, &buffer, &bytes_returned) == FALSE)
|
||||
break;
|
||||
ready = *((boolean*)buffer);
|
||||
ready = *((BOOL*)buffer);
|
||||
WTSFreeMemory(buffer);
|
||||
if (ready)
|
||||
break;
|
||||
@ -310,7 +310,7 @@ static void* audin_server_thread_func(void* arg)
|
||||
stream_set_pos(s, 0);
|
||||
|
||||
if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s),
|
||||
stream_get_size(s), &bytes_returned) == false)
|
||||
stream_get_size(s), &bytes_returned) == FALSE)
|
||||
{
|
||||
if (bytes_returned == 0)
|
||||
break;
|
||||
@ -318,13 +318,13 @@ static void* audin_server_thread_func(void* arg)
|
||||
stream_check_size(s, (int) bytes_returned);
|
||||
|
||||
if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s),
|
||||
stream_get_size(s), &bytes_returned) == false)
|
||||
stream_get_size(s), &bytes_returned) == FALSE)
|
||||
break;
|
||||
}
|
||||
if (bytes_returned < 1)
|
||||
continue;
|
||||
|
||||
stream_read_uint8(s, MessageId);
|
||||
stream_read_BYTE(s, MessageId);
|
||||
bytes_returned--;
|
||||
switch (MessageId)
|
||||
{
|
||||
@ -366,26 +366,27 @@ static void* audin_server_thread_func(void* arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static boolean audin_server_open(audin_server_context* context)
|
||||
static BOOL audin_server_open(audin_server_context* context)
|
||||
{
|
||||
audin_server* audin = (audin_server*) context;
|
||||
|
||||
if (audin->audin_channel_thread == NULL)
|
||||
{
|
||||
audin->audin_channel = WTSVirtualChannelOpenEx(context->vcm, "AUDIO_INPUT", WTS_CHANNEL_OPTION_DYNAMIC);
|
||||
|
||||
if (audin->audin_channel == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
audin->audin_channel_thread = freerdp_thread_new();
|
||||
freerdp_thread_start(audin->audin_channel_thread, audin_server_thread_func, audin);
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static boolean audin_server_close(audin_server_context* context)
|
||||
static BOOL audin_server_close(audin_server_context* context)
|
||||
{
|
||||
audin_server* audin = (audin_server*) context;
|
||||
|
||||
@ -402,7 +403,7 @@ static boolean audin_server_close(audin_server_context* context)
|
||||
}
|
||||
audin->context.selected_client_format = -1;
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
audin_server_context* audin_server_context_new(WTSVirtualChannelManager* vcm)
|
||||
@ -430,6 +431,6 @@ void audin_server_context_free(audin_server_context* context)
|
||||
if (audin->dsp_context)
|
||||
freerdp_dsp_context_free(audin->dsp_context);
|
||||
if (audin->context.client_formats)
|
||||
xfree(audin->context.client_formats);
|
||||
xfree(audin);
|
||||
free(audin->context.client_formats);
|
||||
free(audin);
|
||||
}
|
||||
|
2
channels/client/.gitignore
vendored
Normal file
2
channels/client/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
tables.c
|
||||
|
60
channels/client/CMakeLists.txt
Normal file
60
channels/client/CMakeLists.txt
Normal file
@ -0,0 +1,60 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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-channels-client")
|
||||
set(MODULE_PREFIX "FREERDP_CHANNELS_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
tables.c
|
||||
tables.h
|
||||
channels.c)
|
||||
|
||||
foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES})
|
||||
|
||||
set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME})
|
||||
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${STATIC_MODULE_NAME})
|
||||
|
||||
if(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL "VirtualChannelEntry")
|
||||
set(ENTRY_POINT_NAME "${${STATIC_MODULE}_CLIENT_NAME}_${${STATIC_MODULE}_CLIENT_ENTRY}")
|
||||
set(ENTRY_POINT_IMPORT "extern int ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS pEntryPoints);")
|
||||
set(VIRTUAL_CHANNEL_ENTRY_IMPORTS "${VIRTUAL_CHANNEL_ENTRY_IMPORTS}\n${ENTRY_POINT_IMPORT}")
|
||||
set(VIRTUAL_CHANNEL_ENTRY_TABLE "${VIRTUAL_CHANNEL_ENTRY_TABLE}\n\t{ \"${STATIC_MODULE_NAME}\", ${ENTRY_POINT_NAME} },")
|
||||
endif()
|
||||
|
||||
if(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL "DeviceServiceEntry")
|
||||
set(ENTRY_POINT_NAME "${${STATIC_MODULE}_CLIENT_NAME}_${${STATIC_MODULE}_CLIENT_ENTRY}")
|
||||
set(ENTRY_POINT_IMPORT "extern int ${ENTRY_POINT_NAME}(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints);")
|
||||
set(DEVICE_SERVICE_ENTRY_IMPORTS "${DEVICE_SERVICE_ENTRY_IMPORTS}\n${ENTRY_POINT_IMPORT}")
|
||||
set(DEVICE_SERVICE_ENTRY_TABLE "${DEVICE_SERVICE_ENTRY_TABLE}\n\t{ \"${STATIC_MODULE_NAME}\", ${ENTRY_POINT_NAME} },")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
set(VIRTUAL_CHANNEL_ENTRY_TABLE "${VIRTUAL_CHANNEL_ENTRY_TABLE}\n\t{ \"\", NULL }")
|
||||
set(DEVICE_SERVICE_ENTRY_TABLE "${DEVICE_SERVICE_ENTRY_TABLE}\n\t{ \"\", NULL }")
|
||||
|
||||
configure_file(tables.c.in tables.c)
|
||||
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
|
||||
|
||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/Client")
|
||||
|
84
channels/client/channels.c
Normal file
84
channels/client/channels.c
Normal file
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Client Channels
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "tables.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <freerdp/client/channels.h>
|
||||
|
||||
extern const VIRTUAL_CHANNEL_ENTRY VIRTUAL_CHANNEL_TABLE[];
|
||||
extern const DEVICE_SERVICE_ENTRY DEVICE_SERVICE_TABLE[];
|
||||
|
||||
void* freerdp_channels_find_static_virtual_channel_entry(const char* name)
|
||||
{
|
||||
int index = 0;
|
||||
VIRTUAL_CHANNEL_ENTRY* pEntry;
|
||||
|
||||
pEntry = (VIRTUAL_CHANNEL_ENTRY*) &VIRTUAL_CHANNEL_TABLE[index++];
|
||||
|
||||
while (pEntry->entry != NULL)
|
||||
{
|
||||
if (strcmp(pEntry->name, name) == 0)
|
||||
{
|
||||
return (void*) pEntry->entry;
|
||||
}
|
||||
|
||||
pEntry = (VIRTUAL_CHANNEL_ENTRY*) &VIRTUAL_CHANNEL_TABLE[index++];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* freerdp_channels_find_static_device_service_entry(const char* name)
|
||||
{
|
||||
int index = 0;
|
||||
DEVICE_SERVICE_ENTRY* pEntry;
|
||||
|
||||
pEntry = (DEVICE_SERVICE_ENTRY*) &DEVICE_SERVICE_TABLE[index++];
|
||||
|
||||
while (pEntry->entry != NULL)
|
||||
{
|
||||
if (strcmp(pEntry->name, name) == 0)
|
||||
{
|
||||
return (void*) pEntry->entry;
|
||||
}
|
||||
|
||||
pEntry = (DEVICE_SERVICE_ENTRY*) &DEVICE_SERVICE_TABLE[index++];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* freerdp_channels_find_static_entry(const char* name, const char* entry)
|
||||
{
|
||||
if (strcmp(entry, "VirtualChannelEntry") == 0)
|
||||
{
|
||||
return freerdp_channels_find_static_virtual_channel_entry(name);
|
||||
}
|
||||
else if (strcmp(entry, "DeviceServiceEntry") == 0)
|
||||
{
|
||||
return freerdp_channels_find_static_device_service_entry(name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
31
channels/client/tables.c.in
Normal file
31
channels/client/tables.c.in
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Static Entry Point Tables
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "tables.h"
|
||||
${VIRTUAL_CHANNEL_ENTRY_IMPORTS}
|
||||
${DEVICE_SERVICE_ENTRY_IMPORTS}
|
||||
|
||||
const VIRTUAL_CHANNEL_ENTRY VIRTUAL_CHANNEL_TABLE[] =
|
||||
{${VIRTUAL_CHANNEL_ENTRY_TABLE}
|
||||
};
|
||||
|
||||
const DEVICE_SERVICE_ENTRY DEVICE_SERVICE_TABLE[] =
|
||||
{${DEVICE_SERVICE_ENTRY_TABLE}
|
||||
};
|
||||
|
42
channels/client/tables.h
Normal file
42
channels/client/tables.h
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Static Entry Point Tables
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <freerdp/svc.h>
|
||||
|
||||
#ifndef PDEVICE_SERVICE_ENTRY_POINTS
|
||||
#define PDEVICE_SERVICE_ENTRY_POINTS void*
|
||||
#endif
|
||||
|
||||
typedef int (*VIRTUAL_CHANNEL_ENTRY_FN)(PCHANNEL_ENTRY_POINTS pEntryPoints);
|
||||
typedef int (*DEVICE_SERVICE_ENTRY_FN)(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints);
|
||||
|
||||
struct _VIRTUAL_CHANNEL_ENTRY
|
||||
{
|
||||
const char* name;
|
||||
const VIRTUAL_CHANNEL_ENTRY_FN entry;
|
||||
};
|
||||
typedef struct _VIRTUAL_CHANNEL_ENTRY VIRTUAL_CHANNEL_ENTRY;
|
||||
|
||||
struct _DEVICE_SERVICE_ENTRY
|
||||
{
|
||||
const char* name;
|
||||
const DEVICE_SERVICE_ENTRY_FN entry;
|
||||
};
|
||||
typedef struct _DEVICE_SERVICE_ENTRY DEVICE_SERVICE_ENTRY;
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -15,7 +15,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(MODULE_NAME "cliprdr")
|
||||
set(MODULE_PREFIX "CHANNEL_CLIPRDR")
|
||||
|
||||
if(WITH_CLIENT_CHANNELS)
|
||||
add_subdirectory(client)
|
||||
if(${MODULE_PREFIX}_CLIENT_STATIC)
|
||||
set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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,32 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(CLIPRDR_SRCS
|
||||
set(MODULE_NAME "cliprdr")
|
||||
set(MODULE_PREFIX "CHANNEL_CLIPRDR_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_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 "")
|
||||
# cliprdr is always built-in
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(cliprdr freerdp)
|
||||
set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE)
|
||||
|
||||
add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp winpr)
|
||||
else()
|
||||
target_link_libraries(cliprdr freerdp-utils)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils winpr-crt)
|
||||
endif()
|
||||
|
||||
install(TARGETS cliprdr DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Clipboard Virtual Channel
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Clipboard Virtual Channel
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
@ -25,13 +25,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/hexdump.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/plugins/cliprdr.h>
|
||||
#include <freerdp/client/cliprdr.h>
|
||||
|
||||
#include "cliprdr_constants.h"
|
||||
#include "cliprdr_main.h"
|
||||
@ -86,7 +89,7 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
|
||||
|
||||
stream_extend(body, stream_get_size(body) + 4 + name_length);
|
||||
|
||||
stream_write_uint32(body, cb_event->formats[i]);
|
||||
stream_write_UINT32(body, cb_event->formats[i]);
|
||||
stream_write(body, name, name_length);
|
||||
}
|
||||
|
||||
@ -106,10 +109,10 @@ static void cliprdr_send_format_list_response(cliprdrPlugin* cliprdr)
|
||||
cliprdr_packet_send(cliprdr, s);
|
||||
}
|
||||
|
||||
void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint32 length, uint16 flags)
|
||||
void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT32 length, UINT16 flags)
|
||||
{
|
||||
int i;
|
||||
boolean ascii;
|
||||
BOOL ascii;
|
||||
int num_formats;
|
||||
CLIPRDR_FORMAT_NAME* format_name;
|
||||
|
||||
@ -125,20 +128,20 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint3
|
||||
if (num_formats * 36 != length)
|
||||
DEBUG_WARN("dataLen %d not divided by 36!", length);
|
||||
|
||||
ascii = (flags & CB_ASCII_NAMES) ? true : false;
|
||||
ascii = (flags & CB_ASCII_NAMES) ? TRUE : FALSE;
|
||||
|
||||
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xmalloc(sizeof(CLIPRDR_FORMAT_NAME) * num_formats);
|
||||
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) malloc(sizeof(CLIPRDR_FORMAT_NAME) * num_formats);
|
||||
cliprdr->num_format_names = num_formats;
|
||||
|
||||
for (i = 0; i < num_formats; i++)
|
||||
{
|
||||
format_name = &cliprdr->format_names[i];
|
||||
|
||||
stream_read_uint32(s, format_name->id);
|
||||
stream_read_UINT32(s, format_name->id);
|
||||
|
||||
if (ascii)
|
||||
{
|
||||
format_name->name = xstrdup((char*) s->p);
|
||||
format_name->name = _strdup((char*) s->p);
|
||||
format_name->length = strlen(format_name->name);
|
||||
}
|
||||
else
|
||||
@ -150,32 +153,32 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint3
|
||||
}
|
||||
}
|
||||
|
||||
void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint32 length, uint16 flags)
|
||||
void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT32 length, UINT16 flags)
|
||||
{
|
||||
int allocated_formats = 8;
|
||||
uint8* end_mark;
|
||||
BYTE* end_mark;
|
||||
CLIPRDR_FORMAT_NAME* format_name;
|
||||
|
||||
stream_get_mark(s, end_mark);
|
||||
end_mark += length;
|
||||
|
||||
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xmalloc(sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);
|
||||
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) malloc(sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);
|
||||
cliprdr->num_format_names = 0;
|
||||
|
||||
while (stream_get_left(s) >= 6)
|
||||
{
|
||||
uint8* p;
|
||||
BYTE* p;
|
||||
int name_len;
|
||||
|
||||
if (cliprdr->num_format_names >= allocated_formats)
|
||||
{
|
||||
allocated_formats *= 2;
|
||||
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xrealloc(cliprdr->format_names,
|
||||
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) realloc(cliprdr->format_names,
|
||||
sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);
|
||||
}
|
||||
|
||||
format_name = &cliprdr->format_names[cliprdr->num_format_names++];
|
||||
stream_read_uint32(s, format_name->id);
|
||||
stream_read_UINT32(s, format_name->id);
|
||||
|
||||
format_name->name = NULL;
|
||||
format_name->length = 0;
|
||||
@ -191,11 +194,11 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint32
|
||||
}
|
||||
}
|
||||
|
||||
void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataLen, uint16 msgFlags)
|
||||
void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags)
|
||||
{
|
||||
int i;
|
||||
uint32 format;
|
||||
boolean supported;
|
||||
UINT32 format;
|
||||
BOOL supported;
|
||||
CLIPRDR_FORMAT_NAME* format_name;
|
||||
RDP_CB_FORMAT_LIST_EVENT* cb_event;
|
||||
|
||||
@ -204,7 +207,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL
|
||||
|
||||
if (dataLen > 0)
|
||||
{
|
||||
cb_event->raw_format_data = (uint8*) xmalloc(dataLen);
|
||||
cb_event->raw_format_data = (BYTE*) malloc(dataLen);
|
||||
memcpy(cb_event->raw_format_data, stream_get_tail(s), dataLen);
|
||||
cb_event->raw_format_data_size = dataLen;
|
||||
}
|
||||
@ -215,13 +218,13 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL
|
||||
cliprdr_process_short_format_names(cliprdr, s, dataLen, msgFlags);
|
||||
|
||||
if (cliprdr->num_format_names > 0)
|
||||
cb_event->formats = (uint32*) xmalloc(sizeof(uint32) * cliprdr->num_format_names);
|
||||
cb_event->formats = (UINT32*) malloc(sizeof(UINT32) * cliprdr->num_format_names);
|
||||
|
||||
cb_event->num_formats = 0;
|
||||
|
||||
for (i = 0; i < cliprdr->num_format_names; i++)
|
||||
{
|
||||
supported = true;
|
||||
supported = TRUE;
|
||||
format_name = &cliprdr->format_names[i];
|
||||
format = format_name->id;
|
||||
|
||||
@ -261,7 +264,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL
|
||||
}
|
||||
else
|
||||
{
|
||||
supported = false;
|
||||
supported = FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -271,10 +274,10 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL
|
||||
cb_event->formats[cb_event->num_formats++] = format;
|
||||
|
||||
if (format_name->length > 0)
|
||||
xfree(format_name->name);
|
||||
free(format_name->name);
|
||||
}
|
||||
|
||||
xfree(cliprdr->format_names);
|
||||
free(cliprdr->format_names);
|
||||
cliprdr->format_names = NULL;
|
||||
|
||||
cliprdr->num_format_names = 0;
|
||||
@ -283,7 +286,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL
|
||||
cliprdr_send_format_list_response(cliprdr);
|
||||
}
|
||||
|
||||
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataLen, uint16 msgFlags)
|
||||
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags)
|
||||
{
|
||||
/* where is this documented? */
|
||||
#if 0
|
||||
@ -297,14 +300,14 @@ void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, STREAM* s, uin
|
||||
#endif
|
||||
}
|
||||
|
||||
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataLen, uint16 msgFlags)
|
||||
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags)
|
||||
{
|
||||
RDP_CB_DATA_REQUEST_EVENT* cb_event;
|
||||
|
||||
cb_event = (RDP_CB_DATA_REQUEST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR,
|
||||
RDP_EVENT_TYPE_CB_DATA_REQUEST, NULL, NULL);
|
||||
|
||||
stream_read_uint32(s, cb_event->format);
|
||||
stream_read_UINT32(s, cb_event->format);
|
||||
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (RDP_EVENT*) cb_event);
|
||||
}
|
||||
|
||||
@ -334,11 +337,11 @@ void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, RDP_CB_DA
|
||||
DEBUG_CLIPRDR("Sending Format Data Request");
|
||||
|
||||
s = cliprdr_packet_new(CB_FORMAT_DATA_REQUEST, 0, 4);
|
||||
stream_write_uint32(s, cb_event->format);
|
||||
stream_write_UINT32(s, cb_event->format);
|
||||
cliprdr_packet_send(cliprdr, s);
|
||||
}
|
||||
|
||||
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataLen, uint16 msgFlags)
|
||||
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags)
|
||||
{
|
||||
RDP_CB_DATA_RESPONSE_EVENT* cb_event;
|
||||
|
||||
@ -348,7 +351,7 @@ void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, uin
|
||||
if (dataLen > 0)
|
||||
{
|
||||
cb_event->size = dataLen;
|
||||
cb_event->data = (uint8*) xmalloc(dataLen);
|
||||
cb_event->data = (BYTE*) malloc(dataLen);
|
||||
memcpy(cb_event->data, stream_get_tail(s), dataLen);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Clipboard Virtual Channel
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
@ -22,13 +22,13 @@
|
||||
#define __CLIPRDR_FORMAT_H
|
||||
|
||||
void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIST_EVENT* cb_event);
|
||||
void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataLen, uint16 msgFlags);
|
||||
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataLen, uint16 msgFlags);
|
||||
void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags);
|
||||
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags);
|
||||
|
||||
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataLen, uint16 msgFlags);
|
||||
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags);
|
||||
void cliprdr_process_format_data_response_event(cliprdrPlugin* cliprdr, RDP_CB_DATA_RESPONSE_EVENT* cb_event);
|
||||
|
||||
void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, RDP_CB_DATA_REQUEST_EVENT* cb_event);
|
||||
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataLen, uint16 msgFlags);
|
||||
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags);
|
||||
|
||||
#endif /* __CLIPRDR_FORMAT_H */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Clipboard Virtual Channel
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
@ -25,12 +25,15 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/plugins/cliprdr.h>
|
||||
#include <freerdp/client/cliprdr.h>
|
||||
|
||||
#include "cliprdr_constants.h"
|
||||
#include "cliprdr_main.h"
|
||||
@ -52,13 +55,13 @@ static const char* const CB_MSG_TYPE_STRINGS[] =
|
||||
"CB_UNLOCK_CLIPDATA"
|
||||
};
|
||||
|
||||
STREAM* cliprdr_packet_new(uint16 msgType, uint16 msgFlags, uint32 dataLen)
|
||||
STREAM* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen)
|
||||
{
|
||||
STREAM* s;
|
||||
|
||||
s = stream_new(dataLen + 8);
|
||||
stream_write_uint16(s, msgType);
|
||||
stream_write_uint16(s, msgFlags);
|
||||
stream_write_UINT16(s, msgType);
|
||||
stream_write_UINT16(s, msgFlags);
|
||||
/* Write actual length after the entire packet has been constructed. */
|
||||
stream_seek(s, 4);
|
||||
|
||||
@ -68,12 +71,12 @@ STREAM* cliprdr_packet_new(uint16 msgType, uint16 msgFlags, uint32 dataLen)
|
||||
void cliprdr_packet_send(cliprdrPlugin* cliprdr, STREAM* s)
|
||||
{
|
||||
int pos;
|
||||
uint32 dataLen;
|
||||
UINT32 dataLen;
|
||||
|
||||
pos = stream_get_pos(s);
|
||||
dataLen = pos - 8;
|
||||
stream_set_pos(s, 4);
|
||||
stream_write_uint32(s, dataLen);
|
||||
stream_write_UINT32(s, dataLen);
|
||||
stream_set_pos(s, pos);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) cliprdr, s);
|
||||
@ -84,7 +87,7 @@ static void cliprdr_process_connect(rdpSvcPlugin* plugin)
|
||||
DEBUG_CLIPRDR("connecting");
|
||||
}
|
||||
|
||||
void cliprdr_print_general_capability_flags(uint32 flags)
|
||||
void cliprdr_print_general_capability_flags(UINT32 flags)
|
||||
{
|
||||
printf("generalFlags (0x%08X) {\n", flags);
|
||||
|
||||
@ -102,11 +105,11 @@ void cliprdr_print_general_capability_flags(uint32 flags)
|
||||
|
||||
static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, STREAM* s)
|
||||
{
|
||||
uint32 version;
|
||||
uint32 generalFlags;
|
||||
UINT32 version;
|
||||
UINT32 generalFlags;
|
||||
|
||||
stream_read_uint32(s, version); /* version (4 bytes) */
|
||||
stream_read_uint32(s, generalFlags); /* generalFlags (4 bytes) */
|
||||
stream_read_UINT32(s, version); /* version (4 bytes) */
|
||||
stream_read_UINT32(s, generalFlags); /* generalFlags (4 bytes) */
|
||||
|
||||
DEBUG_CLIPRDR("Version: %d", version);
|
||||
|
||||
@ -115,36 +118,36 @@ static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, STREAM* s
|
||||
#endif
|
||||
|
||||
if (generalFlags & CB_USE_LONG_FORMAT_NAMES)
|
||||
cliprdr->use_long_format_names = true;
|
||||
cliprdr->use_long_format_names = TRUE;
|
||||
|
||||
if (generalFlags & CB_STREAM_FILECLIP_ENABLED)
|
||||
cliprdr->stream_fileclip_enabled = true;
|
||||
cliprdr->stream_fileclip_enabled = TRUE;
|
||||
|
||||
if (generalFlags & CB_FILECLIP_NO_FILE_PATHS)
|
||||
cliprdr->fileclip_no_file_paths = true;
|
||||
cliprdr->fileclip_no_file_paths = TRUE;
|
||||
|
||||
if (generalFlags & CB_CAN_LOCK_CLIPDATA)
|
||||
cliprdr->can_lock_clipdata = true;
|
||||
cliprdr->can_lock_clipdata = TRUE;
|
||||
|
||||
cliprdr->received_caps = true;
|
||||
cliprdr->received_caps = TRUE;
|
||||
}
|
||||
|
||||
static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, STREAM* s, uint16 length, uint16 flags)
|
||||
static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, STREAM* s, UINT16 length, UINT16 flags)
|
||||
{
|
||||
int i;
|
||||
uint16 lengthCapability;
|
||||
uint16 cCapabilitiesSets;
|
||||
uint16 capabilitySetType;
|
||||
UINT16 lengthCapability;
|
||||
UINT16 cCapabilitiesSets;
|
||||
UINT16 capabilitySetType;
|
||||
|
||||
stream_read_uint16(s, cCapabilitiesSets); /* cCapabilitiesSets (2 bytes) */
|
||||
stream_seek_uint16(s); /* pad1 (2 bytes) */
|
||||
stream_read_UINT16(s, cCapabilitiesSets); /* cCapabilitiesSets (2 bytes) */
|
||||
stream_seek_UINT16(s); /* pad1 (2 bytes) */
|
||||
|
||||
DEBUG_CLIPRDR("cCapabilitiesSets %d", cCapabilitiesSets);
|
||||
|
||||
for (i = 0; i < cCapabilitiesSets; i++)
|
||||
{
|
||||
stream_read_uint16(s, capabilitySetType); /* capabilitySetType (2 bytes) */
|
||||
stream_read_uint16(s, lengthCapability); /* lengthCapability (2 bytes) */
|
||||
stream_read_UINT16(s, capabilitySetType); /* capabilitySetType (2 bytes) */
|
||||
stream_read_UINT16(s, lengthCapability); /* lengthCapability (2 bytes) */
|
||||
|
||||
switch (capabilitySetType)
|
||||
{
|
||||
@ -162,7 +165,7 @@ static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, STREAM* s, uint16
|
||||
static void cliprdr_send_clip_caps(cliprdrPlugin* cliprdr)
|
||||
{
|
||||
STREAM* s;
|
||||
uint32 flags;
|
||||
UINT32 flags;
|
||||
|
||||
s = cliprdr_packet_new(CB_CLIP_CAPS, 0, 4 + CB_CAPSTYPE_GENERAL_LEN);
|
||||
|
||||
@ -170,17 +173,17 @@ static void cliprdr_send_clip_caps(cliprdrPlugin* cliprdr)
|
||||
|
||||
flags = CB_USE_LONG_FORMAT_NAMES;
|
||||
|
||||
stream_write_uint16(s, 1); /* cCapabilitiesSets */
|
||||
stream_write_uint16(s, 0); /* pad1 */
|
||||
stream_write_uint16(s, CB_CAPSTYPE_GENERAL); /* capabilitySetType */
|
||||
stream_write_uint16(s, CB_CAPSTYPE_GENERAL_LEN); /* lengthCapability */
|
||||
stream_write_uint32(s, CB_CAPS_VERSION_2); /* version */
|
||||
stream_write_uint32(s, flags); /* generalFlags */
|
||||
stream_write_UINT16(s, 1); /* cCapabilitiesSets */
|
||||
stream_write_UINT16(s, 0); /* pad1 */
|
||||
stream_write_UINT16(s, CB_CAPSTYPE_GENERAL); /* capabilitySetType */
|
||||
stream_write_UINT16(s, CB_CAPSTYPE_GENERAL_LEN); /* lengthCapability */
|
||||
stream_write_UINT32(s, CB_CAPS_VERSION_2); /* version */
|
||||
stream_write_UINT32(s, flags); /* generalFlags */
|
||||
|
||||
cliprdr_packet_send(cliprdr, s);
|
||||
}
|
||||
|
||||
static void cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr, STREAM* s, uint16 length, uint16 flags)
|
||||
static void cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr, STREAM* s, UINT16 length, UINT16 flags)
|
||||
{
|
||||
RDP_EVENT* event;
|
||||
|
||||
@ -193,14 +196,14 @@ static void cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr, STREAM* s, uin
|
||||
|
||||
static void cliprdr_process_receive(rdpSvcPlugin* plugin, STREAM* s)
|
||||
{
|
||||
uint16 msgType;
|
||||
uint16 msgFlags;
|
||||
uint32 dataLen;
|
||||
UINT16 msgType;
|
||||
UINT16 msgFlags;
|
||||
UINT32 dataLen;
|
||||
cliprdrPlugin* cliprdr = (cliprdrPlugin*) plugin;
|
||||
|
||||
stream_read_uint16(s, msgType);
|
||||
stream_read_uint16(s, msgFlags);
|
||||
stream_read_uint32(s, dataLen);
|
||||
stream_read_UINT16(s, msgType);
|
||||
stream_read_UINT16(s, msgFlags);
|
||||
stream_read_UINT32(s, dataLen);
|
||||
|
||||
DEBUG_CLIPRDR("msgType: %s (%d), msgFlags: %d dataLen: %d",
|
||||
CB_MSG_TYPE_STRINGS[msgType], msgType, msgFlags, dataLen);
|
||||
@ -265,9 +268,35 @@ static void cliprdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
|
||||
|
||||
static void cliprdr_process_terminate(rdpSvcPlugin* plugin)
|
||||
{
|
||||
xfree(plugin);
|
||||
free(plugin);
|
||||
}
|
||||
|
||||
DEFINE_SVC_PLUGIN(cliprdr, "cliprdr",
|
||||
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
|
||||
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL)
|
||||
/* cliprdr is always built-in */
|
||||
#define VirtualChannelEntry cliprdr_VirtualChannelEntry
|
||||
|
||||
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||
{
|
||||
cliprdrPlugin* _p;
|
||||
|
||||
_p = (cliprdrPlugin*) malloc(sizeof(cliprdrPlugin));
|
||||
ZeroMemory(_p, sizeof(cliprdrPlugin));
|
||||
|
||||
_p->plugin.channel_def.options =
|
||||
CHANNEL_OPTION_INITIALIZED |
|
||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||
CHANNEL_OPTION_COMPRESS_RDP |
|
||||
CHANNEL_OPTION_SHOW_PROTOCOL;
|
||||
|
||||
strcpy(_p->plugin.channel_def.name, "cliprdr");
|
||||
|
||||
_p->plugin.connect_callback = cliprdr_process_connect;
|
||||
_p->plugin.receive_callback = cliprdr_process_receive;
|
||||
_p->plugin.event_callback = cliprdr_process_event;
|
||||
_p->plugin.terminate_callback = cliprdr_process_terminate;
|
||||
|
||||
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Clipboard Virtual Channel
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
struct _CLIPRDR_FORMAT_NAME
|
||||
{
|
||||
uint32 id;
|
||||
UINT32 id;
|
||||
char* name;
|
||||
int length;
|
||||
};
|
||||
@ -35,17 +35,17 @@ typedef struct _CLIPRDR_FORMAT_NAME CLIPRDR_FORMAT_NAME;
|
||||
struct cliprdr_plugin
|
||||
{
|
||||
rdpSvcPlugin plugin;
|
||||
boolean received_caps;
|
||||
boolean use_long_format_names;
|
||||
boolean stream_fileclip_enabled;
|
||||
boolean fileclip_no_file_paths;
|
||||
boolean can_lock_clipdata;
|
||||
BOOL received_caps;
|
||||
BOOL use_long_format_names;
|
||||
BOOL stream_fileclip_enabled;
|
||||
BOOL fileclip_no_file_paths;
|
||||
BOOL can_lock_clipdata;
|
||||
CLIPRDR_FORMAT_NAME* format_names;
|
||||
int num_format_names;
|
||||
};
|
||||
typedef struct cliprdr_plugin cliprdrPlugin;
|
||||
|
||||
STREAM* cliprdr_packet_new(uint16 msgType, uint16 msgFlags, uint32 dataLen);
|
||||
STREAM* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen);
|
||||
void cliprdr_packet_send(cliprdrPlugin* cliprdr, STREAM* data_out);
|
||||
|
||||
#ifdef WITH_DEBUG_CLIPRDR
|
||||
|
3
channels/cliprdr/client/module.def
Normal file
3
channels/cliprdr/client/module.def
Normal file
@ -0,0 +1,3 @@
|
||||
LIBRARY "cliprdr"
|
||||
EXPORTS
|
||||
VirtualChannelEntry @1
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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,19 +15,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(PARALLEL_SRCS
|
||||
parallel_main.c
|
||||
)
|
||||
set(MODULE_NAME "disk")
|
||||
set(MODULE_PREFIX "CHANNEL_RDPDR_DISK")
|
||||
|
||||
include_directories(..)
|
||||
|
||||
add_library(parallel ${PARALLEL_SRCS})
|
||||
set_target_properties(parallel PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(parallel freerdp)
|
||||
else()
|
||||
target_link_libraries(parallel freerdp-utils)
|
||||
if(WITH_CLIENT_CHANNELS)
|
||||
add_subdirectory(client)
|
||||
if(${MODULE_PREFIX}_CLIENT_STATIC)
|
||||
set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(TARGETS parallel DESTINATION ${FREERDP_PLUGIN_PATH})
|
11
channels/disk/ChannelOptions.cmake
Normal file
11
channels/disk/ChannelOptions.cmake
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
set(CHANNEL_TYPE "device")
|
||||
set(CHANNEL_SHORT_NAME "disk")
|
||||
set(CHANNEL_LONG_NAME "Disk Redirection Virtual Channel Extension")
|
||||
set(CHANNEL_SPECIFICATIONS "[MS-RDPEFS]")
|
||||
|
||||
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
|
||||
|
||||
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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.
|
||||
@ -18,7 +16,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
set(MODULE_NAME "disk")
|
||||
set(MODULE_PREFIX "CHANNEL_DEVICE_DISK")
|
||||
set(MODULE_PREFIX "CHANNEL_RDPDR_DISK_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
disk_file.c
|
||||
@ -26,22 +24,38 @@ set(${MODULE_PREFIX}_SRCS
|
||||
disk_main.c)
|
||||
|
||||
if(WIN32)
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}
|
||||
statvfs.c
|
||||
statvfs.h
|
||||
dirent.h)
|
||||
endif()
|
||||
|
||||
include_directories(..)
|
||||
if(MSVC AND (NOT STATIC_CHANNELS))
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
|
||||
endif()
|
||||
|
||||
if(NOT STATIC_CHANNELS)
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
else()
|
||||
set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_ENTRY "DeviceServiceEntry" PARENT_SCOPE)
|
||||
|
||||
add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})
|
||||
endif()
|
||||
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
if(MONOLITHIC_BUILD)
|
||||
set(${MODULE_PREFIX}_LIBS freerdp winpr)
|
||||
else()
|
||||
set(${MODULE_PREFIX}_LIBS freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
||||
|
||||
|
@ -137,7 +137,7 @@
|
||||
/*
|
||||
* 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
|
||||
* only defined for compatibility. These macros should always return FALSE
|
||||
* on Windows.
|
||||
*/
|
||||
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO)
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* File System Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2012 Gerald Richter
|
||||
* 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.
|
||||
@ -38,9 +38,12 @@
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@ -50,11 +53,9 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "rdpdr_constants.h"
|
||||
#include "rdpdr_types.h"
|
||||
#include "disk_file.h"
|
||||
|
||||
static boolean disk_file_wildcard_match(const char* pattern, const char* filename)
|
||||
static BOOL disk_file_wildcard_match(const char* pattern, const char* filename)
|
||||
{
|
||||
const char *p = pattern, *f = filename;
|
||||
char c;
|
||||
@ -70,39 +71,49 @@ static boolean disk_file_wildcard_match(const char* pattern, const char* filenam
|
||||
{
|
||||
c = *p++;
|
||||
if (!c) /* shortcut */
|
||||
return true;
|
||||
return TRUE;
|
||||
/* TODO: skip to tail comparison */
|
||||
}
|
||||
if (c != *f++)
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!*f)
|
||||
return true;
|
||||
return TRUE;
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void disk_file_fix_path(char* path)
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
int length;
|
||||
|
||||
len = strlen(path);
|
||||
for (i = 0; i < len; i++)
|
||||
length = strlen(path);
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
if (path[i] == '\\')
|
||||
path[i] = '/';
|
||||
}
|
||||
if (len > 0 && path[len - 1] == '/')
|
||||
path[len - 1] = '\0';
|
||||
|
||||
#ifdef WIN32
|
||||
if ((length == 3) && (path[1] == ':') && (path[2] == '/'))
|
||||
return;
|
||||
#else
|
||||
if ((length == 1) && (path[0] == '/'))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if ((length > 0) && (path[length - 1] == '/'))
|
||||
path[length - 1] = '\0';
|
||||
}
|
||||
|
||||
static char* disk_file_combine_fullpath(const char* base_path, const char* path)
|
||||
{
|
||||
char* fullpath;
|
||||
|
||||
fullpath = xmalloc(strlen(base_path) + strlen(path) + 1);
|
||||
fullpath = (char*) malloc(strlen(base_path) + strlen(path) + 1);
|
||||
strcpy(fullpath, base_path);
|
||||
strcat(fullpath, path);
|
||||
disk_file_fix_path(fullpath);
|
||||
@ -110,18 +121,18 @@ static char* disk_file_combine_fullpath(const char* base_path, const char* path)
|
||||
return fullpath;
|
||||
}
|
||||
|
||||
static boolean disk_file_remove_dir(const char* path)
|
||||
static BOOL disk_file_remove_dir(const char* path)
|
||||
{
|
||||
DIR* dir;
|
||||
struct dirent* pdirent;
|
||||
struct STAT st;
|
||||
char* p;
|
||||
boolean ret = true;
|
||||
struct STAT st;
|
||||
struct dirent* pdirent;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
dir = opendir(path);
|
||||
|
||||
if (dir == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
pdirent = readdir(dir);
|
||||
|
||||
@ -133,12 +144,13 @@ static boolean disk_file_remove_dir(const char* path)
|
||||
continue;
|
||||
}
|
||||
|
||||
p = xmalloc(strlen(path) + strlen(pdirent->d_name) + 2);
|
||||
p = (char*) malloc(strlen(path) + strlen(pdirent->d_name) + 2);
|
||||
sprintf(p, "%s/%s", path, pdirent->d_name);
|
||||
|
||||
if (STAT(p, &st) != 0)
|
||||
{
|
||||
DEBUG_WARN("stat %s failed.", p);
|
||||
ret = false;
|
||||
ret = FALSE;
|
||||
}
|
||||
else if (S_ISDIR(st.st_mode))
|
||||
{
|
||||
@ -147,11 +159,14 @@ static boolean disk_file_remove_dir(const char* path)
|
||||
else if (unlink(p) < 0)
|
||||
{
|
||||
DEBUG_WARN("unlink %s failed.", p);
|
||||
ret = false;
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
ret = true;
|
||||
xfree(p);
|
||||
{
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
free(p);
|
||||
|
||||
if (!ret)
|
||||
break;
|
||||
@ -160,12 +175,13 @@ static boolean disk_file_remove_dir(const char* path)
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
if (rmdir(path) < 0)
|
||||
{
|
||||
DEBUG_WARN("rmdir %s failed.", path);
|
||||
ret = false;
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +190,7 @@ static boolean disk_file_remove_dir(const char* path)
|
||||
|
||||
static void disk_file_set_fullpath(DISK_FILE* file, char* fullpath)
|
||||
{
|
||||
xfree(file->fullpath);
|
||||
free(file->fullpath);
|
||||
file->fullpath = fullpath;
|
||||
file->filename = strrchr(file->fullpath, '/');
|
||||
|
||||
@ -184,30 +200,30 @@ static void disk_file_set_fullpath(DISK_FILE* file, char* fullpath)
|
||||
file->filename += 1;
|
||||
}
|
||||
|
||||
static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 CreateDisposition, uint32 CreateOptions)
|
||||
static BOOL disk_file_init(DISK_FILE* file, UINT32 DesiredAccess, UINT32 CreateDisposition, UINT32 CreateOptions)
|
||||
{
|
||||
struct STAT st;
|
||||
boolean exists;
|
||||
BOOL exists;
|
||||
#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;
|
||||
BOOL largeFile = FALSE;
|
||||
#endif
|
||||
int oflag = 0;
|
||||
|
||||
if (STAT(file->fullpath, &st) == 0)
|
||||
{
|
||||
file->is_dir = (S_ISDIR(st.st_mode) ? true : false);
|
||||
file->is_dir = (S_ISDIR(st.st_mode) ? TRUE : FALSE);
|
||||
#ifndef WIN32
|
||||
if (st.st_size > (unsigned long)0x07fffffff)
|
||||
largeFile = true;
|
||||
largeFile = TRUE;
|
||||
#endif
|
||||
exists = true;
|
||||
exists = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
file->is_dir = ((CreateOptions & FILE_DIRECTORY_FILE) ? true : false);
|
||||
file->is_dir = ((CreateOptions & FILE_DIRECTORY_FILE) ? TRUE : FALSE);
|
||||
if (file->is_dir)
|
||||
{
|
||||
//Should only create the directory if the disposition allows for it
|
||||
@ -216,11 +232,11 @@ static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 Crea
|
||||
if (mkdir(file->fullpath, mode) != 0)
|
||||
{
|
||||
file->err = errno;
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
exists = false;
|
||||
exists = FALSE;
|
||||
}
|
||||
|
||||
if (file->is_dir)
|
||||
@ -229,7 +245,7 @@ static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 Crea
|
||||
if (file->dir == NULL)
|
||||
{
|
||||
file->err = errno;
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -259,7 +275,7 @@ static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 Crea
|
||||
|
||||
if (CreateOptions & FILE_DELETE_ON_CLOSE && DesiredAccess & DELETE)
|
||||
{
|
||||
file->delete_pending = true;
|
||||
file->delete_pending = TRUE;
|
||||
}
|
||||
|
||||
if ((DesiredAccess & GENERIC_ALL)
|
||||
@ -283,15 +299,15 @@ static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 Crea
|
||||
if (file->fd == -1)
|
||||
{
|
||||
file->err = errno;
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DISK_FILE* disk_file_new(const char* base_path, const char* path, uint32 id,
|
||||
uint32 DesiredAccess, uint32 CreateDisposition, uint32 CreateOptions)
|
||||
DISK_FILE* disk_file_new(const char* base_path, const char* path, UINT32 id,
|
||||
UINT32 DesiredAccess, UINT32 CreateDisposition, UINT32 CreateOptions)
|
||||
{
|
||||
DISK_FILE* file;
|
||||
|
||||
@ -325,132 +341,132 @@ void disk_file_free(DISK_FILE* file)
|
||||
unlink(file->fullpath);
|
||||
}
|
||||
|
||||
xfree(file->pattern);
|
||||
xfree(file->fullpath);
|
||||
xfree(file);
|
||||
free(file->pattern);
|
||||
free(file->fullpath);
|
||||
free(file);
|
||||
}
|
||||
|
||||
boolean disk_file_seek(DISK_FILE* file, uint64 Offset)
|
||||
BOOL disk_file_seek(DISK_FILE* file, UINT64 Offset)
|
||||
{
|
||||
if (file->is_dir || file->fd == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
if (LSEEK(file->fd, Offset, SEEK_SET) == (off_t)-1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
boolean disk_file_read(DISK_FILE* file, uint8* buffer, uint32* Length)
|
||||
BOOL disk_file_read(DISK_FILE* file, BYTE* buffer, UINT32* Length)
|
||||
{
|
||||
ssize_t r;
|
||||
|
||||
if (file->is_dir || file->fd == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
r = read(file->fd, buffer, *Length);
|
||||
if (r < 0)
|
||||
return false;
|
||||
*Length = (uint32)r;
|
||||
return FALSE;
|
||||
*Length = (UINT32)r;
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
boolean disk_file_write(DISK_FILE* file, uint8* buffer, uint32 Length)
|
||||
BOOL disk_file_write(DISK_FILE* file, BYTE* buffer, UINT32 Length)
|
||||
{
|
||||
ssize_t r;
|
||||
|
||||
if (file->is_dir || file->fd == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
while (Length > 0)
|
||||
{
|
||||
r = write(file->fd, buffer, Length);
|
||||
if (r == -1)
|
||||
return false;
|
||||
return FALSE;
|
||||
Length -= r;
|
||||
buffer += r;
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
boolean disk_file_query_information(DISK_FILE* file, uint32 FsInformationClass, STREAM* output)
|
||||
BOOL disk_file_query_information(DISK_FILE* file, UINT32 FsInformationClass, STREAM* output)
|
||||
{
|
||||
struct STAT st;
|
||||
|
||||
if (STAT(file->fullpath, &st) != 0)
|
||||
{
|
||||
stream_write_uint32(output, 0); /* Length */
|
||||
return false;
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
return FALSE;
|
||||
}
|
||||
switch (FsInformationClass)
|
||||
{
|
||||
case FileBasicInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232094.aspx */
|
||||
stream_write_uint32(output, 36); /* Length */
|
||||
stream_write_UINT32(output, 36); /* Length */
|
||||
stream_check_size(output, 36);
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
/* Reserved(4), MUST NOT be added! */
|
||||
break;
|
||||
|
||||
case FileStandardInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232088.aspx */
|
||||
stream_write_uint32(output, 22); /* Length */
|
||||
stream_write_UINT32(output, 22); /* Length */
|
||||
stream_check_size(output, 22);
|
||||
stream_write_uint64(output, st.st_size); /* AllocationSize */
|
||||
stream_write_uint64(output, st.st_size); /* EndOfFile */
|
||||
stream_write_uint32(output, st.st_nlink); /* NumberOfLinks */
|
||||
stream_write_uint8(output, file->delete_pending ? 1 : 0); /* DeletePending */
|
||||
stream_write_uint8(output, file->is_dir ? 1 : 0); /* Directory */
|
||||
stream_write_UINT64(output, st.st_size); /* AllocationSize */
|
||||
stream_write_UINT64(output, st.st_size); /* EndOfFile */
|
||||
stream_write_UINT32(output, st.st_nlink); /* NumberOfLinks */
|
||||
stream_write_BYTE(output, file->delete_pending ? 1 : 0); /* DeletePending */
|
||||
stream_write_BYTE(output, file->is_dir ? 1 : 0); /* Directory */
|
||||
/* Reserved(2), MUST NOT be added! */
|
||||
break;
|
||||
|
||||
case FileAttributeTagInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232093.aspx */
|
||||
stream_write_uint32(output, 8); /* Length */
|
||||
stream_write_UINT32(output, 8); /* Length */
|
||||
stream_check_size(output, 8);
|
||||
stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
stream_write_uint32(output, 0); /* ReparseTag */
|
||||
stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
stream_write_UINT32(output, 0); /* ReparseTag */
|
||||
break;
|
||||
|
||||
default:
|
||||
stream_write_uint32(output, 0); /* Length */
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, uint32 Length, STREAM* input)
|
||||
BOOL disk_file_set_information(DISK_FILE* file, UINT32 FsInformationClass, UINT32 Length, STREAM* input)
|
||||
{
|
||||
char* s;
|
||||
|
||||
mode_t m;
|
||||
uint64 size;
|
||||
UINT64 size;
|
||||
char* fullpath;
|
||||
struct STAT st;
|
||||
struct timeval tv[2];
|
||||
uint64 LastWriteTime;
|
||||
uint32 FileAttributes;
|
||||
uint32 FileNameLength;
|
||||
UINT64 LastWriteTime;
|
||||
UINT32 FileAttributes;
|
||||
UINT32 FileNameLength;
|
||||
|
||||
switch (FsInformationClass)
|
||||
{
|
||||
case FileBasicInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232094.aspx */
|
||||
stream_seek_uint64(input); /* CreationTime */
|
||||
stream_seek_uint64(input); /* LastAccessTime */
|
||||
stream_read_uint64(input, LastWriteTime);
|
||||
stream_seek_uint64(input); /* ChangeTime */
|
||||
stream_read_uint32(input, FileAttributes);
|
||||
stream_seek_UINT64(input); /* CreationTime */
|
||||
stream_seek_UINT64(input); /* LastAccessTime */
|
||||
stream_read_UINT64(input, LastWriteTime);
|
||||
stream_seek_UINT64(input); /* ChangeTime */
|
||||
stream_read_UINT32(input, FileAttributes);
|
||||
|
||||
if (FSTAT(file->fd, &st) != 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
tv[0].tv_sec = st.st_atime;
|
||||
tv[0].tv_usec = 0;
|
||||
@ -477,30 +493,30 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232067.aspx */
|
||||
case FileAllocationInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232076.aspx */
|
||||
stream_read_uint64(input, size);
|
||||
stream_read_UINT64(input, size);
|
||||
if (ftruncate(file->fd, size) != 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case FileDispositionInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232098.aspx */
|
||||
/* http://msdn.microsoft.com/en-us/library/cc241371.aspx */
|
||||
if (Length)
|
||||
stream_read_uint8(input, file->delete_pending);
|
||||
stream_read_BYTE(input, file->delete_pending);
|
||||
else
|
||||
file->delete_pending = 1;
|
||||
break;
|
||||
|
||||
case FileRenameInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232085.aspx */
|
||||
stream_seek_uint8(input); /* ReplaceIfExists */
|
||||
stream_seek_uint8(input); /* RootDirectory */
|
||||
stream_read_uint32(input, FileNameLength);
|
||||
stream_seek_BYTE(input); /* ReplaceIfExists */
|
||||
stream_seek_BYTE(input); /* RootDirectory */
|
||||
stream_read_UINT32(input, FileNameLength);
|
||||
|
||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(input), &s, FileNameLength / 2);
|
||||
|
||||
fullpath = disk_file_combine_fullpath(file->basepath, s);
|
||||
xfree(s);
|
||||
free(s);
|
||||
|
||||
/* TODO rename does not work on win32 */
|
||||
if (rename(file->fullpath, fullpath) == 0)
|
||||
@ -512,24 +528,24 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui
|
||||
{
|
||||
DEBUG_WARN("rename %s to %s failed, errno = %d", file->fullpath, fullpath, errno);
|
||||
free(fullpath);
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, uint8 InitialQuery,
|
||||
BOOL disk_file_query_directory(DISK_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery,
|
||||
const char* path, STREAM* output)
|
||||
{
|
||||
int length;
|
||||
boolean ret;
|
||||
BOOL ret;
|
||||
WCHAR* ent_path;
|
||||
struct STAT st;
|
||||
struct dirent* ent;
|
||||
@ -538,18 +554,18 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
|
||||
|
||||
if (!file->dir)
|
||||
{
|
||||
stream_write_uint32(output, 0); /* Length */
|
||||
stream_write_uint8(output, 0); /* Padding */
|
||||
return false;
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
stream_write_BYTE(output, 0); /* Padding */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (InitialQuery != 0)
|
||||
{
|
||||
rewinddir(file->dir);
|
||||
xfree(file->pattern);
|
||||
free(file->pattern);
|
||||
|
||||
if (path[0])
|
||||
file->pattern = strdup(strrchr(path, '\\') + 1);
|
||||
file->pattern = _strdup(strrchr(path, '\\') + 1);
|
||||
else
|
||||
file->pattern = NULL;
|
||||
}
|
||||
@ -575,9 +591,9 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
|
||||
if (ent == NULL)
|
||||
{
|
||||
DEBUG_SVC(" pattern %s not found.", file->pattern);
|
||||
stream_write_uint32(output, 0); /* Length */
|
||||
stream_write_uint8(output, 0); /* Padding */
|
||||
return false;
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
stream_write_BYTE(output, 0); /* Padding */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
memset(&st, 0, sizeof(struct STAT));
|
||||
@ -590,65 +606,65 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
|
||||
}
|
||||
|
||||
DEBUG_SVC(" pattern %s matched %s", file->pattern, ent_path);
|
||||
xfree(ent_path);
|
||||
free(ent_path);
|
||||
|
||||
length = freerdp_AsciiToUnicodeAlloc(ent->d_name, &ent_path, 0) * 2;
|
||||
|
||||
ret = true;
|
||||
ret = TRUE;
|
||||
|
||||
switch (FsInformationClass)
|
||||
{
|
||||
case FileDirectoryInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232097.aspx */
|
||||
stream_write_uint32(output, 64 + length); /* Length */
|
||||
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 */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
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, length); /* FileNameLength */
|
||||
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 */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
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, 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 + length); /* Length */
|
||||
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 */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
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, length); /* FileNameLength */
|
||||
stream_write_uint32(output, 0); /* EaSize */
|
||||
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 */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
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, length); /* FileNameLength */
|
||||
stream_write_UINT32(output, 0); /* EaSize */
|
||||
stream_write(output, ent_path, length);
|
||||
break;
|
||||
|
||||
case FileBothDirectoryInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232095.aspx */
|
||||
stream_write_uint32(output, 93 + length); /* Length */
|
||||
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 */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
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, length); /* FileNameLength */
|
||||
stream_write_uint32(output, 0); /* EaSize */
|
||||
stream_write_uint8(output, 0); /* ShortNameLength */
|
||||
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 */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
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, length); /* FileNameLength */
|
||||
stream_write_UINT32(output, 0); /* EaSize */
|
||||
stream_write_BYTE(output, 0); /* ShortNameLength */
|
||||
/* Reserved(1), MUST NOT be added! */
|
||||
stream_write_zero(output, 24); /* ShortName */
|
||||
stream_write(output, ent_path, length);
|
||||
@ -656,23 +672,23 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
|
||||
|
||||
case FileNamesInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232077.aspx */
|
||||
stream_write_uint32(output, 12 + length); /* Length */
|
||||
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, length); /* FileNameLength */
|
||||
stream_write_UINT32(output, 0); /* NextEntryOffset */
|
||||
stream_write_UINT32(output, 0); /* FileIndex */
|
||||
stream_write_UINT32(output, length); /* FileNameLength */
|
||||
stream_write(output, ent_path, length);
|
||||
break;
|
||||
|
||||
default:
|
||||
stream_write_uint32(output, 0); /* Length */
|
||||
stream_write_uint8(output, 0); /* Padding */
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
stream_write_BYTE(output, 0); /* Padding */
|
||||
DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
|
||||
ret = false;
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
xfree(ent_path);
|
||||
free(ent_path);
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* File System Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2012 Gerald Richter
|
||||
* 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.
|
||||
@ -49,8 +49,8 @@
|
||||
#define unlink(a) _unlink(a)
|
||||
#define ftruncate(a,b) _chsize(a,b)
|
||||
|
||||
typedef uint32 ssize_t ;
|
||||
typedef uint32 mode_t ;
|
||||
typedef UINT32 ssize_t ;
|
||||
typedef UINT32 mode_t ;
|
||||
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#define STAT stat
|
||||
@ -70,9 +70,9 @@ typedef uint32 mode_t ;
|
||||
#define EPOCH_DIFF 11644473600LL
|
||||
|
||||
#define FILE_TIME_SYSTEM_TO_RDP(_t) \
|
||||
(((uint64)(_t) + EPOCH_DIFF) * 10000000LL)
|
||||
(((UINT64)(_t) + EPOCH_DIFF) * 10000000LL)
|
||||
#define FILE_TIME_RDP_TO_SYSTEM(_t) \
|
||||
(((_t) == 0LL || (_t) == (uint64)(-1LL)) ? 0 : (time_t)((_t) / 10000000LL - EPOCH_DIFF))
|
||||
(((_t) == 0LL || (_t) == (UINT64)(-1LL)) ? 0 : (time_t)((_t) / 10000000LL - EPOCH_DIFF))
|
||||
|
||||
#define FILE_ATTR_SYSTEM_TO_RDP(_f, _st) ( \
|
||||
(S_ISDIR(_st.st_mode) ? FILE_ATTRIBUTE_DIRECTORY : 0) | \
|
||||
@ -83,8 +83,8 @@ typedef uint32 mode_t ;
|
||||
typedef struct _DISK_FILE DISK_FILE;
|
||||
struct _DISK_FILE
|
||||
{
|
||||
uint32 id;
|
||||
boolean is_dir;
|
||||
UINT32 id;
|
||||
BOOL is_dir;
|
||||
int fd;
|
||||
int err;
|
||||
DIR* dir;
|
||||
@ -92,19 +92,19 @@ struct _DISK_FILE
|
||||
char* fullpath;
|
||||
char* filename;
|
||||
char* pattern;
|
||||
boolean delete_pending;
|
||||
BOOL delete_pending;
|
||||
};
|
||||
|
||||
DISK_FILE* disk_file_new(const char* base_path, const char* path, uint32 id,
|
||||
uint32 DesiredAccess, uint32 CreateDisposition, uint32 CreateOptions);
|
||||
DISK_FILE* disk_file_new(const char* base_path, const char* path, UINT32 id,
|
||||
UINT32 DesiredAccess, UINT32 CreateDisposition, UINT32 CreateOptions);
|
||||
void disk_file_free(DISK_FILE* file);
|
||||
|
||||
boolean disk_file_seek(DISK_FILE* file, uint64 Offset);
|
||||
boolean disk_file_read(DISK_FILE* file, uint8* buffer, uint32* Length);
|
||||
boolean disk_file_write(DISK_FILE* file, uint8* buffer, uint32 Length);
|
||||
boolean disk_file_query_information(DISK_FILE* file, uint32 FsInformationClass, STREAM* output);
|
||||
boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, uint32 Length, STREAM* input);
|
||||
boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, uint8 InitialQuery,
|
||||
BOOL disk_file_seek(DISK_FILE* file, UINT64 Offset);
|
||||
BOOL disk_file_read(DISK_FILE* file, BYTE* buffer, UINT32* Length);
|
||||
BOOL disk_file_write(DISK_FILE* file, BYTE* buffer, UINT32 Length);
|
||||
BOOL disk_file_query_information(DISK_FILE* file, UINT32 FsInformationClass, STREAM* output);
|
||||
BOOL disk_file_set_information(DISK_FILE* file, UINT32 FsInformationClass, UINT32 Length, STREAM* input);
|
||||
BOOL disk_file_query_directory(DISK_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery,
|
||||
const char* path, STREAM* output);
|
||||
|
||||
#endif /* __DISK_FILE_H */
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* File System Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2010-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.
|
||||
@ -39,6 +39,7 @@
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/list.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
@ -46,8 +47,6 @@
|
||||
#include <winpr/thread.h>
|
||||
#include <winpr/interlocked.h>
|
||||
|
||||
#include "rdpdr_constants.h"
|
||||
#include "rdpdr_types.h"
|
||||
#include "disk_file.h"
|
||||
|
||||
typedef struct _DISK_DEVICE DISK_DEVICE;
|
||||
@ -67,9 +66,9 @@ struct _DISK_DEVICE
|
||||
DEVMAN* devman;
|
||||
};
|
||||
|
||||
static uint32 disk_map_posix_err(int fs_errno)
|
||||
static UINT32 disk_map_posix_err(int fs_errno)
|
||||
{
|
||||
uint32 rc;
|
||||
UINT32 rc;
|
||||
|
||||
/* try to return NTSTATUS version of error code */
|
||||
|
||||
@ -102,7 +101,7 @@ static uint32 disk_map_posix_err(int fs_errno)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static DISK_FILE* disk_get_file_by_id(DISK_DEVICE* disk, uint32 id)
|
||||
static DISK_FILE* disk_get_file_by_id(DISK_DEVICE* disk, UINT32 id)
|
||||
{
|
||||
LIST_ITEM* item;
|
||||
DISK_FILE* file;
|
||||
@ -120,20 +119,20 @@ static DISK_FILE* disk_get_file_by_id(DISK_DEVICE* disk, uint32 id)
|
||||
|
||||
static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
DISK_FILE* file;
|
||||
uint32 DesiredAccess;
|
||||
uint32 CreateDisposition;
|
||||
uint32 CreateOptions;
|
||||
uint32 PathLength;
|
||||
char* path;
|
||||
uint32 FileId;
|
||||
uint8 Information;
|
||||
UINT32 FileId;
|
||||
DISK_FILE* file;
|
||||
BYTE Information;
|
||||
UINT32 DesiredAccess;
|
||||
UINT32 CreateDisposition;
|
||||
UINT32 CreateOptions;
|
||||
UINT32 PathLength;
|
||||
|
||||
stream_read_uint32(irp->input, DesiredAccess);
|
||||
stream_read_UINT32(irp->input, DesiredAccess);
|
||||
stream_seek(irp->input, 16); /* AllocationSize(8), FileAttributes(4), SharedAccess(4) */
|
||||
stream_read_uint32(irp->input, CreateDisposition);
|
||||
stream_read_uint32(irp->input, CreateOptions);
|
||||
stream_read_uint32(irp->input, PathLength);
|
||||
stream_read_UINT32(irp->input, CreateDisposition);
|
||||
stream_read_UINT32(irp->input, CreateOptions);
|
||||
stream_read_UINT32(irp->input, PathLength);
|
||||
|
||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
|
||||
|
||||
@ -155,7 +154,7 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp)
|
||||
FileId = 0;
|
||||
Information = 0;
|
||||
|
||||
/* map errno to windows result*/
|
||||
/* map errno to windows result */
|
||||
irp->IoStatus = disk_map_posix_err(file->err);
|
||||
disk_file_free(file);
|
||||
}
|
||||
@ -184,10 +183,10 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp)
|
||||
DEBUG_SVC("%s(%d) created.", file->fullpath, file->id);
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, FileId);
|
||||
stream_write_uint8(irp->output, Information);
|
||||
stream_write_UINT32(irp->output, FileId);
|
||||
stream_write_BYTE(irp->output, Information);
|
||||
|
||||
xfree(path);
|
||||
free(path);
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -220,12 +219,12 @@ static void disk_process_irp_close(DISK_DEVICE* disk, IRP* irp)
|
||||
static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
DISK_FILE* file;
|
||||
uint32 Length;
|
||||
uint64 Offset;
|
||||
uint8* buffer = NULL;
|
||||
UINT32 Length;
|
||||
UINT64 Offset;
|
||||
BYTE* buffer = NULL;
|
||||
|
||||
stream_read_uint32(irp->input, Length);
|
||||
stream_read_uint64(irp->input, Offset);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
|
||||
file = disk_get_file_by_id(disk, irp->FileId);
|
||||
|
||||
@ -245,11 +244,11 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp)
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = (uint8*) xmalloc(Length);
|
||||
buffer = (BYTE*) malloc(Length);
|
||||
if (!disk_file_read(file, buffer, &Length))
|
||||
{
|
||||
irp->IoStatus = STATUS_UNSUCCESSFUL;
|
||||
xfree(buffer);
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
Length = 0;
|
||||
|
||||
@ -261,7 +260,7 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp)
|
||||
}
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, Length);
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
|
||||
if (Length > 0)
|
||||
{
|
||||
@ -269,7 +268,7 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp)
|
||||
stream_write(irp->output, buffer, Length);
|
||||
}
|
||||
|
||||
xfree(buffer);
|
||||
free(buffer);
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -277,11 +276,11 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp)
|
||||
static void disk_process_irp_write(DISK_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
DISK_FILE* file;
|
||||
uint32 Length;
|
||||
uint64 Offset;
|
||||
UINT32 Length;
|
||||
UINT64 Offset;
|
||||
|
||||
stream_read_uint32(irp->input, Length);
|
||||
stream_read_uint64(irp->input, Offset);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
stream_seek(irp->input, 20); /* Padding */
|
||||
|
||||
file = disk_get_file_by_id(disk, irp->FileId);
|
||||
@ -312,8 +311,8 @@ static void disk_process_irp_write(DISK_DEVICE* disk, IRP* irp)
|
||||
DEBUG_SVC("write %llu-%llu to %s(%d).", Offset, Offset + Length, file->fullpath, file->id);
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, Length);
|
||||
stream_write_uint8(irp->output, 0); /* Padding */
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
stream_write_BYTE(irp->output, 0); /* Padding */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -321,9 +320,9 @@ static void disk_process_irp_write(DISK_DEVICE* disk, IRP* irp)
|
||||
static void disk_process_irp_query_information(DISK_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
DISK_FILE* file;
|
||||
uint32 FsInformationClass;
|
||||
UINT32 FsInformationClass;
|
||||
|
||||
stream_read_uint32(irp->input, FsInformationClass);
|
||||
stream_read_UINT32(irp->input, FsInformationClass);
|
||||
|
||||
file = disk_get_file_by_id(disk, irp->FileId);
|
||||
|
||||
@ -350,11 +349,11 @@ static void disk_process_irp_query_information(DISK_DEVICE* disk, IRP* irp)
|
||||
static void disk_process_irp_set_information(DISK_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
DISK_FILE* file;
|
||||
uint32 FsInformationClass;
|
||||
uint32 Length;
|
||||
UINT32 FsInformationClass;
|
||||
UINT32 Length;
|
||||
|
||||
stream_read_uint32(irp->input, FsInformationClass);
|
||||
stream_read_uint32(irp->input, Length);
|
||||
stream_read_UINT32(irp->input, FsInformationClass);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_seek(irp->input, 24); /* Padding */
|
||||
|
||||
file = disk_get_file_by_id(disk, irp->FileId);
|
||||
@ -376,14 +375,14 @@ static void disk_process_irp_set_information(DISK_DEVICE* disk, IRP* irp)
|
||||
DEBUG_SVC("FsInformationClass %d on %s(%d) ok.", FsInformationClass, file->fullpath, file->id);
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, Length);
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
|
||||
static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
uint32 FsInformationClass;
|
||||
UINT32 FsInformationClass;
|
||||
STREAM* output = irp->output;
|
||||
struct STATVFS svfst;
|
||||
struct STAT st;
|
||||
@ -392,7 +391,7 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir
|
||||
WCHAR* outStr;
|
||||
int length;
|
||||
|
||||
stream_read_uint32(irp->input, FsInformationClass);
|
||||
stream_read_UINT32(irp->input, FsInformationClass);
|
||||
|
||||
STATVFS(disk->path, &svfst);
|
||||
STAT(disk->path, &st);
|
||||
@ -402,64 +401,64 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir
|
||||
case FileFsVolumeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232108.aspx */
|
||||
length = freerdp_AsciiToUnicodeAlloc(volumeLabel, &outStr, 0) * 2;
|
||||
stream_write_uint32(output, 17 + length); /* Length */
|
||||
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, length); /* VolumeLabelLength */
|
||||
stream_write_uint8(output, 0); /* SupportsObjects */
|
||||
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, length); /* VolumeLabelLength */
|
||||
stream_write_BYTE(output, 0); /* SupportsObjects */
|
||||
/* Reserved(1), MUST NOT be added! */
|
||||
stream_write(output, outStr, length); /* VolumeLabel (Unicode) */
|
||||
xfree(outStr);
|
||||
free(outStr);
|
||||
break;
|
||||
|
||||
case FileFsSizeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232107.aspx */
|
||||
stream_write_uint32(output, 24); /* Length */
|
||||
stream_write_UINT32(output, 24); /* Length */
|
||||
stream_check_size(output, 24);
|
||||
stream_write_uint64(output, svfst.f_blocks); /* TotalAllocationUnits */
|
||||
stream_write_uint64(output, svfst.f_bavail); /* AvailableAllocationUnits */
|
||||
stream_write_uint32(output, 1); /* SectorsPerAllocationUnit */
|
||||
stream_write_uint32(output, svfst.f_bsize); /* BytesPerSector */
|
||||
stream_write_UINT64(output, svfst.f_blocks); /* TotalAllocationUnits */
|
||||
stream_write_UINT64(output, svfst.f_bavail); /* AvailableAllocationUnits */
|
||||
stream_write_UINT32(output, 1); /* SectorsPerAllocationUnit */
|
||||
stream_write_UINT32(output, svfst.f_bsize); /* BytesPerSector */
|
||||
break;
|
||||
|
||||
case FileFsAttributeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232101.aspx */
|
||||
length = freerdp_AsciiToUnicodeAlloc(diskType, &outStr, 0) * 2;
|
||||
stream_write_uint32(output, 12 + length); /* Length */
|
||||
stream_write_UINT32(output, 12 + length); /* Length */
|
||||
stream_check_size(output, 12 + length);
|
||||
stream_write_uint32(output,
|
||||
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, length); /* FileSystemNameLength */
|
||||
stream_write_UINT32(output, svfst.f_namemax/*510*/); /* MaximumComponentNameLength */
|
||||
stream_write_UINT32(output, length); /* FileSystemNameLength */
|
||||
stream_write(output, outStr, length); /* FileSystemName (Unicode) */
|
||||
xfree(outStr);
|
||||
free(outStr);
|
||||
break;
|
||||
|
||||
case FileFsFullSizeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232104.aspx */
|
||||
stream_write_uint32(output, 32); /* Length */
|
||||
stream_write_UINT32(output, 32); /* Length */
|
||||
stream_check_size(output, 32);
|
||||
stream_write_uint64(output, svfst.f_blocks); /* TotalAllocationUnits */
|
||||
stream_write_uint64(output, svfst.f_bavail); /* CallerAvailableAllocationUnits */
|
||||
stream_write_uint64(output, svfst.f_bfree); /* AvailableAllocationUnits */
|
||||
stream_write_uint32(output, 1); /* SectorsPerAllocationUnit */
|
||||
stream_write_uint32(output, svfst.f_bsize); /* BytesPerSector */
|
||||
stream_write_UINT64(output, svfst.f_blocks); /* TotalAllocationUnits */
|
||||
stream_write_UINT64(output, svfst.f_bavail); /* CallerAvailableAllocationUnits */
|
||||
stream_write_UINT64(output, svfst.f_bfree); /* AvailableAllocationUnits */
|
||||
stream_write_UINT32(output, 1); /* SectorsPerAllocationUnit */
|
||||
stream_write_UINT32(output, svfst.f_bsize); /* BytesPerSector */
|
||||
break;
|
||||
|
||||
case FileFsDeviceInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232109.aspx */
|
||||
stream_write_uint32(output, 8); /* Length */
|
||||
stream_write_UINT32(output, 8); /* Length */
|
||||
stream_check_size(output, 8);
|
||||
stream_write_uint32(output, FILE_DEVICE_DISK); /* DeviceType */
|
||||
stream_write_uint32(output, 0); /* Characteristics */
|
||||
stream_write_UINT32(output, FILE_DEVICE_DISK); /* DeviceType */
|
||||
stream_write_UINT32(output, 0); /* Characteristics */
|
||||
break;
|
||||
|
||||
default:
|
||||
irp->IoStatus = STATUS_UNSUCCESSFUL;
|
||||
stream_write_uint32(output, 0); /* Length */
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
|
||||
break;
|
||||
}
|
||||
@ -471,13 +470,13 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
char* path;
|
||||
DISK_FILE* file;
|
||||
uint8 InitialQuery;
|
||||
uint32 PathLength;
|
||||
uint32 FsInformationClass;
|
||||
BYTE InitialQuery;
|
||||
UINT32 PathLength;
|
||||
UINT32 FsInformationClass;
|
||||
|
||||
stream_read_uint32(irp->input, FsInformationClass);
|
||||
stream_read_uint8(irp->input, InitialQuery);
|
||||
stream_read_uint32(irp->input, PathLength);
|
||||
stream_read_UINT32(irp->input, FsInformationClass);
|
||||
stream_read_BYTE(irp->input, InitialQuery);
|
||||
stream_read_UINT32(irp->input, PathLength);
|
||||
stream_seek(irp->input, 23); /* Padding */
|
||||
|
||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
|
||||
@ -487,7 +486,7 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp)
|
||||
if (file == NULL)
|
||||
{
|
||||
irp->IoStatus = STATUS_UNSUCCESSFUL;
|
||||
stream_write_uint32(irp->output, 0); /* Length */
|
||||
stream_write_UINT32(irp->output, 0); /* Length */
|
||||
DEBUG_WARN("FileId %d not valid.", irp->FileId);
|
||||
}
|
||||
else if (!disk_file_query_directory(file, FsInformationClass, InitialQuery, path, irp->output))
|
||||
@ -495,7 +494,7 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp)
|
||||
irp->IoStatus = STATUS_NO_MORE_FILES;
|
||||
}
|
||||
|
||||
xfree(path);
|
||||
free(path);
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -515,7 +514,7 @@ static void disk_process_irp_directory_control(DISK_DEVICE* disk, IRP* irp)
|
||||
default:
|
||||
DEBUG_WARN("MinorFunction 0x%X not supported", irp->MinorFunction);
|
||||
irp->IoStatus = STATUS_NOT_SUPPORTED;
|
||||
stream_write_uint32(irp->output, 0); /* Length */
|
||||
stream_write_UINT32(irp->output, 0); /* Length */
|
||||
irp->Complete(irp);
|
||||
break;
|
||||
}
|
||||
@ -523,12 +522,14 @@ static void disk_process_irp_directory_control(DISK_DEVICE* disk, IRP* irp)
|
||||
|
||||
static void disk_process_irp_device_control(DISK_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
stream_write_uint32(irp->output, 0); /* OutputBufferLength */
|
||||
stream_write_UINT32(irp->output, 0); /* OutputBufferLength */
|
||||
irp->Complete(irp);
|
||||
}
|
||||
|
||||
static void disk_process_irp(DISK_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
irp->IoStatus = STATUS_SUCCESS;
|
||||
|
||||
switch (irp->MajorFunction)
|
||||
{
|
||||
case IRP_MJ_CREATE:
|
||||
@ -639,7 +640,7 @@ static void disk_free(DEVICE* device)
|
||||
disk_file_free(file);
|
||||
|
||||
list_free(disk->files);
|
||||
xfree(disk);
|
||||
free(disk);
|
||||
}
|
||||
|
||||
void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* name, char* path)
|
||||
@ -674,7 +675,7 @@ void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* na
|
||||
disk->device.data = stream_new(length + 1);
|
||||
|
||||
for (i = 0; i <= length; i++)
|
||||
stream_write_uint8(disk->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
stream_write_BYTE(disk->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
|
||||
disk->path = path;
|
||||
disk->files = list_new();
|
||||
@ -692,11 +693,11 @@ void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* na
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_STATIC_PLUGINS
|
||||
int disk_entry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
#else
|
||||
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
#ifdef STATIC_CHANNELS
|
||||
#define DeviceServiceEntry disk_DeviceServiceEntry
|
||||
#endif
|
||||
|
||||
const int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
{
|
||||
char* name;
|
||||
char* path;
|
||||
@ -717,7 +718,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
if( path[0] == '%' )
|
||||
{
|
||||
_snprintf(buf, sizeof(buf), "%s\\", getenv("USERPROFILE"));
|
||||
disk_register_disk_path(pEntryPoints, name, xstrdup(buf));
|
||||
disk_register_disk_path(pEntryPoints, name, _strdup(buf));
|
||||
}
|
||||
else if( path[0] == '*' )
|
||||
{
|
||||
@ -737,7 +738,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
buf[len + 1] = dev[0];
|
||||
buf[len + 2] = 0;
|
||||
buf[len + 3] = 0;
|
||||
disk_register_disk_path(pEntryPoints, xstrdup(buf), xstrdup(dev));
|
||||
disk_register_disk_path(pEntryPoints, _strdup(buf), _strdup(dev));
|
||||
}
|
||||
}
|
||||
}
|
3
channels/disk/client/module.def
Normal file
3
channels/disk/client/module.def
Normal file
@ -0,0 +1,3 @@
|
||||
LIBRARY "disk"
|
||||
EXPORTS
|
||||
DeviceServiceEntry @1
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* statvfs emulation für windows
|
||||
*
|
||||
* Copyright 2012 Gerald Richter
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* statvfs emulation for windows
|
||||
*
|
||||
* Copyright 2012 Gerald Richter
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -15,7 +15,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(MODULE_NAME "drdynvc")
|
||||
set(MODULE_PREFIX "CHANNEL_DRDYNVC")
|
||||
|
||||
if(WITH_CLIENT_CHANNELS)
|
||||
add_subdirectory(client)
|
||||
if(${MODULE_PREFIX}_CLIENT_STATIC)
|
||||
set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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,22 +15,31 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(DRDYNVC_SRCS
|
||||
set(MODULE_NAME "drdynvc")
|
||||
set(MODULE_PREFIX "CHANNEL_DRDYNVC_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
drdynvc_main.c
|
||||
drdynvc_main.h
|
||||
drdynvc_types.h
|
||||
dvcman.c
|
||||
dvcman.h
|
||||
)
|
||||
dvcman.h)
|
||||
|
||||
add_library(drdynvc ${DRDYNVC_SRCS})
|
||||
set_target_properties(drdynvc PROPERTIES PREFIX "")
|
||||
# drdynvc is always built-in
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(drdynvc freerdp winpr)
|
||||
set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE)
|
||||
|
||||
add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp winpr)
|
||||
else()
|
||||
target_link_libraries(drdynvc freerdp-utils winpr-synch)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils winpr-synch)
|
||||
endif()
|
||||
|
||||
install(TARGETS drdynvc DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Dynamic Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -25,6 +25,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
@ -55,35 +57,35 @@ struct drdynvc_plugin
|
||||
IWTSVirtualChannelManager* channel_mgr;
|
||||
};
|
||||
|
||||
static int drdynvc_write_variable_uint(STREAM* stream, uint32 val)
|
||||
static int drdynvc_write_variable_uint(STREAM* stream, UINT32 val)
|
||||
{
|
||||
int cb;
|
||||
|
||||
if (val <= 0xFF)
|
||||
{
|
||||
cb = 0;
|
||||
stream_write_uint8(stream, val);
|
||||
stream_write_BYTE(stream, val);
|
||||
}
|
||||
else if (val <= 0xFFFF)
|
||||
{
|
||||
cb = 1;
|
||||
stream_write_uint16(stream, val);
|
||||
stream_write_UINT16(stream, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
cb = 2;
|
||||
stream_write_uint32(stream, val);
|
||||
stream_write_UINT32(stream, val);
|
||||
}
|
||||
return cb;
|
||||
}
|
||||
|
||||
int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, uint32 data_size)
|
||||
int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UINT32 data_size)
|
||||
{
|
||||
STREAM* data_out;
|
||||
uint32 pos = 0;
|
||||
uint32 cbChId;
|
||||
uint32 cbLen;
|
||||
uint32 chunk_len;
|
||||
UINT32 pos = 0;
|
||||
UINT32 cbChId;
|
||||
UINT32 cbLen;
|
||||
UINT32 chunk_len;
|
||||
int error;
|
||||
|
||||
DEBUG_DVC("ChannelId=%d size=%d", ChannelId, data_size);
|
||||
@ -99,7 +101,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui
|
||||
{
|
||||
pos = stream_get_pos(data_out);
|
||||
stream_set_pos(data_out, 0);
|
||||
stream_write_uint8(data_out, 0x40 | cbChId);
|
||||
stream_write_BYTE(data_out, 0x40 | cbChId);
|
||||
stream_set_pos(data_out, pos);
|
||||
error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out);
|
||||
}
|
||||
@ -107,7 +109,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui
|
||||
{
|
||||
pos = stream_get_pos(data_out);
|
||||
stream_set_pos(data_out, 0);
|
||||
stream_write_uint8(data_out, 0x30 | cbChId);
|
||||
stream_write_BYTE(data_out, 0x30 | cbChId);
|
||||
stream_set_pos(data_out, pos);
|
||||
stream_write(data_out, data, data_size);
|
||||
error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out);
|
||||
@ -118,7 +120,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui
|
||||
cbLen = drdynvc_write_variable_uint(data_out, data_size);
|
||||
pos = stream_get_pos(data_out);
|
||||
stream_set_pos(data_out, 0);
|
||||
stream_write_uint8(data_out, 0x20 | cbChId | (cbLen << 2));
|
||||
stream_write_BYTE(data_out, 0x20 | cbChId | (cbLen << 2));
|
||||
stream_set_pos(data_out, pos);
|
||||
chunk_len = CHANNEL_CHUNK_LENGTH - pos;
|
||||
stream_write(data_out, data, chunk_len);
|
||||
@ -134,7 +136,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui
|
||||
|
||||
pos = stream_get_pos(data_out);
|
||||
stream_set_pos(data_out, 0);
|
||||
stream_write_uint8(data_out, 0x30 | cbChId);
|
||||
stream_write_BYTE(data_out, 0x30 | cbChId);
|
||||
stream_set_pos(data_out, pos);
|
||||
|
||||
chunk_len = data_size;
|
||||
@ -175,17 +177,17 @@ static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, in
|
||||
|
||||
DEBUG_DVC("Sp=%d cbChId=%d", Sp, cbChId);
|
||||
stream_seek(s, 1); /* pad */
|
||||
stream_read_uint16(s, drdynvc->version);
|
||||
stream_read_UINT16(s, drdynvc->version);
|
||||
if (drdynvc->version == 2)
|
||||
{
|
||||
stream_read_uint16(s, drdynvc->PriorityCharge0);
|
||||
stream_read_uint16(s, drdynvc->PriorityCharge1);
|
||||
stream_read_uint16(s, drdynvc->PriorityCharge2);
|
||||
stream_read_uint16(s, drdynvc->PriorityCharge3);
|
||||
stream_read_UINT16(s, drdynvc->PriorityCharge0);
|
||||
stream_read_UINT16(s, drdynvc->PriorityCharge1);
|
||||
stream_read_UINT16(s, drdynvc->PriorityCharge2);
|
||||
stream_read_UINT16(s, drdynvc->PriorityCharge3);
|
||||
}
|
||||
data_out = stream_new(4);
|
||||
stream_write_uint16(data_out, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */
|
||||
stream_write_uint16(data_out, drdynvc->version);
|
||||
stream_write_UINT16(data_out, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */
|
||||
stream_write_UINT16(data_out, drdynvc->version);
|
||||
error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out);
|
||||
if (error != CHANNEL_RC_OK)
|
||||
{
|
||||
@ -197,20 +199,20 @@ static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, in
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32 drdynvc_read_variable_uint(STREAM* stream, int cbLen)
|
||||
static UINT32 drdynvc_read_variable_uint(STREAM* stream, int cbLen)
|
||||
{
|
||||
uint32 val;
|
||||
UINT32 val;
|
||||
|
||||
switch (cbLen)
|
||||
{
|
||||
case 0:
|
||||
stream_read_uint8(stream, val);
|
||||
stream_read_BYTE(stream, val);
|
||||
break;
|
||||
case 1:
|
||||
stream_read_uint16(stream, val);
|
||||
stream_read_UINT16(stream, val);
|
||||
break;
|
||||
default:
|
||||
stream_read_uint32(stream, val);
|
||||
stream_read_UINT32(stream, val);
|
||||
break;
|
||||
}
|
||||
return val;
|
||||
@ -221,7 +223,7 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb
|
||||
STREAM* data_out;
|
||||
int pos;
|
||||
int error;
|
||||
uint32 ChannelId;
|
||||
UINT32 ChannelId;
|
||||
|
||||
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
||||
pos = stream_get_pos(s);
|
||||
@ -230,19 +232,19 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb
|
||||
error = dvcman_create_channel(drdynvc->channel_mgr, ChannelId, (char*)stream_get_tail(s));
|
||||
|
||||
data_out = stream_new(pos + 4);
|
||||
stream_write_uint8(data_out, 0x10 | cbChId);
|
||||
stream_write_BYTE(data_out, 0x10 | cbChId);
|
||||
stream_set_pos(s, 1);
|
||||
stream_copy(data_out, s, pos - 1);
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
DEBUG_DVC("channel created");
|
||||
stream_write_uint32(data_out, 0);
|
||||
stream_write_UINT32(data_out, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_DVC("no listener");
|
||||
stream_write_uint32(data_out, (uint32)(-1));
|
||||
stream_write_UINT32(data_out, (UINT32)(-1));
|
||||
}
|
||||
|
||||
error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out);
|
||||
@ -256,8 +258,8 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb
|
||||
|
||||
static int drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s)
|
||||
{
|
||||
uint32 ChannelId;
|
||||
uint32 Length;
|
||||
UINT32 ChannelId;
|
||||
UINT32 Length;
|
||||
int error;
|
||||
|
||||
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
||||
@ -274,7 +276,7 @@ static int drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId
|
||||
|
||||
static int drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s)
|
||||
{
|
||||
uint32 ChannelId;
|
||||
UINT32 ChannelId;
|
||||
|
||||
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
||||
DEBUG_DVC("ChannelId=%d", ChannelId);
|
||||
@ -285,7 +287,7 @@ static int drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId, STRE
|
||||
|
||||
static int drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s)
|
||||
{
|
||||
uint32 ChannelId;
|
||||
UINT32 ChannelId;
|
||||
|
||||
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
||||
DEBUG_DVC("ChannelId=%d", ChannelId);
|
||||
@ -302,7 +304,7 @@ static void drdynvc_process_receive(rdpSvcPlugin* plugin, STREAM* s)
|
||||
int Sp;
|
||||
int cbChId;
|
||||
|
||||
stream_read_uint8(s, value);
|
||||
stream_read_BYTE(s, value);
|
||||
Cmd = (value & 0xf0) >> 4;
|
||||
Sp = (value & 0x0c) >> 2;
|
||||
cbChId = (value & 0x03) >> 0;
|
||||
@ -359,9 +361,34 @@ static void drdynvc_process_terminate(rdpSvcPlugin* plugin)
|
||||
|
||||
if (drdynvc->channel_mgr != NULL)
|
||||
dvcman_free(drdynvc->channel_mgr);
|
||||
xfree(drdynvc);
|
||||
|
||||
free(drdynvc);
|
||||
}
|
||||
|
||||
/* drdynvc is always built-in */
|
||||
#define VirtualChannelEntry drdynvc_VirtualChannelEntry
|
||||
|
||||
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||
{
|
||||
drdynvcPlugin* _p;
|
||||
|
||||
_p = (drdynvcPlugin*) malloc(sizeof(drdynvcPlugin));
|
||||
ZeroMemory(_p, sizeof(drdynvcPlugin));
|
||||
|
||||
_p->plugin.channel_def.options =
|
||||
CHANNEL_OPTION_INITIALIZED |
|
||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||
CHANNEL_OPTION_COMPRESS_RDP;
|
||||
|
||||
strcpy(_p->plugin.channel_def.name, "drdynvc");
|
||||
|
||||
_p->plugin.connect_callback = drdynvc_process_connect;
|
||||
_p->plugin.receive_callback = drdynvc_process_receive;
|
||||
_p->plugin.event_callback = drdynvc_process_event;
|
||||
_p->plugin.terminate_callback = drdynvc_process_terminate;
|
||||
|
||||
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DEFINE_SVC_PLUGIN(drdynvc, "drdynvc",
|
||||
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
|
||||
CHANNEL_OPTION_COMPRESS_RDP)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Dynamic Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
typedef struct drdynvc_plugin drdynvcPlugin;
|
||||
|
||||
int drdynvc_write_data(drdynvcPlugin* plugin, uint32 ChannelId, uint8* data, uint32 data_size);
|
||||
int drdynvc_write_data(drdynvcPlugin* plugin, UINT32 ChannelId, BYTE* data, UINT32 data_size);
|
||||
int drdynvc_push_event(drdynvcPlugin* plugin, RDP_EVENT* event);
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Dynamic Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Dynamic Virtual Channel Manager
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -25,6 +25,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/synch.h>
|
||||
|
||||
#include <freerdp/utils/memory.h>
|
||||
@ -61,7 +62,7 @@ struct _DVCMAN_LISTENER
|
||||
|
||||
DVCMAN* dvcman;
|
||||
char* channel_name;
|
||||
uint32 flags;
|
||||
UINT32 flags;
|
||||
IWTSListenerCallback* listener_callback;
|
||||
};
|
||||
|
||||
@ -81,7 +82,7 @@ struct _DVCMAN_CHANNEL
|
||||
|
||||
DVCMAN* dvcman;
|
||||
DVCMAN_CHANNEL* next;
|
||||
uint32 channel_id;
|
||||
UINT32 channel_id;
|
||||
IWTSVirtualChannelCallback* channel_callback;
|
||||
|
||||
STREAM* dvc_data;
|
||||
@ -96,7 +97,7 @@ static int dvcman_get_configuration(IWTSListener* pListener, void** ppPropertyBa
|
||||
}
|
||||
|
||||
static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr,
|
||||
const char* pszChannelName, uint32 ulFlags,
|
||||
const char* pszChannelName, UINT32 ulFlags,
|
||||
IWTSListenerCallback* pListenerCallback, IWTSListener** ppListener)
|
||||
{
|
||||
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
|
||||
@ -108,7 +109,7 @@ static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr,
|
||||
listener = xnew(DVCMAN_LISTENER);
|
||||
listener->iface.GetConfiguration = dvcman_get_configuration;
|
||||
listener->dvcman = dvcman;
|
||||
listener->channel_name = xstrdup(pszChannelName);
|
||||
listener->channel_name = _strdup(pszChannelName);
|
||||
listener->flags = ulFlags;
|
||||
listener->listener_callback = pListenerCallback;
|
||||
|
||||
@ -185,12 +186,12 @@ 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)
|
||||
UINT32 dvcman_get_channel_id(IWTSVirtualChannel * channel)
|
||||
{
|
||||
return ((DVCMAN_CHANNEL*)channel)->channel_id;
|
||||
}
|
||||
|
||||
IWTSVirtualChannel* dvcman_find_channel_by_id(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId)
|
||||
IWTSVirtualChannel* dvcman_find_channel_by_id(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId)
|
||||
{
|
||||
LIST_ITEM* curr;
|
||||
DVCMAN* dvcman = (DVCMAN*) pChannelMgr;
|
||||
@ -240,7 +241,7 @@ int dvcman_load_plugin(IWTSVirtualChannelManager* pChannelMgr, RDP_PLUGIN_DATA*
|
||||
pDVCPluginEntry((IDRDYNVC_ENTRY_POINTS*) &entryPoints);
|
||||
}
|
||||
|
||||
data = (RDP_PLUGIN_DATA*)(((uint8*) data) + data->size);
|
||||
data = (RDP_PLUGIN_DATA*)(((BYTE*) data) + data->size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -251,7 +252,7 @@ static void dvcman_channel_free(DVCMAN_CHANNEL* channel)
|
||||
if (channel->channel_callback)
|
||||
channel->channel_callback->OnClose(channel->channel_callback);
|
||||
|
||||
xfree(channel);
|
||||
free(channel);
|
||||
}
|
||||
|
||||
void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
|
||||
@ -270,8 +271,8 @@ void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
|
||||
for (i = 0; i < dvcman->num_listeners; i++)
|
||||
{
|
||||
listener = (DVCMAN_LISTENER*) dvcman->listeners[i];
|
||||
xfree(listener->channel_name);
|
||||
xfree(listener);
|
||||
free(listener->channel_name);
|
||||
free(listener);
|
||||
}
|
||||
|
||||
for (i = 0; i < dvcman->num_plugins; i++)
|
||||
@ -282,7 +283,7 @@ void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
|
||||
pPlugin->Terminated(pPlugin);
|
||||
}
|
||||
|
||||
xfree(dvcman);
|
||||
free(dvcman);
|
||||
}
|
||||
|
||||
int dvcman_init(IWTSVirtualChannelManager* pChannelMgr)
|
||||
@ -302,7 +303,7 @@ int dvcman_init(IWTSVirtualChannelManager* pChannelMgr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dvcman_write_channel(IWTSVirtualChannel* pChannel, uint32 cbSize, uint8* pBuffer, void* pReserved)
|
||||
static int dvcman_write_channel(IWTSVirtualChannel* pChannel, UINT32 cbSize, BYTE* pBuffer, void* pReserved)
|
||||
{
|
||||
int status;
|
||||
DVCMAN_CHANNEL* channel = (DVCMAN_CHANNEL*) pChannel;
|
||||
@ -329,7 +330,7 @@ static int dvcman_close_channel_iface(IWTSVirtualChannel* pChannel)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, const char* ChannelName)
|
||||
int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, const char* ChannelName)
|
||||
{
|
||||
int i;
|
||||
int bAccept;
|
||||
@ -377,7 +378,7 @@ int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 Channel
|
||||
}
|
||||
|
||||
|
||||
int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId)
|
||||
int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId)
|
||||
{
|
||||
DVCMAN_CHANNEL* channel;
|
||||
IWTSVirtualChannel* ichannel;
|
||||
@ -403,7 +404,7 @@ int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelI
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint32 length)
|
||||
int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, UINT32 length)
|
||||
{
|
||||
DVCMAN_CHANNEL* channel;
|
||||
|
||||
@ -423,7 +424,7 @@ int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, ui
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint8* data, uint32 data_size)
|
||||
int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, BYTE* data, UINT32 data_size)
|
||||
{
|
||||
int error = 0;
|
||||
DVCMAN_CHANNEL* channel;
|
||||
@ -439,7 +440,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, uint32 C
|
||||
if (channel->dvc_data)
|
||||
{
|
||||
/* Fragmented data */
|
||||
if (stream_get_length(channel->dvc_data) + data_size > (uint32) stream_get_size(channel->dvc_data))
|
||||
if (stream_get_length(channel->dvc_data) + data_size > (UINT32) stream_get_size(channel->dvc_data))
|
||||
{
|
||||
DEBUG_WARN("data exceeding declared length!");
|
||||
stream_free(channel->dvc_data);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Dynamic Virtual Channel Manager
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -27,10 +27,10 @@ IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin);
|
||||
int dvcman_load_plugin(IWTSVirtualChannelManager* pChannelMgr, RDP_PLUGIN_DATA* data);
|
||||
void dvcman_free(IWTSVirtualChannelManager* pChannelMgr);
|
||||
int dvcman_init(IWTSVirtualChannelManager* pChannelMgr);
|
||||
int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, const char* ChannelName);
|
||||
int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId);
|
||||
int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint32 length);
|
||||
int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint8* data, uint32 data_size);
|
||||
int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, const char* ChannelName);
|
||||
int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId);
|
||||
int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, UINT32 length);
|
||||
int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, BYTE* data, UINT32 data_size);
|
||||
|
||||
#endif
|
||||
|
||||
|
21
channels/parallel/CMakeLists.txt
Normal file
21
channels/parallel/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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()
|
||||
|
14
channels/parallel/ChannelOptions.cmake
Normal file
14
channels/parallel/ChannelOptions.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
set(CHANNEL_TYPE "device")
|
||||
set(CHANNEL_SHORT_NAME "parallel")
|
||||
set(CHANNEL_LONG_NAME "Parallel Port Virtual Channel Extension")
|
||||
set(CHANNEL_SPECIFICATIONS "[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()
|
||||
|
36
channels/parallel/client/CMakeLists.txt
Normal file
36
channels/parallel/client/CMakeLists.txt
Normal file
@ -0,0 +1,36 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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 "parallel")
|
||||
set(MODULE_PREFIX "CHANNEL_RDPDR_PARALLEL_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
parallel_main.c)
|
||||
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp)
|
||||
else()
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils winpr-interlocked)
|
||||
endif()
|
||||
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Redirected Parallel Port Device Service
|
||||
*
|
||||
* Copyright 2010 O.S. Systems Software Ltda.
|
||||
@ -57,9 +57,7 @@
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#include "rdpdr_constants.h"
|
||||
#include "rdpdr_types.h"
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
struct _PARALLEL_DEVICE
|
||||
{
|
||||
@ -67,7 +65,7 @@ struct _PARALLEL_DEVICE
|
||||
|
||||
int file;
|
||||
char* path;
|
||||
uint32 id;
|
||||
UINT32 id;
|
||||
|
||||
PSLIST_HEADER pIrpList;
|
||||
freerdp_thread* thread;
|
||||
@ -77,12 +75,12 @@ typedef struct _PARALLEL_DEVICE PARALLEL_DEVICE;
|
||||
static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
{
|
||||
char* path;
|
||||
uint32 PathLength;
|
||||
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);
|
||||
stream_read_UINT32(irp->input, PathLength);
|
||||
|
||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
|
||||
|
||||
@ -105,10 +103,10 @@ static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
DEBUG_SVC("%s(%d) created", parallel->path, parallel->file);
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, parallel->id);
|
||||
stream_write_uint8(irp->output, 0);
|
||||
stream_write_UINT32(irp->output, parallel->id);
|
||||
stream_write_BYTE(irp->output, 0);
|
||||
|
||||
xfree(path);
|
||||
free(path);
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -127,22 +125,22 @@ static void parallel_process_irp_close(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
|
||||
static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
{
|
||||
uint32 Length;
|
||||
uint64 Offset;
|
||||
UINT32 Length;
|
||||
UINT64 Offset;
|
||||
ssize_t status;
|
||||
uint8* buffer = NULL;
|
||||
BYTE* buffer = NULL;
|
||||
|
||||
stream_read_uint32(irp->input, Length);
|
||||
stream_read_uint64(irp->input, Offset);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
|
||||
buffer = (uint8*) xmalloc(Length);
|
||||
buffer = (BYTE*) malloc(Length);
|
||||
|
||||
status = read(parallel->file, irp->output->p, Length);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
irp->IoStatus = STATUS_UNSUCCESSFUL;
|
||||
xfree(buffer);
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
Length = 0;
|
||||
|
||||
@ -153,26 +151,26 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
DEBUG_SVC("read %llu-%llu from %d", Offset, Offset + Length, parallel->id);
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, Length);
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
if (Length > 0)
|
||||
{
|
||||
stream_check_size(irp->output, Length);
|
||||
stream_write(irp->output, buffer, Length);
|
||||
}
|
||||
xfree(buffer);
|
||||
free(buffer);
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
|
||||
static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
{
|
||||
uint32 Length;
|
||||
uint64 Offset;
|
||||
UINT32 Length;
|
||||
UINT64 Offset;
|
||||
ssize_t status;
|
||||
uint32 len;
|
||||
UINT32 len;
|
||||
|
||||
stream_read_uint32(irp->input, Length);
|
||||
stream_read_uint64(irp->input, Offset);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
stream_seek(irp->input, 20); /* Padding */
|
||||
|
||||
DEBUG_SVC("Length %u Offset %llu", Length, Offset);
|
||||
@ -196,8 +194,8 @@ static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
len -= status;
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, Length);
|
||||
stream_write_uint8(irp->output, 0); /* Padding */
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
stream_write_BYTE(irp->output, 0); /* Padding */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -205,7 +203,7 @@ static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
static void parallel_process_irp_device_control(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
{
|
||||
DEBUG_SVC("in");
|
||||
stream_write_uint32(irp->output, 0); /* OutputBufferLength */
|
||||
stream_write_UINT32(irp->output, 0); /* OutputBufferLength */
|
||||
irp->Complete(irp);
|
||||
}
|
||||
|
||||
@ -306,7 +304,7 @@ static void parallel_free(DEVICE* device)
|
||||
|
||||
_aligned_free(parallel->pIrpList);
|
||||
|
||||
xfree(parallel);
|
||||
free(parallel);
|
||||
}
|
||||
|
||||
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
@ -332,7 +330,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
parallel->device.data = stream_new(length + 1);
|
||||
|
||||
for (i = 0; i <= length; i++)
|
||||
stream_write_uint8(parallel->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
stream_write_BYTE(parallel->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
|
||||
parallel->path = path;
|
||||
|
21
channels/printer/CMakeLists.txt
Normal file
21
channels/printer/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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()
|
||||
|
16
channels/printer/ChannelOptions.cmake
Normal file
16
channels/printer/ChannelOptions.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
set(CHANNEL_TYPE "device")
|
||||
set(CHANNEL_SHORT_NAME "printer")
|
||||
set(CHANNEL_LONG_NAME "Print Virtual Channel Extension")
|
||||
set(CHANNEL_SPECIFICATIONS "[MS-RDPEPC]")
|
||||
|
||||
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
|
||||
|
||||
if(WIN32)
|
||||
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
|
||||
elseif(WITH_CUPS)
|
||||
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
|
||||
else()
|
||||
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)
|
||||
endif()
|
||||
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(PRINTER_SRCS
|
||||
set(MODULE_NAME "printer")
|
||||
set(MODULE_PREFIX "CHANNEL_RDPDR_PRINTER_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
printer_main.c
|
||||
printer_main.h)
|
||||
|
||||
if(WITH_CUPS)
|
||||
set(PRINTER_SRCS
|
||||
${PRINTER_SRCS}
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}
|
||||
printer_cups.c
|
||||
printer_cups.h)
|
||||
|
||||
@ -32,25 +32,25 @@ if(WITH_CUPS)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(PRINTER_SRCS
|
||||
${PRINTER_SRCS}
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}
|
||||
printer_win.c
|
||||
printer_win.h)
|
||||
endif()
|
||||
|
||||
include_directories(..)
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
add_library(printer ${PRINTER_SRCS})
|
||||
set_target_properties(printer PROPERTIES PREFIX "")
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(printer freerdp winpr)
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp winpr)
|
||||
else()
|
||||
target_link_libraries(printer freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
endif()
|
||||
|
||||
if(WITH_CUPS)
|
||||
target_link_libraries(printer ${CUPS_LIBRARIES})
|
||||
target_link_libraries(${MODULE_NAME} ${CUPS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
install(TARGETS printer DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Print Virtual Channel - CUPS driver
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -29,11 +29,12 @@
|
||||
#include <time.h>
|
||||
#include <cups/cups.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
#include "rdpdr_constants.h"
|
||||
#include "rdpdr_types.h"
|
||||
#include "printer_main.h"
|
||||
|
||||
#include "printer_cups.h"
|
||||
@ -76,7 +77,7 @@ static void printer_cups_get_printjob_name(char* buf, int size)
|
||||
t->tm_hour, t->tm_min, t->tm_sec);
|
||||
}
|
||||
|
||||
static void printer_cups_write_printjob(rdpPrintJob* printjob, uint8* data, int size)
|
||||
static void printer_cups_write_printjob(rdpPrintJob* printjob, BYTE* data, int size)
|
||||
{
|
||||
rdpCupsPrintJob* cups_printjob = (rdpCupsPrintJob*)printjob;
|
||||
|
||||
@ -120,7 +121,7 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob)
|
||||
DEBUG_WARN("cupsPrintFile: %s", cupsLastErrorString());
|
||||
}
|
||||
unlink(cups_printjob->printjob_object);
|
||||
xfree(cups_printjob->printjob_object);
|
||||
free(cups_printjob->printjob_object);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -132,10 +133,10 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob)
|
||||
#endif
|
||||
|
||||
((rdpCupsPrinter*)printjob->printer)->printjob = NULL;
|
||||
xfree(cups_printjob) ;
|
||||
free(cups_printjob) ;
|
||||
}
|
||||
|
||||
static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id)
|
||||
static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, UINT32 id)
|
||||
{
|
||||
rdpCupsPrinter* cups_printer = (rdpCupsPrinter*)printer;
|
||||
rdpCupsPrintJob* cups_printjob;
|
||||
@ -153,7 +154,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id)
|
||||
|
||||
#ifndef _CUPS_API_1_4
|
||||
|
||||
cups_printjob->printjob_object = xstrdup(tmpnam(NULL));
|
||||
cups_printjob->printjob_object = _strdup(tmpnam(NULL));
|
||||
|
||||
#else
|
||||
{
|
||||
@ -163,7 +164,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id)
|
||||
if (cups_printjob->printjob_object == NULL)
|
||||
{
|
||||
DEBUG_WARN("httpConnectEncrypt: %s", cupsLastErrorString());
|
||||
xfree(cups_printjob);
|
||||
free(cups_printjob);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -175,7 +176,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id)
|
||||
{
|
||||
DEBUG_WARN("cupsCreateJob: %s", cupsLastErrorString());
|
||||
httpClose((http_t*)cups_printjob->printjob_object);
|
||||
xfree(cups_printjob);
|
||||
free(cups_printjob);
|
||||
return NULL;
|
||||
}
|
||||
cupsStartDocument((http_t*)cups_printjob->printjob_object,
|
||||
@ -190,7 +191,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id)
|
||||
return (rdpPrintJob*)cups_printjob;
|
||||
}
|
||||
|
||||
static rdpPrintJob* printer_cups_find_printjob(rdpPrinter* printer, uint32 id)
|
||||
static rdpPrintJob* printer_cups_find_printjob(rdpPrinter* printer, UINT32 id)
|
||||
{
|
||||
rdpCupsPrinter* cups_printer = (rdpCupsPrinter*)printer;
|
||||
|
||||
@ -208,18 +209,18 @@ static void printer_cups_free_printer(rdpPrinter* printer)
|
||||
|
||||
if (cups_printer->printjob)
|
||||
cups_printer->printjob->printjob.Close((rdpPrintJob*)cups_printer->printjob);
|
||||
xfree(printer->name);
|
||||
xfree(printer);
|
||||
free(printer->name);
|
||||
free(printer);
|
||||
}
|
||||
|
||||
static rdpPrinter* printer_cups_new_printer(rdpCupsPrinterDriver* cups_driver, const char* name, boolean is_default)
|
||||
static rdpPrinter* printer_cups_new_printer(rdpCupsPrinterDriver* cups_driver, const char* name, BOOL is_default)
|
||||
{
|
||||
rdpCupsPrinter* cups_printer;
|
||||
|
||||
cups_printer = xnew(rdpCupsPrinter);
|
||||
|
||||
cups_printer->printer.id = cups_driver->id_sequence++;
|
||||
cups_printer->printer.name = xstrdup(name);
|
||||
cups_printer->printer.name = _strdup(name);
|
||||
/* This is a generic PostScript printer driver developed by MS, so it should be good in most cases */
|
||||
cups_printer->printer.driver = "MS Publisher Imagesetter";
|
||||
cups_printer->printer.is_default = is_default;
|
||||
@ -260,7 +261,7 @@ static rdpPrinter* printer_cups_get_printer(rdpPrinterDriver* driver, const char
|
||||
{
|
||||
rdpCupsPrinterDriver* cups_driver = (rdpCupsPrinterDriver*)driver;
|
||||
|
||||
return printer_cups_new_printer(cups_driver, name, cups_driver->id_sequence == 1 ? true : false);
|
||||
return printer_cups_new_printer(cups_driver, name, cups_driver->id_sequence == 1 ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
static rdpCupsPrinterDriver* cups_driver = NULL;
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Print Virtual Channel - CUPS driver
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Print Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -35,9 +35,7 @@
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/thread.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#include "rdpdr_constants.h"
|
||||
#include "rdpdr_types.h"
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
#ifdef WITH_CUPS
|
||||
#include "printer_cups.h"
|
||||
@ -69,13 +67,13 @@ static void printer_process_irp_create(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
|
||||
if (printjob != NULL)
|
||||
{
|
||||
stream_write_uint32(irp->output, printjob->id); /* FileId */
|
||||
stream_write_UINT32(irp->output, printjob->id); /* FileId */
|
||||
|
||||
DEBUG_SVC("printjob id: %d", printjob->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_write_uint32(irp->output, 0); /* FileId */
|
||||
stream_write_UINT32(irp->output, 0); /* FileId */
|
||||
irp->IoStatus = STATUS_PRINT_QUEUE_FULL;
|
||||
|
||||
DEBUG_WARN("error creating print job.");
|
||||
@ -111,12 +109,12 @@ static void printer_process_irp_close(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
|
||||
static void printer_process_irp_write(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
{
|
||||
uint32 Length;
|
||||
uint64 Offset;
|
||||
UINT32 Length;
|
||||
UINT64 Offset;
|
||||
rdpPrintJob* printjob = NULL;
|
||||
|
||||
stream_read_uint32(irp->input, Length);
|
||||
stream_read_uint64(irp->input, Offset);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
stream_seek(irp->input, 20); /* Padding */
|
||||
|
||||
if (printer_dev->printer != NULL)
|
||||
@ -136,8 +134,8 @@ static void printer_process_irp_write(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
DEBUG_SVC("printjob id %d written %d bytes.", irp->FileId, Length);
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, Length);
|
||||
stream_write_uint8(irp->output, 0); /* Padding */
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
stream_write_BYTE(irp->output, 0); /* Padding */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -229,24 +227,24 @@ static void printer_free(DEVICE* device)
|
||||
if (printer_dev->printer)
|
||||
printer_dev->printer->Free(printer_dev->printer);
|
||||
|
||||
xfree(printer_dev->device.name);
|
||||
free(printer_dev->device.name);
|
||||
|
||||
xfree(printer_dev);
|
||||
free(printer_dev);
|
||||
}
|
||||
|
||||
void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* printer)
|
||||
{
|
||||
char* port;
|
||||
uint32 Flags;
|
||||
UINT32 Flags;
|
||||
int DriverNameLen;
|
||||
WCHAR* DriverName;
|
||||
int PrintNameLen;
|
||||
WCHAR* PrintName;
|
||||
uint32 CachedFieldsLen;
|
||||
uint8* CachedPrinterConfigData;
|
||||
UINT32 CachedFieldsLen;
|
||||
BYTE* CachedPrinterConfigData;
|
||||
PRINTER_DEVICE* printer_dev;
|
||||
|
||||
port = xmalloc(10);
|
||||
port = malloc(10);
|
||||
snprintf(port, 10, "PRN%d", printer->id);
|
||||
|
||||
printer_dev = xnew(PRINTER_DEVICE);
|
||||
@ -273,24 +271,24 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
|
||||
|
||||
printer_dev->device.data = stream_new(28 + DriverNameLen + PrintNameLen + CachedFieldsLen);
|
||||
|
||||
stream_write_uint32(printer_dev->device.data, Flags);
|
||||
stream_write_uint32(printer_dev->device.data, 0); /* CodePage, reserved */
|
||||
stream_write_uint32(printer_dev->device.data, 0); /* PnPNameLen */
|
||||
stream_write_uint32(printer_dev->device.data, DriverNameLen + 2);
|
||||
stream_write_uint32(printer_dev->device.data, PrintNameLen + 2);
|
||||
stream_write_uint32(printer_dev->device.data, CachedFieldsLen);
|
||||
stream_write_UINT32(printer_dev->device.data, Flags);
|
||||
stream_write_UINT32(printer_dev->device.data, 0); /* CodePage, reserved */
|
||||
stream_write_UINT32(printer_dev->device.data, 0); /* PnPNameLen */
|
||||
stream_write_UINT32(printer_dev->device.data, DriverNameLen + 2);
|
||||
stream_write_UINT32(printer_dev->device.data, PrintNameLen + 2);
|
||||
stream_write_UINT32(printer_dev->device.data, CachedFieldsLen);
|
||||
stream_write(printer_dev->device.data, DriverName, DriverNameLen);
|
||||
stream_write_uint16(printer_dev->device.data, 0);
|
||||
stream_write_UINT16(printer_dev->device.data, 0);
|
||||
stream_write(printer_dev->device.data, PrintName, PrintNameLen);
|
||||
stream_write_uint16(printer_dev->device.data, 0);
|
||||
stream_write_UINT16(printer_dev->device.data, 0);
|
||||
|
||||
if (CachedFieldsLen > 0)
|
||||
{
|
||||
stream_write(printer_dev->device.data, CachedPrinterConfigData, CachedFieldsLen);
|
||||
}
|
||||
|
||||
xfree(DriverName);
|
||||
xfree(PrintName);
|
||||
free(DriverName);
|
||||
free(PrintName);
|
||||
|
||||
printer_dev->pIrpList = (PSLIST_HEADER) _aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT);
|
||||
InitializeSListHead(printer_dev->pIrpList);
|
||||
@ -302,7 +300,7 @@ 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
|
||||
#ifdef STATIC_CHANNELS
|
||||
int printer_entry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
#else
|
||||
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
@ -356,7 +354,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
printer_register(pEntryPoints, printer);
|
||||
}
|
||||
|
||||
xfree(printers);
|
||||
free(printers);
|
||||
}
|
||||
|
||||
return 0;
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Print Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -20,7 +20,7 @@
|
||||
#ifndef __PRINTER_MAIN_H
|
||||
#define __PRINTER_MAIN_H
|
||||
|
||||
#include "rdpdr_types.h"
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
/* SERVER_PRINTER_CACHE_EVENT.cachedata */
|
||||
#define RDPDR_ADD_PRINTER_EVENT 0x00000001
|
||||
@ -48,8 +48,8 @@ struct rdp_printer_driver
|
||||
pcGetPrinter GetPrinter;
|
||||
};
|
||||
|
||||
typedef rdpPrintJob* (*pcCreatePrintJob) (rdpPrinter* printer, uint32 id);
|
||||
typedef rdpPrintJob* (*pcFindPrintJob) (rdpPrinter* printer, uint32 id);
|
||||
typedef rdpPrintJob* (*pcCreatePrintJob) (rdpPrinter* printer, UINT32 id);
|
||||
typedef rdpPrintJob* (*pcFindPrintJob) (rdpPrinter* printer, UINT32 id);
|
||||
typedef void (*pcFreePrinter) (rdpPrinter* printer);
|
||||
|
||||
struct rdp_printer
|
||||
@ -57,19 +57,19 @@ struct rdp_printer
|
||||
int id;
|
||||
char* name;
|
||||
char* driver;
|
||||
boolean is_default;
|
||||
BOOL is_default;
|
||||
|
||||
pcCreatePrintJob CreatePrintJob;
|
||||
pcFindPrintJob FindPrintJob;
|
||||
pcFreePrinter Free;
|
||||
};
|
||||
|
||||
typedef void (*pcWritePrintJob) (rdpPrintJob* printjob, uint8* data, int size);
|
||||
typedef void (*pcWritePrintJob) (rdpPrintJob* printjob, BYTE* data, int size);
|
||||
typedef void (*pcClosePrintJob) (rdpPrintJob* printjob);
|
||||
|
||||
struct rdp_print_job
|
||||
{
|
||||
uint32 id;
|
||||
UINT32 id;
|
||||
rdpPrinter* printer;
|
||||
|
||||
pcWritePrintJob Write;
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Print Virtual Channel - WIN driver
|
||||
*
|
||||
* Copyright 2012 Gerald Richter
|
||||
@ -17,18 +17,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winspool.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/windows.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <winspool.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"
|
||||
@ -78,7 +82,7 @@ static void printer_win_get_printjob_name(char* buf, int size)
|
||||
|
||||
}
|
||||
|
||||
static void printer_win_write_printjob(rdpPrintJob* printjob, uint8* data, int size)
|
||||
static void printer_win_write_printjob(rdpPrintJob* printjob, BYTE* data, int size)
|
||||
{
|
||||
rdpWinPrintJob* win_printjob = (rdpWinPrintJob*)printjob;
|
||||
|
||||
@ -104,10 +108,10 @@ static void printer_win_close_printjob(rdpPrintJob* printjob)
|
||||
DEBUG_WINPR("ClosePrinter failed");;
|
||||
|
||||
((rdpWinPrinter*)printjob->printer)->printjob = NULL;
|
||||
xfree(win_printjob) ;
|
||||
free(win_printjob) ;
|
||||
}
|
||||
|
||||
static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, uint32 id)
|
||||
static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, UINT32 id)
|
||||
{
|
||||
rdpWinPrinter* win_printer = (rdpWinPrinter*)printer;
|
||||
rdpWinPrintJob* win_printjob;
|
||||
@ -141,7 +145,7 @@ static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, uint32 id)
|
||||
return (rdpPrintJob*)win_printjob;
|
||||
}
|
||||
|
||||
static rdpPrintJob* printer_win_find_printjob(rdpPrinter* printer, uint32 id)
|
||||
static rdpPrintJob* printer_win_find_printjob(rdpPrinter* printer, UINT32 id)
|
||||
{
|
||||
rdpWinPrinter* win_printer = (rdpWinPrinter*)printer;
|
||||
|
||||
@ -163,11 +167,11 @@ static void printer_win_free_printer(rdpPrinter* printer)
|
||||
|
||||
if (win_printer->printjob)
|
||||
win_printer->printjob->printjob.Close((rdpPrintJob*)win_printer->printjob);
|
||||
xfree(printer->name);
|
||||
xfree(printer);
|
||||
free(printer->name);
|
||||
free(printer);
|
||||
}
|
||||
|
||||
static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, const char* name, const wchar_t* drivername, boolean is_default)
|
||||
static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, const char* name, const wchar_t* drivername, BOOL is_default)
|
||||
{
|
||||
rdpWinPrinter* win_printer;
|
||||
wchar_t wname[256];
|
||||
@ -179,7 +183,7 @@ static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, cons
|
||||
win_printer = xnew(rdpWinPrinter);
|
||||
|
||||
win_printer->printer.id = win_driver->id_sequence++;
|
||||
win_printer->printer.name = xstrdup(name);
|
||||
win_printer->printer.name = _strdup(name);
|
||||
win_printer->printer.is_default = is_default;
|
||||
|
||||
win_printer->printer.CreatePrintJob = printer_win_create_printjob;
|
||||
@ -194,7 +198,7 @@ static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, cons
|
||||
prninfo = (PRINTER_INFO_2*) GlobalAlloc(GPTR,needed);
|
||||
GetPrinter(win_printer->hPrinter, 2, (LPBYTE) prninfo, needed, &needed);
|
||||
|
||||
win_printer->printer.driver = xmalloc(1000);
|
||||
win_printer->printer.driver = malloc(1000);
|
||||
wcstombs_s(&charsConverted, win_printer->printer.driver, 1000, prninfo->pDriverName, _TRUNCATE);
|
||||
|
||||
return (rdpPrinter*)win_printer;
|
||||
@ -251,7 +255,7 @@ static rdpPrinter* printer_win_get_printer(rdpPrinterDriver* driver, const char*
|
||||
|
||||
DEBUG_WINPR("printer %s", name);
|
||||
|
||||
myPrinter = printer_win_new_printer(win_driver, name, L"", win_driver->id_sequence == 1 ? true : false);
|
||||
myPrinter = printer_win_new_printer(win_driver, name, L"", win_driver->id_sequence == 1 ? TRUE : FALSE);
|
||||
|
||||
return myPrinter;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Print Virtual Channel - win driver
|
||||
*
|
||||
* Copyright 2012 Gerald Richter
|
||||
@ -20,7 +20,6 @@
|
||||
#ifndef __PRINTER_WIN_H
|
||||
#define __PRINTER_WIN_H
|
||||
|
||||
|
||||
rdpPrinterDriver* printer_win_get_driver(void);
|
||||
|
||||
#ifdef WITH_DEBUG_WINPR
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -17,5 +17,10 @@
|
||||
|
||||
if(WITH_CLIENT_CHANNELS)
|
||||
add_subdirectory(client)
|
||||
if(${MODULE_PREFIX}_CLIENT_STATIC)
|
||||
set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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");
|
||||
@ -17,20 +15,32 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(RAIL_SRCS
|
||||
set(MODULE_NAME "rail")
|
||||
set(MODULE_PREFIX "CHANNEL_RAIL_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
rail_main.c
|
||||
rail_main.h
|
||||
rail_orders.c
|
||||
rail_orders.h)
|
||||
|
||||
add_library(rail ${RAIL_SRCS})
|
||||
set_target_properties(rail PROPERTIES PREFIX "")
|
||||
# rail is always built-in
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(rail freerdp)
|
||||
set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE)
|
||||
|
||||
add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp)
|
||||
else()
|
||||
target_link_libraries(rail freerdp-utils)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils)
|
||||
endif()
|
||||
|
||||
install(TARGETS rail DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* RAIL Virtual Channel Plugin
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -27,8 +27,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <freerdp/constants.h>
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/utils/rail.h>
|
||||
@ -56,7 +58,7 @@ static void on_free_rail_channel_event(RDP_EVENT* event)
|
||||
}
|
||||
}
|
||||
|
||||
void rail_send_channel_event(void* rail_object, uint16 event_type, void* param)
|
||||
void rail_send_channel_event(void* rail_object, UINT16 event_type, void* param)
|
||||
{
|
||||
void * payload = NULL;
|
||||
RDP_EVENT* out_event = NULL;
|
||||
@ -250,7 +252,31 @@ static void rail_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
|
||||
freerdp_event_free(event);
|
||||
}
|
||||
|
||||
DEFINE_SVC_PLUGIN(rail, "rail",
|
||||
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
|
||||
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL)
|
||||
/* rail is always built-in */
|
||||
#define VirtualChannelEntry rail_VirtualChannelEntry
|
||||
|
||||
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||
{
|
||||
railPlugin* _p;
|
||||
|
||||
_p = (railPlugin*) malloc(sizeof(railPlugin));
|
||||
ZeroMemory(_p, sizeof(railPlugin));
|
||||
|
||||
_p->plugin.channel_def.options =
|
||||
CHANNEL_OPTION_INITIALIZED |
|
||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||
CHANNEL_OPTION_COMPRESS_RDP |
|
||||
CHANNEL_OPTION_SHOW_PROTOCOL;
|
||||
|
||||
strcpy(_p->plugin.channel_def.name, "rail");
|
||||
|
||||
_p->plugin.connect_callback = rail_process_connect;
|
||||
_p->plugin.receive_callback = rail_process_receive;
|
||||
_p->plugin.event_callback = rail_process_event;
|
||||
_p->plugin.terminate_callback = rail_process_terminate;
|
||||
|
||||
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* RAIL Virtual Channel Plugin
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -56,7 +56,7 @@ struct rail_plugin
|
||||
};
|
||||
typedef struct rail_plugin railPlugin;
|
||||
|
||||
void rail_send_channel_event(void* rail_object, uint16 event_type, void* param);
|
||||
void rail_send_channel_event(void* rail_object, UINT16 event_type, void* param);
|
||||
void rail_send_channel_data(void* rail_object, void* data, size_t length);
|
||||
|
||||
#ifdef WITH_DEBUG_RAIL
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Remote Applications Integrated Locally (RAIL) Orders
|
||||
*
|
||||
* Copyright 2009 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -22,8 +22,12 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/utils/rail.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include "rail_orders.h"
|
||||
@ -71,7 +75,7 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_
|
||||
int length = 0;
|
||||
|
||||
if (unicode_string->string != NULL)
|
||||
xfree(unicode_string->string);
|
||||
free(unicode_string->string);
|
||||
|
||||
unicode_string->string = NULL;
|
||||
unicode_string->length = 0;
|
||||
@ -81,20 +85,20 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_
|
||||
|
||||
length = freerdp_AsciiToUnicodeAlloc(string, &buffer, 0) * 2;
|
||||
|
||||
unicode_string->string = (uint8*) buffer;
|
||||
unicode_string->length = (uint16) length;
|
||||
unicode_string->string = (BYTE*) buffer;
|
||||
unicode_string->length = (UINT16) length;
|
||||
}
|
||||
|
||||
void rail_read_pdu_header(STREAM* s, uint16* orderType, uint16* orderLength)
|
||||
void rail_read_pdu_header(STREAM* s, UINT16* orderType, UINT16* orderLength)
|
||||
{
|
||||
stream_read_uint16(s, *orderType); /* orderType (2 bytes) */
|
||||
stream_read_uint16(s, *orderLength); /* orderLength (2 bytes) */
|
||||
stream_read_UINT16(s, *orderType); /* orderType (2 bytes) */
|
||||
stream_read_UINT16(s, *orderLength); /* orderLength (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_pdu_header(STREAM* s, uint16 orderType, uint16 orderLength)
|
||||
void rail_write_pdu_header(STREAM* s, UINT16 orderType, UINT16 orderLength)
|
||||
{
|
||||
stream_write_uint16(s, orderType); /* orderType (2 bytes) */
|
||||
stream_write_uint16(s, orderLength); /* orderLength (2 bytes) */
|
||||
stream_write_UINT16(s, orderType); /* orderType (2 bytes) */
|
||||
stream_write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
}
|
||||
|
||||
STREAM* rail_pdu_init(int length)
|
||||
@ -105,9 +109,9 @@ STREAM* rail_pdu_init(int length)
|
||||
return s;
|
||||
}
|
||||
|
||||
void rail_send_pdu(rdpRailOrder* rail_order, STREAM* s, uint16 orderType)
|
||||
void rail_send_pdu(rdpRailOrder* rail_order, STREAM* s, UINT16 orderType)
|
||||
{
|
||||
uint16 orderLength;
|
||||
UINT16 orderLength;
|
||||
|
||||
orderLength = stream_get_length(s);
|
||||
stream_set_pos(s, 0);
|
||||
@ -125,39 +129,39 @@ void rail_send_pdu(rdpRailOrder* rail_order, STREAM* s, uint16 orderType)
|
||||
void rail_write_high_contrast(STREAM* s, HIGH_CONTRAST* high_contrast)
|
||||
{
|
||||
high_contrast->colorSchemeLength = high_contrast->colorScheme.length + 2;
|
||||
stream_write_uint32(s, high_contrast->flags); /* flags (4 bytes) */
|
||||
stream_write_uint32(s, high_contrast->colorSchemeLength); /* colorSchemeLength (4 bytes) */
|
||||
stream_write_UINT32(s, high_contrast->flags); /* flags (4 bytes) */
|
||||
stream_write_UINT32(s, high_contrast->colorSchemeLength); /* colorSchemeLength (4 bytes) */
|
||||
rail_write_unicode_string(s, &high_contrast->colorScheme); /* colorScheme */
|
||||
}
|
||||
|
||||
void rail_read_handshake_order(STREAM* s, RAIL_HANDSHAKE_ORDER* handshake)
|
||||
{
|
||||
stream_read_uint32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||
stream_read_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_read_server_exec_result_order(STREAM* s, RAIL_EXEC_RESULT_ORDER* exec_result)
|
||||
{
|
||||
stream_read_uint16(s, exec_result->flags); /* flags (2 bytes) */
|
||||
stream_read_uint16(s, exec_result->execResult); /* execResult (2 bytes) */
|
||||
stream_read_uint32(s, exec_result->rawResult); /* rawResult (4 bytes) */
|
||||
stream_seek_uint16(s); /* padding (2 bytes) */
|
||||
stream_read_UINT16(s, exec_result->flags); /* flags (2 bytes) */
|
||||
stream_read_UINT16(s, exec_result->execResult); /* execResult (2 bytes) */
|
||||
stream_read_UINT32(s, exec_result->rawResult); /* rawResult (4 bytes) */
|
||||
stream_seek_UINT16(s); /* padding (2 bytes) */
|
||||
rail_read_unicode_string(s, &exec_result->exeOrFile); /* exeOrFile */
|
||||
}
|
||||
|
||||
void rail_read_server_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
|
||||
{
|
||||
uint8 body;
|
||||
stream_read_uint32(s, sysparam->param); /* systemParam (4 bytes) */
|
||||
stream_read_uint8(s, body); /* body (1 byte) */
|
||||
BYTE body;
|
||||
stream_read_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
|
||||
stream_read_BYTE(s, body); /* body (1 byte) */
|
||||
|
||||
switch (sysparam->param)
|
||||
{
|
||||
case SPI_SET_SCREEN_SAVE_ACTIVE:
|
||||
sysparam->setScreenSaveActive = (body != 0) ? true : false;
|
||||
sysparam->setScreenSaveActive = (body != 0) ? TRUE : FALSE;
|
||||
break;
|
||||
|
||||
case SPI_SET_SCREEN_SAVE_SECURE:
|
||||
sysparam->setScreenSaveSecure = (body != 0) ? true : false;
|
||||
sysparam->setScreenSaveSecure = (body != 0) ? TRUE : FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -167,33 +171,33 @@ void rail_read_server_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
|
||||
|
||||
void rail_read_server_minmaxinfo_order(STREAM* s, RAIL_MINMAXINFO_ORDER* minmaxinfo)
|
||||
{
|
||||
stream_read_uint32(s, minmaxinfo->windowId); /* windowId (4 bytes) */
|
||||
stream_read_uint16(s, minmaxinfo->maxWidth); /* maxWidth (2 bytes) */
|
||||
stream_read_uint16(s, minmaxinfo->maxHeight); /* maxHeight (2 bytes) */
|
||||
stream_read_uint16(s, minmaxinfo->maxPosX); /* maxPosX (2 bytes) */
|
||||
stream_read_uint16(s, minmaxinfo->maxPosY); /* maxPosY (2 bytes) */
|
||||
stream_read_uint16(s, minmaxinfo->minTrackWidth); /* minTrackWidth (2 bytes) */
|
||||
stream_read_uint16(s, minmaxinfo->minTrackHeight); /* minTrackHeight (2 bytes) */
|
||||
stream_read_uint16(s, minmaxinfo->maxTrackWidth); /* maxTrackWidth (2 bytes) */
|
||||
stream_read_uint16(s, minmaxinfo->maxTrackHeight); /* maxTrackHeight (2 bytes) */
|
||||
stream_read_UINT32(s, minmaxinfo->windowId); /* windowId (4 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxWidth); /* maxWidth (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxHeight); /* maxHeight (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxPosX); /* maxPosX (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxPosY); /* maxPosY (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->minTrackWidth); /* minTrackWidth (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->minTrackHeight); /* minTrackHeight (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxTrackWidth); /* maxTrackWidth (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxTrackHeight); /* maxTrackHeight (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_read_server_localmovesize_order(STREAM* s, RAIL_LOCALMOVESIZE_ORDER* localmovesize)
|
||||
{
|
||||
uint16 isMoveSizeStart;
|
||||
stream_read_uint32(s, localmovesize->windowId); /* windowId (4 bytes) */
|
||||
UINT16 isMoveSizeStart;
|
||||
stream_read_UINT32(s, localmovesize->windowId); /* windowId (4 bytes) */
|
||||
|
||||
stream_read_uint16(s, isMoveSizeStart); /* isMoveSizeStart (2 bytes) */
|
||||
localmovesize->isMoveSizeStart = (isMoveSizeStart != 0) ? true : false;
|
||||
stream_read_UINT16(s, isMoveSizeStart); /* isMoveSizeStart (2 bytes) */
|
||||
localmovesize->isMoveSizeStart = (isMoveSizeStart != 0) ? TRUE : FALSE;
|
||||
|
||||
stream_read_uint16(s, localmovesize->moveSizeType); /* moveSizeType (2 bytes) */
|
||||
stream_read_uint16(s, localmovesize->posX); /* posX (2 bytes) */
|
||||
stream_read_uint16(s, localmovesize->posY); /* posY (2 bytes) */
|
||||
stream_read_UINT16(s, localmovesize->moveSizeType); /* moveSizeType (2 bytes) */
|
||||
stream_read_UINT16(s, localmovesize->posX); /* posX (2 bytes) */
|
||||
stream_read_UINT16(s, localmovesize->posY); /* posY (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_read_server_get_appid_resp_order(STREAM* s, RAIL_GET_APPID_RESP_ORDER* get_appid_resp)
|
||||
{
|
||||
stream_read_uint32(s, get_appid_resp->windowId); /* windowId (4 bytes) */
|
||||
stream_read_UINT32(s, get_appid_resp->windowId); /* windowId (4 bytes) */
|
||||
stream_read(s, &get_appid_resp->applicationIdBuffer[0], 512); /* applicationId (256 UNICODE chars) */
|
||||
|
||||
get_appid_resp->applicationId.length = 512;
|
||||
@ -202,25 +206,25 @@ void rail_read_server_get_appid_resp_order(STREAM* s, RAIL_GET_APPID_RESP_ORDER*
|
||||
|
||||
void rail_read_langbar_info_order(STREAM* s, RAIL_LANGBAR_INFO_ORDER* langbar_info)
|
||||
{
|
||||
stream_read_uint32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
||||
stream_read_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_handshake_order(STREAM* s, RAIL_HANDSHAKE_ORDER* handshake)
|
||||
{
|
||||
stream_write_uint32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||
stream_write_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_status_order(STREAM* s, RAIL_CLIENT_STATUS_ORDER* client_status)
|
||||
{
|
||||
stream_write_uint32(s, client_status->flags); /* flags (4 bytes) */
|
||||
stream_write_UINT32(s, client_status->flags); /* flags (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_exec_order(STREAM* s, RAIL_EXEC_ORDER* exec)
|
||||
{
|
||||
stream_write_uint16(s, exec->flags); /* flags (2 bytes) */
|
||||
stream_write_uint16(s, exec->exeOrFile.length); /* exeOrFileLength (2 bytes) */
|
||||
stream_write_uint16(s, exec->workingDir.length); /* workingDirLength (2 bytes) */
|
||||
stream_write_uint16(s, exec->arguments.length); /* argumentsLength (2 bytes) */
|
||||
stream_write_UINT16(s, exec->flags); /* flags (2 bytes) */
|
||||
stream_write_UINT16(s, exec->exeOrFile.length); /* exeOrFileLength (2 bytes) */
|
||||
stream_write_UINT16(s, exec->workingDir.length); /* workingDirLength (2 bytes) */
|
||||
stream_write_UINT16(s, exec->arguments.length); /* argumentsLength (2 bytes) */
|
||||
rail_write_unicode_string_value(s, &exec->exeOrFile); /* exeOrFile */
|
||||
rail_write_unicode_string_value(s, &exec->workingDir); /* workingDir */
|
||||
rail_write_unicode_string_value(s, &exec->arguments); /* arguments */
|
||||
@ -228,50 +232,50 @@ void rail_write_client_exec_order(STREAM* s, RAIL_EXEC_ORDER* exec)
|
||||
|
||||
void rail_write_client_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
|
||||
{
|
||||
uint8 body;
|
||||
stream_write_uint32(s, sysparam->param); /* systemParam (4 bytes) */
|
||||
BYTE body;
|
||||
stream_write_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
|
||||
|
||||
switch (sysparam->param)
|
||||
{
|
||||
case SPI_SET_DRAG_FULL_WINDOWS:
|
||||
body = sysparam->dragFullWindows;
|
||||
stream_write_uint8(s, body);
|
||||
stream_write_BYTE(s, body);
|
||||
break;
|
||||
|
||||
case SPI_SET_KEYBOARD_CUES:
|
||||
body = sysparam->keyboardCues;
|
||||
stream_write_uint8(s, body);
|
||||
stream_write_BYTE(s, body);
|
||||
break;
|
||||
|
||||
case SPI_SET_KEYBOARD_PREF:
|
||||
body = sysparam->keyboardPref;
|
||||
stream_write_uint8(s, body);
|
||||
stream_write_BYTE(s, body);
|
||||
break;
|
||||
|
||||
case SPI_SET_MOUSE_BUTTON_SWAP:
|
||||
body = sysparam->mouseButtonSwap;
|
||||
stream_write_uint8(s, body);
|
||||
stream_write_BYTE(s, body);
|
||||
break;
|
||||
|
||||
case SPI_SET_WORK_AREA:
|
||||
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) */
|
||||
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:
|
||||
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) */
|
||||
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:
|
||||
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) */
|
||||
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:
|
||||
@ -282,51 +286,51 @@ void rail_write_client_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
|
||||
|
||||
void rail_write_client_activate_order(STREAM* s, RAIL_ACTIVATE_ORDER* activate)
|
||||
{
|
||||
uint8 enabled;
|
||||
BYTE enabled;
|
||||
|
||||
stream_write_uint32(s, activate->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT32(s, activate->windowId); /* windowId (4 bytes) */
|
||||
|
||||
enabled = activate->enabled;
|
||||
stream_write_uint8(s, enabled); /* enabled (1 byte) */
|
||||
stream_write_BYTE(s, enabled); /* enabled (1 byte) */
|
||||
}
|
||||
|
||||
void rail_write_client_sysmenu_order(STREAM* s, RAIL_SYSMENU_ORDER* sysmenu)
|
||||
{
|
||||
stream_write_uint32(s, sysmenu->windowId); /* windowId (4 bytes) */
|
||||
stream_write_uint16(s, sysmenu->left); /* left (2 bytes) */
|
||||
stream_write_uint16(s, sysmenu->top); /* top (2 bytes) */
|
||||
stream_write_UINT32(s, sysmenu->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT16(s, sysmenu->left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, sysmenu->top); /* top (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_syscommand_order(STREAM* s, RAIL_SYSCOMMAND_ORDER* syscommand)
|
||||
{
|
||||
stream_write_uint32(s, syscommand->windowId); /* windowId (4 bytes) */
|
||||
stream_write_uint16(s, syscommand->command); /* command (2 bytes) */
|
||||
stream_write_UINT32(s, syscommand->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT16(s, syscommand->command); /* command (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_notify_event_order(STREAM* s, RAIL_NOTIFY_EVENT_ORDER* notify_event)
|
||||
{
|
||||
stream_write_uint32(s, notify_event->windowId); /* windowId (4 bytes) */
|
||||
stream_write_uint32(s, notify_event->notifyIconId); /* notifyIconId (4 bytes) */
|
||||
stream_write_uint32(s, notify_event->message); /* notifyIconId (4 bytes) */
|
||||
stream_write_UINT32(s, notify_event->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT32(s, notify_event->notifyIconId); /* notifyIconId (4 bytes) */
|
||||
stream_write_UINT32(s, notify_event->message); /* notifyIconId (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_window_move_order(STREAM* s, RAIL_WINDOW_MOVE_ORDER* window_move)
|
||||
{
|
||||
stream_write_uint32(s, window_move->windowId); /* windowId (4 bytes) */
|
||||
stream_write_uint16(s, window_move->left); /* left (2 bytes) */
|
||||
stream_write_uint16(s, window_move->top); /* top (2 bytes) */
|
||||
stream_write_uint16(s, window_move->right); /* right (2 bytes) */
|
||||
stream_write_uint16(s, window_move->bottom); /* bottom (2 bytes) */
|
||||
stream_write_UINT32(s, window_move->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT16(s, window_move->left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, window_move->top); /* top (2 bytes) */
|
||||
stream_write_UINT16(s, window_move->right); /* right (2 bytes) */
|
||||
stream_write_UINT16(s, window_move->bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_get_appid_req_order(STREAM* s, RAIL_GET_APPID_REQ_ORDER* get_appid_req)
|
||||
{
|
||||
stream_write_uint32(s, get_appid_req->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT32(s, get_appid_req->windowId); /* windowId (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_langbar_info_order(STREAM* s, RAIL_LANGBAR_INFO_ORDER* langbar_info)
|
||||
{
|
||||
stream_write_uint32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
||||
stream_write_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_recv_handshake_order(rdpRailOrder* rail_order, STREAM* s)
|
||||
@ -349,16 +353,16 @@ void rail_recv_handshake_order(rdpRailOrder* rail_order, STREAM* s)
|
||||
rail_order->sysparam.highContrast.flags = 0x7E;
|
||||
|
||||
rail_order->sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP;
|
||||
rail_order->sysparam.mouseButtonSwap = false;
|
||||
rail_order->sysparam.mouseButtonSwap = FALSE;
|
||||
|
||||
rail_order->sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF;
|
||||
rail_order->sysparam.keyboardPref = false;
|
||||
rail_order->sysparam.keyboardPref = FALSE;
|
||||
|
||||
rail_order->sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS;
|
||||
rail_order->sysparam.dragFullWindows = false;
|
||||
rail_order->sysparam.dragFullWindows = FALSE;
|
||||
|
||||
rail_order->sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES;
|
||||
rail_order->sysparam.keyboardCues = false;
|
||||
rail_order->sysparam.keyboardCues = FALSE;
|
||||
|
||||
rail_order->sysparam.params |= SPI_MASK_SET_WORK_AREA;
|
||||
rail_order->sysparam.workArea.left = 0;
|
||||
@ -414,8 +418,8 @@ void rail_recv_langbar_info_order(rdpRailOrder* rail_order, STREAM* s)
|
||||
|
||||
void rail_order_recv(rdpRailOrder* rail_order, STREAM* s)
|
||||
{
|
||||
uint16 orderType;
|
||||
uint16 orderLength;
|
||||
UINT16 orderType;
|
||||
UINT16 orderLength;
|
||||
|
||||
rail_read_pdu_header(s, &orderType, &orderLength);
|
||||
|
||||
@ -630,14 +634,15 @@ void rail_send_client_langbar_info_order(rdpRailOrder* rail_order)
|
||||
s = rail_pdu_init(RAIL_LANGBAR_INFO_ORDER_LENGTH);
|
||||
rail_write_langbar_info_order(s, &rail_order->langbar_info);
|
||||
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_LANGBAR_INFO);
|
||||
stream_free(s) ;
|
||||
stream_free(s);
|
||||
}
|
||||
|
||||
rdpRailOrder* rail_order_new()
|
||||
{
|
||||
rdpRailOrder* rail_order;
|
||||
|
||||
rail_order = xnew(rdpRailOrder);
|
||||
rail_order = (rdpRailOrder*) malloc(sizeof(rdpRailOrder));
|
||||
ZeroMemory(rail_order, sizeof(rdpRailOrder));
|
||||
|
||||
if (rail_order != NULL)
|
||||
{
|
||||
@ -652,7 +657,7 @@ void rail_order_free(rdpRailOrder* rail_order)
|
||||
if (rail_order != NULL)
|
||||
{
|
||||
|
||||
xfree(rail_order);
|
||||
free(rail_order);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Remote Applications Integrated Locally (RAIL)
|
||||
*
|
||||
* Copyright 2009 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -15,7 +15,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(MODULE_NAME "rdpdr")
|
||||
set(MODULE_PREFIX "CHANNEL_RDPDR")
|
||||
|
||||
if(WITH_CLIENT_CHANNELS)
|
||||
add_subdirectory(client)
|
||||
if(${MODULE_PREFIX}_CLIENT_STATIC)
|
||||
set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -6,9 +6,5 @@ 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()
|
||||
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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,34 @@
|
||||
# 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
|
||||
set(MODULE_NAME "rdpdr")
|
||||
set(MODULE_PREFIX "CHANNEL_RDPDR_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
irp.c
|
||||
irp.h
|
||||
devman.c
|
||||
devman.h
|
||||
rdpdr_main.c
|
||||
rdpdr_main.h)
|
||||
rdpdr_main.h
|
||||
rdpdr_capabilities.c
|
||||
rdpdr_capabilities.h)
|
||||
|
||||
add_library(rdpdr ${RDPDR_SRCS})
|
||||
set_target_properties(rdpdr PROPERTIES PREFIX "")
|
||||
# rdpdr is always built-in
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(rdpdr freerdp)
|
||||
set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE)
|
||||
|
||||
add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp winpr)
|
||||
else()
|
||||
target_link_libraries(rdpdr freerdp-utils)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
endif()
|
||||
|
||||
install(TARGETS rdpdr DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
||||
|
||||
add_subdirectory(disk)
|
||||
add_subdirectory(printer)
|
||||
if(NOT WIN32)
|
||||
add_subdirectory(parallel)
|
||||
add_subdirectory(serial)
|
||||
endif()
|
||||
|
||||
if(WITH_PCSC)
|
||||
add_subdirectory(smartcard)
|
||||
endif()
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* File System Virtual Channel
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Device Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2010-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.
|
||||
@ -32,8 +32,9 @@
|
||||
#include <freerdp/utils/list.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/utils/load_plugin.h>
|
||||
#include <freerdp/client/channels.h>
|
||||
|
||||
#include "rdpdr_types.h"
|
||||
#include "rdpdr_main.h"
|
||||
#include "devman.h"
|
||||
|
||||
DEVMAN* devman_new(rdpSvcPlugin* plugin)
|
||||
@ -57,7 +58,7 @@ void devman_free(DEVMAN* devman)
|
||||
|
||||
list_free(devman->devices);
|
||||
|
||||
xfree(devman);
|
||||
free(devman);
|
||||
}
|
||||
|
||||
static void devman_register_device(DEVMAN* devman, DEVICE* device)
|
||||
@ -68,15 +69,27 @@ static void devman_register_device(DEVMAN* devman, DEVICE* device)
|
||||
DEBUG_SVC("device %d.%s registered", device->id, device->name);
|
||||
}
|
||||
|
||||
boolean devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data)
|
||||
BOOL devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data)
|
||||
{
|
||||
char* name;
|
||||
DEVICE_SERVICE_ENTRY_POINTS ep;
|
||||
PDEVICE_SERVICE_ENTRY entry;
|
||||
PDEVICE_SERVICE_ENTRY entry = NULL;
|
||||
|
||||
entry = freerdp_load_plugin((char*) plugin_data->data[0], "DeviceServiceEntry");
|
||||
name = (char*) plugin_data->data[0];
|
||||
entry = (PDEVICE_SERVICE_ENTRY) freerdp_channels_find_static_device_service_entry(name);
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
printf("loading device service %s (plugin)\n", name);
|
||||
entry = freerdp_load_plugin(name, "DeviceServiceEntry");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("loading device service %s (static)\n", name);
|
||||
}
|
||||
|
||||
if (entry == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
ep.devman = devman;
|
||||
ep.RegisterDevice = devman_register_device;
|
||||
@ -84,10 +97,10 @@ boolean devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data)
|
||||
|
||||
entry(&ep);
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DEVICE* devman_get_device_by_id(DEVMAN* devman, uint32 id)
|
||||
DEVICE* devman_get_device_by_id(DEVMAN* devman, UINT32 id)
|
||||
{
|
||||
LIST_ITEM* item;
|
||||
DEVICE* device;
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* File System Virtual Channel
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Device Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2010-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.
|
||||
@ -18,12 +18,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __DEVMAN_H
|
||||
#define __DEVMAN_H
|
||||
#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H
|
||||
#define FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H
|
||||
|
||||
DEVMAN* devman_new(rdpSvcPlugin* plugin);
|
||||
void devman_free(DEVMAN* devman);
|
||||
boolean devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data);
|
||||
DEVICE* devman_get_device_by_id(DEVMAN* devman, uint32 id);
|
||||
BOOL devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data);
|
||||
DEVICE* devman_get_device_by_id(DEVMAN* devman, UINT32 id);
|
||||
|
||||
#endif /* __DEVMAN_H */
|
||||
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H */
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* File System Virtual Channel
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Device Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2010-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.
|
||||
@ -32,8 +32,7 @@
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#include "rdpdr_types.h"
|
||||
#include "rdpdr_constants.h"
|
||||
#include "rdpdr_main.h"
|
||||
#include "devman.h"
|
||||
#include "irp.h"
|
||||
|
||||
@ -55,7 +54,7 @@ static void irp_complete(IRP* irp)
|
||||
|
||||
pos = stream_get_pos(irp->output);
|
||||
stream_set_pos(irp->output, 12);
|
||||
stream_write_uint32(irp->output, irp->IoStatus);
|
||||
stream_write_UINT32(irp->output, irp->IoStatus);
|
||||
stream_set_pos(irp->output, pos);
|
||||
|
||||
svc_plugin_send(irp->devman->plugin, irp->output);
|
||||
@ -67,10 +66,10 @@ static void irp_complete(IRP* irp)
|
||||
IRP* irp_new(DEVMAN* devman, STREAM* data_in)
|
||||
{
|
||||
IRP* irp;
|
||||
uint32 DeviceId;
|
||||
UINT32 DeviceId;
|
||||
DEVICE* device;
|
||||
|
||||
stream_read_uint32(data_in, DeviceId);
|
||||
stream_read_UINT32(data_in, DeviceId);
|
||||
device = devman_get_device_by_id(devman, DeviceId);
|
||||
|
||||
if (device == NULL)
|
||||
@ -84,18 +83,18 @@ IRP* irp_new(DEVMAN* devman, STREAM* data_in)
|
||||
|
||||
irp->device = device;
|
||||
irp->devman = devman;
|
||||
stream_read_uint32(data_in, irp->FileId);
|
||||
stream_read_uint32(data_in, irp->CompletionId);
|
||||
stream_read_uint32(data_in, irp->MajorFunction);
|
||||
stream_read_uint32(data_in, irp->MinorFunction);
|
||||
stream_read_UINT32(data_in, irp->FileId);
|
||||
stream_read_UINT32(data_in, irp->CompletionId);
|
||||
stream_read_UINT32(data_in, irp->MajorFunction);
|
||||
stream_read_UINT32(data_in, irp->MinorFunction);
|
||||
irp->input = data_in;
|
||||
|
||||
irp->output = stream_new(256);
|
||||
stream_write_uint16(irp->output, RDPDR_CTYP_CORE);
|
||||
stream_write_uint16(irp->output, PAKID_CORE_DEVICE_IOCOMPLETION);
|
||||
stream_write_uint32(irp->output, DeviceId);
|
||||
stream_write_uint32(irp->output, irp->CompletionId);
|
||||
stream_seek_uint32(irp->output); /* IoStatus */
|
||||
stream_write_UINT16(irp->output, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(irp->output, PAKID_CORE_DEVICE_IOCOMPLETION);
|
||||
stream_write_UINT32(irp->output, DeviceId);
|
||||
stream_write_UINT32(irp->output, irp->CompletionId);
|
||||
stream_seek_UINT32(irp->output); /* IoStatus */
|
||||
|
||||
irp->Complete = irp_complete;
|
||||
irp->Discard = irp_free;
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* File System Virtual Channel
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Device Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2010-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.
|
||||
@ -18,11 +18,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __IRP_H
|
||||
#define __IRP_H
|
||||
#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_IRP_H
|
||||
#define FREERDP_CHANNEL_RDPDR_CLIENT_IRP_H
|
||||
|
||||
#include "rdpdr_types.h"
|
||||
#include "rdpdr_main.h"
|
||||
|
||||
IRP* irp_new(DEVMAN* devman, STREAM* data_in);
|
||||
|
||||
#endif /* __IRP_H */
|
||||
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_IRP_H */
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* File System Virtual Channel
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Device Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2010-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.
|
||||
@ -29,16 +29,15 @@
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#include "rdpdr_types.h"
|
||||
#include "rdpdr_constants.h"
|
||||
#include "rdpdr_main.h"
|
||||
#include "rdpdr_capabilities.h"
|
||||
|
||||
/* Output device redirection capability set header */
|
||||
static void rdpdr_write_capset_header(STREAM* data_out, uint16 capabilityType, uint16 capabilityLength, uint32 version)
|
||||
static void rdpdr_write_capset_header(STREAM* data_out, UINT16 capabilityType, UINT16 capabilityLength, UINT32 version)
|
||||
{
|
||||
stream_write_uint16(data_out, capabilityType);
|
||||
stream_write_uint16(data_out, capabilityLength);
|
||||
stream_write_uint32(data_out, version);
|
||||
stream_write_UINT16(data_out, capabilityType);
|
||||
stream_write_UINT16(data_out, capabilityLength);
|
||||
stream_write_UINT32(data_out, version);
|
||||
}
|
||||
|
||||
/* Output device direction general capability set */
|
||||
@ -46,24 +45,24 @@ static void rdpdr_write_general_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
|
||||
{
|
||||
rdpdr_write_capset_header(data_out, CAP_GENERAL_TYPE, 44, GENERAL_CAPABILITY_VERSION_02);
|
||||
|
||||
stream_write_uint32(data_out, 0); /* osType, ignored on receipt */
|
||||
stream_write_uint32(data_out, 0); /* osVersion, unused and must be set to zero */
|
||||
stream_write_uint16(data_out, 1); /* protocolMajorVersion, must be set to 1 */
|
||||
stream_write_uint16(data_out, RDPDR_MINOR_RDP_VERSION_5_2); /* protocolMinorVersion */
|
||||
stream_write_uint32(data_out, 0x0000FFFF); /* ioCode1 */
|
||||
stream_write_uint32(data_out, 0); /* ioCode2, must be set to zero, reserved for future use */
|
||||
stream_write_uint32(data_out, RDPDR_DEVICE_REMOVE_PDUS | RDPDR_CLIENT_DISPLAY_NAME_PDU | RDPDR_USER_LOGGEDON_PDU); /* extendedPDU */
|
||||
stream_write_uint32(data_out, ENABLE_ASYNCIO); /* extraFlags1 */
|
||||
stream_write_uint32(data_out, 0); /* extraFlags2, must be set to zero, reserved for future use */
|
||||
stream_write_uint32(data_out, 0); /* SpecialTypeDeviceCap, number of special devices to be redirected before logon */
|
||||
stream_write_UINT32(data_out, 0); /* osType, ignored on receipt */
|
||||
stream_write_UINT32(data_out, 0); /* osVersion, unused and must be set to zero */
|
||||
stream_write_UINT16(data_out, 1); /* protocolMajorVersion, must be set to 1 */
|
||||
stream_write_UINT16(data_out, RDPDR_MINOR_RDP_VERSION_5_2); /* protocolMinorVersion */
|
||||
stream_write_UINT32(data_out, 0x0000FFFF); /* ioCode1 */
|
||||
stream_write_UINT32(data_out, 0); /* ioCode2, must be set to zero, reserved for future use */
|
||||
stream_write_UINT32(data_out, RDPDR_DEVICE_REMOVE_PDUS | RDPDR_CLIENT_DISPLAY_NAME_PDU | RDPDR_USER_LOGGEDON_PDU); /* extendedPDU */
|
||||
stream_write_UINT32(data_out, ENABLE_ASYNCIO); /* extraFlags1 */
|
||||
stream_write_UINT32(data_out, 0); /* extraFlags2, must be set to zero, reserved for future use */
|
||||
stream_write_UINT32(data_out, 0); /* SpecialTypeDeviceCap, number of special devices to be redirected before logon */
|
||||
}
|
||||
|
||||
/* Process device direction general capability set */
|
||||
static void rdpdr_process_general_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
{
|
||||
uint16 capabilityLength;
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_uint16(data_in, capabilityLength);
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
stream_seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
@ -76,9 +75,9 @@ static void rdpdr_write_printer_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
|
||||
/* Process printer direction capability set */
|
||||
static void rdpdr_process_printer_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
{
|
||||
uint16 capabilityLength;
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_uint16(data_in, capabilityLength);
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
stream_seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
@ -91,9 +90,9 @@ static void rdpdr_write_port_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
|
||||
/* Process port redirection capability set */
|
||||
static void rdpdr_process_port_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
{
|
||||
uint16 capabilityLength;
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_uint16(data_in, capabilityLength);
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
stream_seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
@ -106,9 +105,9 @@ static void rdpdr_write_drive_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
|
||||
/* Process drive redirection capability set */
|
||||
static void rdpdr_process_drive_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
{
|
||||
uint16 capabilityLength;
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_uint16(data_in, capabilityLength);
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
stream_seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
@ -121,24 +120,24 @@ static void rdpdr_write_smartcard_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
|
||||
/* Process smartcard redirection capability set */
|
||||
static void rdpdr_process_smartcard_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
{
|
||||
uint16 capabilityLength;
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_uint16(data_in, capabilityLength);
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
stream_seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
{
|
||||
uint16 i;
|
||||
uint16 numCapabilities;
|
||||
uint16 capabilityType;
|
||||
UINT16 i;
|
||||
UINT16 numCapabilities;
|
||||
UINT16 capabilityType;
|
||||
|
||||
stream_read_uint16(data_in, numCapabilities);
|
||||
stream_read_UINT16(data_in, numCapabilities);
|
||||
stream_seek(data_in, 2); /* pad (2 bytes) */
|
||||
|
||||
for(i = 0; i < numCapabilities; i++)
|
||||
{
|
||||
stream_read_uint16(data_in, capabilityType);
|
||||
stream_read_UINT16(data_in, capabilityType);
|
||||
|
||||
switch (capabilityType)
|
||||
{
|
||||
@ -175,11 +174,11 @@ void rdpdr_send_capability_response(rdpdrPlugin* rdpdr)
|
||||
|
||||
data_out = stream_new(256);
|
||||
|
||||
stream_write_uint16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_uint16(data_out, PAKID_CORE_CLIENT_CAPABILITY);
|
||||
stream_write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(data_out, PAKID_CORE_CLIENT_CAPABILITY);
|
||||
|
||||
stream_write_uint16(data_out, 5); /* numCapabilities */
|
||||
stream_write_uint16(data_out, 0); /* pad */
|
||||
stream_write_UINT16(data_out, 5); /* numCapabilities */
|
||||
stream_write_UINT16(data_out, 0); /* pad */
|
||||
|
||||
rdpdr_write_general_capset(rdpdr, data_out);
|
||||
rdpdr_write_printer_capset(rdpdr, data_out);
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* File System Virtual Channel
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Device Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2010-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.
|
||||
@ -18,12 +18,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __RDPDR_CAPABILITIES_H
|
||||
#define __RDPDR_CAPABILITIES_H
|
||||
#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_CAPABILITIES_H
|
||||
#define FREERDP_CHANNEL_RDPDR_CLIENT_CAPABILITIES_H
|
||||
|
||||
#include "rdpdr_main.h"
|
||||
|
||||
void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, STREAM* data_in);
|
||||
void rdpdr_send_capability_response(rdpdrPlugin* rdpdr);
|
||||
|
||||
#endif /* __RDPDR_CAPABILITIES_H */
|
||||
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_CAPABILITIES_H */
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* File System Virtual Channel
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Device Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2010-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.
|
||||
@ -26,22 +26,25 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <freerdp/constants.h>
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "rdpdr_types.h"
|
||||
#include "rdpdr_constants.h"
|
||||
#include "rdpdr_capabilities.h"
|
||||
|
||||
#include "devman.h"
|
||||
#include "irp.h"
|
||||
|
||||
#include "rdpdr_main.h"
|
||||
|
||||
static void rdpdr_process_connect(rdpSvcPlugin* plugin)
|
||||
@ -63,15 +66,16 @@ static void rdpdr_process_connect(rdpSvcPlugin* plugin)
|
||||
{
|
||||
devman_load_device_service(rdpdr->devman, data);
|
||||
}
|
||||
data = (RDP_PLUGIN_DATA*) (((uint8*) data) + data->size);
|
||||
|
||||
data = (RDP_PLUGIN_DATA*) (((BYTE*) data) + data->size);
|
||||
}
|
||||
}
|
||||
|
||||
static void rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
{
|
||||
stream_read_uint16(data_in, rdpdr->versionMajor);
|
||||
stream_read_uint16(data_in, rdpdr->versionMinor);
|
||||
stream_read_uint32(data_in, rdpdr->clientID);
|
||||
stream_read_UINT16(data_in, rdpdr->versionMajor);
|
||||
stream_read_UINT16(data_in, rdpdr->versionMinor);
|
||||
stream_read_UINT32(data_in, rdpdr->clientID);
|
||||
|
||||
DEBUG_SVC("version %d.%d clientID %d", rdpdr->versionMajor, rdpdr->versionMinor, rdpdr->clientID);
|
||||
}
|
||||
@ -82,12 +86,12 @@ static void rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
|
||||
|
||||
data_out = stream_new(12);
|
||||
|
||||
stream_write_uint16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_uint16(data_out, PAKID_CORE_CLIENTID_CONFIRM);
|
||||
stream_write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(data_out, PAKID_CORE_CLIENTID_CONFIRM);
|
||||
|
||||
stream_write_uint16(data_out, rdpdr->versionMajor);
|
||||
stream_write_uint16(data_out, rdpdr->versionMinor);
|
||||
stream_write_uint32(data_out, (uint32) rdpdr->clientID);
|
||||
stream_write_UINT16(data_out, rdpdr->versionMajor);
|
||||
stream_write_UINT16(data_out, rdpdr->versionMinor);
|
||||
stream_write_UINT32(data_out, (UINT32) rdpdr->clientID);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out);
|
||||
}
|
||||
@ -105,29 +109,29 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
|
||||
|
||||
data_out = stream_new(16 + computerNameLenW + 2);
|
||||
|
||||
stream_write_uint16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_uint16(data_out, PAKID_CORE_CLIENT_NAME);
|
||||
stream_write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(data_out, PAKID_CORE_CLIENT_NAME);
|
||||
|
||||
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_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, computerNameW, computerNameLenW);
|
||||
stream_write_uint16(data_out, 0); /* null terminator */
|
||||
stream_write_UINT16(data_out, 0); /* null terminator */
|
||||
|
||||
xfree(computerNameW);
|
||||
free(computerNameW);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out);
|
||||
}
|
||||
|
||||
static void rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
{
|
||||
uint16 versionMajor;
|
||||
uint16 versionMinor;
|
||||
uint32 clientID;
|
||||
UINT16 versionMajor;
|
||||
UINT16 versionMinor;
|
||||
UINT32 clientID;
|
||||
|
||||
stream_read_uint16(data_in, versionMajor);
|
||||
stream_read_uint16(data_in, versionMinor);
|
||||
stream_read_uint32(data_in, clientID);
|
||||
stream_read_UINT16(data_in, versionMajor);
|
||||
stream_read_UINT16(data_in, versionMinor);
|
||||
stream_read_UINT32(data_in, clientID);
|
||||
|
||||
if (versionMajor != rdpdr->versionMajor || versionMinor != rdpdr->versionMinor)
|
||||
{
|
||||
@ -143,12 +147,12 @@ static void rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, STREAM* da
|
||||
}
|
||||
}
|
||||
|
||||
static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, boolean user_loggedon)
|
||||
static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL user_loggedon)
|
||||
{
|
||||
int i;
|
||||
int pos;
|
||||
uint8 c;
|
||||
uint32 count;
|
||||
BYTE c;
|
||||
UINT32 count;
|
||||
int data_len;
|
||||
int count_pos;
|
||||
STREAM* data_out;
|
||||
@ -157,12 +161,12 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, boolean
|
||||
|
||||
data_out = stream_new(256);
|
||||
|
||||
stream_write_uint16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_uint16(data_out, PAKID_CORE_DEVICELIST_ANNOUNCE);
|
||||
stream_write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(data_out, PAKID_CORE_DEVICELIST_ANNOUNCE);
|
||||
|
||||
count_pos = stream_get_pos(data_out);
|
||||
count = 0;
|
||||
stream_seek_uint32(data_out); /* deviceCount */
|
||||
stream_seek_UINT32(data_out); /* deviceCount */
|
||||
|
||||
for (item = rdpdr->devman->devices->head; item; item = item->next)
|
||||
{
|
||||
@ -180,21 +184,21 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, boolean
|
||||
data_len = (device->data == NULL ? 0 : stream_get_length(device->data));
|
||||
stream_check_size(data_out, 20 + data_len);
|
||||
|
||||
stream_write_uint32(data_out, device->type); /* deviceType */
|
||||
stream_write_uint32(data_out, device->id); /* deviceID */
|
||||
stream_write_UINT32(data_out, device->type); /* deviceType */
|
||||
stream_write_UINT32(data_out, device->id); /* deviceID */
|
||||
strncpy((char*) stream_get_tail(data_out), device->name, 8);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
stream_peek_uint8(data_out, c);
|
||||
stream_peek_BYTE(data_out, c);
|
||||
|
||||
if (c > 0x7F)
|
||||
stream_write_uint8(data_out, '_');
|
||||
stream_write_BYTE(data_out, '_');
|
||||
else
|
||||
stream_seek_uint8(data_out);
|
||||
stream_seek_BYTE(data_out);
|
||||
}
|
||||
|
||||
stream_write_uint32(data_out, data_len);
|
||||
stream_write_UINT32(data_out, data_len);
|
||||
|
||||
if (data_len > 0)
|
||||
stream_write(data_out, stream_get_data(device->data), data_len);
|
||||
@ -208,37 +212,37 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, boolean
|
||||
|
||||
pos = stream_get_pos(data_out);
|
||||
stream_set_pos(data_out, count_pos);
|
||||
stream_write_uint32(data_out, count);
|
||||
stream_write_UINT32(data_out, count);
|
||||
stream_set_pos(data_out, pos);
|
||||
stream_seal(data_out);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out);
|
||||
}
|
||||
|
||||
static boolean rdpdr_process_irp(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
static BOOL rdpdr_process_irp(rdpdrPlugin* rdpdr, STREAM* data_in)
|
||||
{
|
||||
IRP* irp;
|
||||
|
||||
irp = irp_new(rdpdr->devman, data_in);
|
||||
|
||||
if (irp == NULL)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
IFCALL(irp->device->IRPRequest, irp->device, irp);
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void rdpdr_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
|
||||
{
|
||||
uint16 component;
|
||||
uint16 packetID;
|
||||
uint32 deviceID;
|
||||
uint32 status;
|
||||
UINT16 component;
|
||||
UINT16 packetID;
|
||||
UINT32 deviceID;
|
||||
UINT32 status;
|
||||
rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin;
|
||||
|
||||
stream_read_uint16(data_in, component);
|
||||
stream_read_uint16(data_in, packetID);
|
||||
stream_read_UINT16(data_in, component);
|
||||
stream_read_UINT16(data_in, packetID);
|
||||
|
||||
if (component == RDPDR_CTYP_CORE)
|
||||
{
|
||||
@ -260,18 +264,18 @@ static void rdpdr_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
|
||||
case PAKID_CORE_CLIENTID_CONFIRM:
|
||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_CLIENTID_CONFIRM");
|
||||
rdpdr_process_server_clientid_confirm(rdpdr, data_in);
|
||||
rdpdr_send_device_list_announce_request(rdpdr, false);
|
||||
rdpdr_send_device_list_announce_request(rdpdr, FALSE);
|
||||
break;
|
||||
|
||||
case PAKID_CORE_USER_LOGGEDON:
|
||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_USER_LOGGEDON");
|
||||
rdpdr_send_device_list_announce_request(rdpdr, true);
|
||||
rdpdr_send_device_list_announce_request(rdpdr, TRUE);
|
||||
break;
|
||||
|
||||
case PAKID_CORE_DEVICE_REPLY:
|
||||
/* connect to a specific resource */
|
||||
stream_read_uint32(data_in, deviceID);
|
||||
stream_read_uint32(data_in, status);
|
||||
stream_read_UINT32(data_in, deviceID);
|
||||
stream_read_UINT32(data_in, status);
|
||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_DEVICE_REPLY (deviceID=%d status=0x%08X)", deviceID, status);
|
||||
break;
|
||||
|
||||
@ -309,9 +313,32 @@ static void rdpdr_process_terminate(rdpSvcPlugin* plugin)
|
||||
rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin;
|
||||
|
||||
devman_free(rdpdr->devman);
|
||||
xfree(plugin);
|
||||
free(plugin);
|
||||
}
|
||||
|
||||
DEFINE_SVC_PLUGIN(rdpdr, "rdpdr",
|
||||
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
|
||||
CHANNEL_OPTION_COMPRESS_RDP)
|
||||
/* rdpdr is always built-in */
|
||||
#define VirtualChannelEntry rdpdr_VirtualChannelEntry
|
||||
|
||||
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||
{
|
||||
rdpdrPlugin* _p;
|
||||
|
||||
_p = (rdpdrPlugin*) malloc(sizeof(rdpdrPlugin));
|
||||
ZeroMemory(_p, sizeof(rdpdrPlugin));
|
||||
|
||||
_p->plugin.channel_def.options =
|
||||
CHANNEL_OPTION_INITIALIZED |
|
||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||
CHANNEL_OPTION_COMPRESS_RDP;
|
||||
|
||||
strcpy(_p->plugin.channel_def.name, "rdpdr");
|
||||
|
||||
_p->plugin.connect_callback = rdpdr_process_connect;
|
||||
_p->plugin.receive_callback = rdpdr_process_receive;
|
||||
_p->plugin.event_callback = rdpdr_process_event;
|
||||
_p->plugin.terminate_callback = rdpdr_process_terminate;
|
||||
|
||||
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* File System Virtual Channel
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Device Redirection Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
* Copyright 2010-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.
|
||||
@ -18,24 +18,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __RDPDR_MAIN_H
|
||||
#define __RDPDR_MAIN_H
|
||||
#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H
|
||||
#define FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H
|
||||
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#include "rdpdr_types.h"
|
||||
|
||||
typedef struct rdpdr_plugin rdpdrPlugin;
|
||||
|
||||
struct rdpdr_plugin
|
||||
{
|
||||
rdpSvcPlugin plugin;
|
||||
|
||||
DEVMAN* devman;
|
||||
|
||||
uint16 versionMajor;
|
||||
uint16 versionMinor;
|
||||
uint16 clientID;
|
||||
UINT16 versionMajor;
|
||||
UINT16 versionMinor;
|
||||
UINT16 clientID;
|
||||
char computerName[256];
|
||||
};
|
||||
|
||||
#endif /* __RDPDR_MAIN_H */
|
||||
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H */
|
||||
|
@ -1,94 +0,0 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* File System Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
#ifndef __RDPDR_TYPES_H
|
||||
#define __RDPDR_TYPES_H
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/synch.h>
|
||||
#include <winpr/thread.h>
|
||||
#include <winpr/interlocked.h>
|
||||
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/list.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
typedef struct _DEVICE DEVICE;
|
||||
typedef struct _IRP IRP;
|
||||
typedef struct _DEVMAN DEVMAN;
|
||||
|
||||
typedef void (*pcIRPRequest)(DEVICE* device, IRP* irp);
|
||||
typedef void (*pcFreeDevice)(DEVICE* device);
|
||||
|
||||
struct _DEVICE
|
||||
{
|
||||
uint32 id;
|
||||
|
||||
uint32 type;
|
||||
char* name;
|
||||
STREAM* data;
|
||||
|
||||
pcIRPRequest IRPRequest;
|
||||
pcFreeDevice Free;
|
||||
};
|
||||
|
||||
typedef void (*pcIRPResponse)(IRP* irp);
|
||||
|
||||
struct _IRP
|
||||
{
|
||||
SLIST_ENTRY ItemEntry;
|
||||
|
||||
DEVICE* device;
|
||||
DEVMAN* devman;
|
||||
uint32 FileId;
|
||||
uint32 CompletionId;
|
||||
uint32 MajorFunction;
|
||||
uint32 MinorFunction;
|
||||
STREAM* input;
|
||||
|
||||
uint32 IoStatus;
|
||||
STREAM* output;
|
||||
|
||||
pcIRPResponse Complete;
|
||||
pcIRPResponse Discard;
|
||||
};
|
||||
|
||||
struct _DEVMAN
|
||||
{
|
||||
rdpSvcPlugin* plugin;
|
||||
uint32 id_sequence; /* generate unique device id */
|
||||
LIST* devices;
|
||||
};
|
||||
|
||||
typedef void (*pcRegisterDevice)(DEVMAN* devman, DEVICE* device);
|
||||
|
||||
struct _DEVICE_SERVICE_ENTRY_POINTS
|
||||
{
|
||||
DEVMAN* devman;
|
||||
|
||||
pcRegisterDevice RegisterDevice;
|
||||
RDP_PLUGIN_DATA* plugin_data;
|
||||
};
|
||||
typedef struct _DEVICE_SERVICE_ENTRY_POINTS DEVICE_SERVICE_ENTRY_POINTS;
|
||||
typedef DEVICE_SERVICE_ENTRY_POINTS* PDEVICE_SERVICE_ENTRY_POINTS;
|
||||
|
||||
typedef int (*PDEVICE_SERVICE_ENTRY)(PDEVICE_SERVICE_ENTRY_POINTS);
|
||||
|
||||
#endif /* __RDPDR_TYPES_H */
|
@ -1,39 +0,0 @@
|
||||
# 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(SCARD_SRCS
|
||||
scard_main.c
|
||||
scard_operations.c
|
||||
)
|
||||
|
||||
include_directories(..)
|
||||
include_directories(${PCSC_INCLUDE_DIRS})
|
||||
|
||||
add_library(scard ${SCARD_SRCS})
|
||||
set_target_properties(scard PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(scard freerdp winpr)
|
||||
else()
|
||||
target_link_libraries(scard freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
endif()
|
||||
|
||||
target_link_libraries(scard ${PCSC_LIBRARIES})
|
||||
|
||||
install(TARGETS scard DESTINATION ${FREERDP_PLUGIN_PATH})
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -20,6 +20,11 @@ set(MODULE_PREFIX "CHANNEL_RDPSND")
|
||||
|
||||
if(WITH_CLIENT_CHANNELS)
|
||||
add_subdirectory(client)
|
||||
if(${MODULE_PREFIX}_CLIENT_STATIC)
|
||||
set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_SERVER_CHANNELS)
|
||||
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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,32 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(RDPSND_SRCS
|
||||
set(MODULE_NAME "rdpsnd")
|
||||
set(MODULE_PREFIX "CHANNEL_RDPSND_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
rdpsnd_main.c
|
||||
rdpsnd_main.h)
|
||||
|
||||
add_library(rdpsnd ${RDPSND_SRCS})
|
||||
set_target_properties(rdpsnd PROPERTIES PREFIX "")
|
||||
# rdpsnd is always built-in
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(rdpsnd freerdp)
|
||||
set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE)
|
||||
set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE)
|
||||
|
||||
add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp)
|
||||
else()
|
||||
target_link_libraries(rdpsnd freerdp-utils)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils)
|
||||
endif()
|
||||
|
||||
install(TARGETS rdpsnd DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
||||
|
||||
if(WITH_ALSA)
|
||||
add_subdirectory(alsa)
|
||||
@ -41,6 +51,6 @@ if(WITH_PULSEAUDIO)
|
||||
endif()
|
||||
|
||||
if(WITH_MACAUDIO)
|
||||
add_subdirectory(mac_audio)
|
||||
add_subdirectory(MacAudio)
|
||||
endif()
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Laxmikant Rashinkar <LK.Rashinkar@gmail.com>
|
||||
# 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.
|
||||
@ -27,7 +25,7 @@ include_directories(${MACAUDIO_INCLUDE_DIRS})
|
||||
add_library(rdpsnd_macaudio ${RDPSND_MACAUDIO_SRCS})
|
||||
set_target_properties(rdpsnd_macaudio PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(rdpsnd_macaudio freerdp)
|
||||
else()
|
||||
target_link_libraries(rdpsnd_macaudio freerdp-utils)
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Output Virtual Channel
|
||||
*
|
||||
* Copyright 2012 Laxmikant Rashinkar <LK.Rashinkar@gmail.com>
|
||||
@ -125,7 +125,7 @@ static void rdpsnd_audio_free(rdpsndDevicePlugin* device)
|
||||
{
|
||||
}
|
||||
|
||||
static boolean rdpsnd_audio_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format)
|
||||
static BOOL rdpsnd_audio_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format)
|
||||
{
|
||||
switch (format->wFormatTag)
|
||||
{
|
||||
@ -146,11 +146,11 @@ static void rdpsnd_audio_set_format(rdpsndDevicePlugin* device, rdpsndFormat* fo
|
||||
{
|
||||
}
|
||||
|
||||
static void rdpsnd_audio_set_volume(rdpsndDevicePlugin* device, uint32 value)
|
||||
static void rdpsnd_audio_set_volume(rdpsndDevicePlugin* device, UINT32 value)
|
||||
{
|
||||
}
|
||||
|
||||
static void rdpsnd_audio_play(rdpsndDevicePlugin* device, uint8* data, int size)
|
||||
static void rdpsnd_audio_play(rdpsndDevicePlugin* device, BYTE* data, int size)
|
||||
{
|
||||
rdpsndAudioQPlugin* aq_plugin_p = (rdpsndAudioQPlugin *) device;
|
||||
AudioQueueBufferRef aq_buf_ref;
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2011 O.S. Systems Software Ltda.
|
||||
@ -18,8 +18,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
set(RDPSND_ALSA_SRCS
|
||||
rdpsnd_alsa.c
|
||||
)
|
||||
rdpsnd_alsa.c)
|
||||
|
||||
include_directories(..)
|
||||
include_directories(${ALSA_INCLUDE_DIRS})
|
||||
@ -27,10 +26,10 @@ include_directories(${ALSA_INCLUDE_DIRS})
|
||||
add_library(rdpsnd_alsa ${RDPSND_ALSA_SRCS})
|
||||
set_target_properties(rdpsnd_alsa PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(rdpsnd_alsa freerdp)
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(rdpsnd_alsa freerdp winpr)
|
||||
else()
|
||||
target_link_libraries(rdpsnd_alsa freerdp-utils)
|
||||
target_link_libraries(rdpsnd_alsa freerdp-utils winpr-crt)
|
||||
endif()
|
||||
|
||||
target_link_libraries(rdpsnd_alsa ${ALSA_LIBRARIES})
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Output Virtual Channel
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
@ -26,6 +26,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include <freerdp/types.h>
|
||||
@ -43,11 +45,11 @@ struct rdpsnd_alsa_plugin
|
||||
char* device_name;
|
||||
snd_pcm_t* out_handle;
|
||||
snd_mixer_t* mixer_handle;
|
||||
uint32 source_rate;
|
||||
uint32 actual_rate;
|
||||
UINT32 source_rate;
|
||||
UINT32 actual_rate;
|
||||
snd_pcm_format_t format;
|
||||
uint32 source_channels;
|
||||
uint32 actual_channels;
|
||||
UINT32 source_channels;
|
||||
UINT32 actual_channels;
|
||||
int bytes_per_channel;
|
||||
int wformat;
|
||||
int block_size;
|
||||
@ -257,12 +259,12 @@ static void rdpsnd_alsa_free(rdpsndDevicePlugin* device)
|
||||
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device;
|
||||
|
||||
rdpsnd_alsa_close(device);
|
||||
xfree(alsa->device_name);
|
||||
free(alsa->device_name);
|
||||
freerdp_dsp_context_free(alsa->dsp_context);
|
||||
xfree(alsa);
|
||||
free(alsa);
|
||||
}
|
||||
|
||||
static boolean rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format)
|
||||
static BOOL rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format)
|
||||
{
|
||||
switch (format->wFormatTag)
|
||||
{
|
||||
@ -272,7 +274,7 @@ static boolean rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFo
|
||||
(format->wBitsPerSample == 8 || format->wBitsPerSample == 16) &&
|
||||
(format->nChannels == 1 || format->nChannels == 2))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -282,14 +284,14 @@ static boolean rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFo
|
||||
format->wBitsPerSample == 4 &&
|
||||
(format->nChannels == 1 || format->nChannels == 2))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void rdpsnd_alsa_set_volume(rdpsndDevicePlugin* device, uint32 value)
|
||||
static void rdpsnd_alsa_set_volume(rdpsndDevicePlugin* device, UINT32 value)
|
||||
{
|
||||
long left;
|
||||
long right;
|
||||
@ -319,16 +321,16 @@ static void rdpsnd_alsa_set_volume(rdpsndDevicePlugin* device, uint32 value)
|
||||
}
|
||||
}
|
||||
|
||||
static void rdpsnd_alsa_play(rdpsndDevicePlugin* device, uint8* data, int size)
|
||||
static void rdpsnd_alsa_play(rdpsndDevicePlugin* device, BYTE* data, int size)
|
||||
{
|
||||
uint8* src;
|
||||
BYTE* src;
|
||||
int len;
|
||||
int status;
|
||||
int frames;
|
||||
int rbytes_per_frame;
|
||||
int sbytes_per_frame;
|
||||
uint8* pindex;
|
||||
uint8* end;
|
||||
BYTE* pindex;
|
||||
BYTE* end;
|
||||
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*) device;
|
||||
|
||||
if (alsa->out_handle == 0)
|
||||
@ -434,12 +436,12 @@ int FreeRDPRdpsndDeviceEntry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
|
||||
|
||||
if (data && strcmp((char*) data->data[0], "alsa") == 0)
|
||||
{
|
||||
alsa->device_name = xstrdup((char*) data->data[1]);
|
||||
alsa->device_name = _strdup((char*) data->data[1]);
|
||||
}
|
||||
|
||||
if (alsa->device_name == NULL)
|
||||
{
|
||||
alsa->device_name = xstrdup("default");
|
||||
alsa->device_name = _strdup("default");
|
||||
}
|
||||
|
||||
alsa->out_handle = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2011 O.S. Systems Software Ltda.
|
||||
@ -26,7 +26,7 @@ include_directories(${PULSEAUDIO_INCLUDE_DIR})
|
||||
add_library(rdpsnd_pulse ${RDPSND_PULSE_SRCS})
|
||||
set_target_properties(rdpsnd_pulse PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(rdpsnd_pulse freerdp)
|
||||
else()
|
||||
target_link_libraries(rdpsnd_pulse freerdp-utils)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Output Virtual Channel
|
||||
*
|
||||
* Copyright 2011 Vic Lee
|
||||
@ -25,7 +25,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <pulse/pulseaudio.h>
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/dsp.h>
|
||||
@ -77,18 +80,18 @@ static void rdpsnd_pulse_context_state_callback(pa_context* context, void* userd
|
||||
}
|
||||
}
|
||||
|
||||
static boolean rdpsnd_pulse_connect(rdpsndDevicePlugin* device)
|
||||
static BOOL rdpsnd_pulse_connect(rdpsndDevicePlugin* device)
|
||||
{
|
||||
pa_context_state_t state;
|
||||
rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*) device;
|
||||
|
||||
if (!pulse->context)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
if (pa_context_connect(pulse->context, NULL, 0, NULL))
|
||||
{
|
||||
DEBUG_WARN("pa_context_connect failed (%d)", pa_context_errno(pulse->context));
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pa_threaded_mainloop_lock(pulse->mainloop);
|
||||
@ -97,7 +100,7 @@ static boolean rdpsnd_pulse_connect(rdpsndDevicePlugin* device)
|
||||
{
|
||||
pa_threaded_mainloop_unlock(pulse->mainloop);
|
||||
DEBUG_WARN("pa_threaded_mainloop_start failed (%d)", pa_context_errno(pulse->context));
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
@ -118,12 +121,12 @@ static boolean rdpsnd_pulse_connect(rdpsndDevicePlugin* device)
|
||||
if (state == PA_CONTEXT_READY)
|
||||
{
|
||||
DEBUG_SVC("connected");
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pa_context_disconnect(pulse->context);
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,9 +288,9 @@ static void rdpsnd_pulse_open(rdpsndDevicePlugin* device, rdpsndFormat* format,
|
||||
{
|
||||
buffer_attr.maxlength = pa_usec_to_bytes(pulse->latency * 2 * 1000, &pulse->sample_spec);
|
||||
buffer_attr.tlength = pa_usec_to_bytes(pulse->latency * 1000, &pulse->sample_spec);
|
||||
buffer_attr.prebuf = (uint32_t) -1;
|
||||
buffer_attr.minreq = (uint32_t) -1;
|
||||
buffer_attr.fragsize = (uint32_t) -1;
|
||||
buffer_attr.prebuf = (UINT32_t) -1;
|
||||
buffer_attr.minreq = (UINT32_t) -1;
|
||||
buffer_attr.fragsize = (UINT32_t) -1;
|
||||
flags |= PA_STREAM_ADJUST_LATENCY;
|
||||
}
|
||||
|
||||
@ -357,17 +360,17 @@ static void rdpsnd_pulse_free(rdpsndDevicePlugin* device)
|
||||
pulse->mainloop = NULL;
|
||||
}
|
||||
|
||||
xfree(pulse->device_name);
|
||||
free(pulse->device_name);
|
||||
freerdp_dsp_context_free(pulse->dsp_context);
|
||||
xfree(pulse);
|
||||
free(pulse);
|
||||
}
|
||||
|
||||
static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format)
|
||||
static BOOL rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format)
|
||||
{
|
||||
rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
|
||||
|
||||
if (!pulse->context)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
switch (format->wFormatTag)
|
||||
{
|
||||
@ -377,7 +380,7 @@ static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndF
|
||||
(format->wBitsPerSample == 8 || format->wBitsPerSample == 16) &&
|
||||
(format->nChannels >= 1 && format->nChannels <= PA_CHANNELS_MAX))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -388,7 +391,7 @@ static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndF
|
||||
(format->wBitsPerSample == 8) &&
|
||||
(format->nChannels >= 1 && format->nChannels <= PA_CHANNELS_MAX))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -398,11 +401,11 @@ static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndF
|
||||
(format->wBitsPerSample == 4) &&
|
||||
(format->nChannels == 1 || format->nChannels == 2))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void rdpsnd_pulse_set_format(rdpsndDevicePlugin* device, rdpsndFormat* format, int latency)
|
||||
@ -421,7 +424,7 @@ static void rdpsnd_pulse_set_format(rdpsndDevicePlugin* device, rdpsndFormat* fo
|
||||
rdpsnd_pulse_open(device, format, latency);
|
||||
}
|
||||
|
||||
static void rdpsnd_pulse_set_volume(rdpsndDevicePlugin* device, uint32 value)
|
||||
static void rdpsnd_pulse_set_volume(rdpsndDevicePlugin* device, UINT32 value)
|
||||
{
|
||||
pa_cvolume cv;
|
||||
pa_volume_t left;
|
||||
@ -450,11 +453,11 @@ static void rdpsnd_pulse_set_volume(rdpsndDevicePlugin* device, uint32 value)
|
||||
pa_threaded_mainloop_unlock(pulse->mainloop);
|
||||
}
|
||||
|
||||
static void rdpsnd_pulse_play(rdpsndDevicePlugin* device, uint8* data, int size)
|
||||
static void rdpsnd_pulse_play(rdpsndDevicePlugin* device, BYTE* data, int size)
|
||||
{
|
||||
int len;
|
||||
int ret;
|
||||
uint8* src;
|
||||
BYTE* src;
|
||||
rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*) device;
|
||||
|
||||
if (!pulse->stream)
|
||||
@ -541,7 +544,7 @@ int FreeRDPRdpsndDeviceEntry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
|
||||
if (data && strcmp((char*)data->data[0], "pulse") == 0)
|
||||
{
|
||||
if(data->data[1] && strlen((char*)data->data[1]) > 0)
|
||||
pulse->device_name = xstrdup((char*)data->data[1]);
|
||||
pulse->device_name = _strdup((char*)data->data[1]);
|
||||
else
|
||||
pulse->device_name = NULL;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Output Virtual Channel
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
@ -30,6 +30,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
@ -46,23 +48,23 @@ struct rdpsnd_plugin
|
||||
|
||||
LIST* data_out_list;
|
||||
|
||||
uint8 cBlockNo;
|
||||
BYTE cBlockNo;
|
||||
rdpsndFormat* supported_formats;
|
||||
int n_supported_formats;
|
||||
int current_format;
|
||||
|
||||
boolean expectingWave;
|
||||
uint8 waveData[4];
|
||||
uint16 waveDataSize;
|
||||
uint32 wTimeStamp; /* server timestamp */
|
||||
uint32 wave_timestamp; /* client timestamp */
|
||||
BOOL expectingWave;
|
||||
BYTE waveData[4];
|
||||
UINT16 waveDataSize;
|
||||
UINT32 wTimeStamp; /* server timestamp */
|
||||
UINT32 wave_timestamp; /* client timestamp */
|
||||
|
||||
boolean is_open;
|
||||
uint32 close_timestamp;
|
||||
BOOL is_open;
|
||||
UINT32 close_timestamp;
|
||||
|
||||
uint16 fixed_format;
|
||||
uint16 fixed_channel;
|
||||
uint32 fixed_rate;
|
||||
UINT16 fixed_format;
|
||||
UINT16 fixed_channel;
|
||||
UINT32 fixed_rate;
|
||||
int latency;
|
||||
|
||||
/* Device plugin */
|
||||
@ -72,11 +74,11 @@ struct rdpsnd_plugin
|
||||
struct data_out_item
|
||||
{
|
||||
STREAM* data_out;
|
||||
uint32 out_timestamp;
|
||||
UINT32 out_timestamp;
|
||||
};
|
||||
|
||||
/* get time in milliseconds */
|
||||
static uint32 get_mstime(void)
|
||||
static UINT32 get_mstime(void)
|
||||
{
|
||||
struct timeval tp;
|
||||
|
||||
@ -89,7 +91,7 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin)
|
||||
{
|
||||
rdpsndPlugin* rdpsnd = (rdpsndPlugin*)plugin;
|
||||
struct data_out_item* item;
|
||||
uint32 cur_time;
|
||||
UINT32 cur_time;
|
||||
|
||||
while (list_size(rdpsnd->data_out_list) > 0)
|
||||
{
|
||||
@ -102,7 +104,7 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin)
|
||||
|
||||
item = (struct data_out_item*) list_dequeue(rdpsnd->data_out_list);
|
||||
svc_plugin_send(plugin, item->data_out);
|
||||
xfree(item);
|
||||
free(item);
|
||||
|
||||
DEBUG_SVC("processed data_out");
|
||||
}
|
||||
@ -115,7 +117,7 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin)
|
||||
{
|
||||
if (rdpsnd->device)
|
||||
IFCALL(rdpsnd->device->Close, rdpsnd->device);
|
||||
rdpsnd->is_open = false;
|
||||
rdpsnd->is_open = FALSE;
|
||||
rdpsnd->close_timestamp = 0;
|
||||
|
||||
DEBUG_SVC("processed close");
|
||||
@ -130,11 +132,11 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin)
|
||||
|
||||
static void rdpsnd_free_supported_formats(rdpsndPlugin* rdpsnd)
|
||||
{
|
||||
uint16 i;
|
||||
UINT16 i;
|
||||
|
||||
for (i = 0; i < rdpsnd->n_supported_formats; i++)
|
||||
xfree(rdpsnd->supported_formats[i].data);
|
||||
xfree(rdpsnd->supported_formats);
|
||||
free(rdpsnd->supported_formats[i].data);
|
||||
free(rdpsnd->supported_formats);
|
||||
|
||||
rdpsnd->supported_formats = NULL;
|
||||
rdpsnd->n_supported_formats = 0;
|
||||
@ -144,27 +146,27 @@ static void rdpsnd_free_supported_formats(rdpsndPlugin* rdpsnd)
|
||||
of client supported formats */
|
||||
static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in)
|
||||
{
|
||||
uint16 wNumberOfFormats;
|
||||
uint16 nFormat;
|
||||
uint16 wVersion;
|
||||
UINT16 wNumberOfFormats;
|
||||
UINT16 nFormat;
|
||||
UINT16 wVersion;
|
||||
STREAM* data_out;
|
||||
rdpsndFormat* out_formats;
|
||||
uint16 n_out_formats;
|
||||
UINT16 n_out_formats;
|
||||
rdpsndFormat* format;
|
||||
uint8* format_mark;
|
||||
uint8* data_mark;
|
||||
BYTE* format_mark;
|
||||
BYTE* data_mark;
|
||||
int pos;
|
||||
|
||||
rdpsnd_free_supported_formats(rdpsnd);
|
||||
|
||||
stream_seek_uint32(data_in); /* dwFlags */
|
||||
stream_seek_uint32(data_in); /* dwVolume */
|
||||
stream_seek_uint32(data_in); /* dwPitch */
|
||||
stream_seek_uint16(data_in); /* wDGramPort */
|
||||
stream_read_uint16(data_in, wNumberOfFormats);
|
||||
stream_read_uint8(data_in, rdpsnd->cBlockNo); /* cLastBlockConfirmed */
|
||||
stream_read_uint16(data_in, wVersion);
|
||||
stream_seek_uint8(data_in); /* bPad */
|
||||
stream_seek_UINT32(data_in); /* dwFlags */
|
||||
stream_seek_UINT32(data_in); /* dwVolume */
|
||||
stream_seek_UINT32(data_in); /* dwPitch */
|
||||
stream_seek_UINT16(data_in); /* wDGramPort */
|
||||
stream_read_UINT16(data_in, wNumberOfFormats);
|
||||
stream_read_BYTE(data_in, rdpsnd->cBlockNo); /* cLastBlockConfirmed */
|
||||
stream_read_UINT16(data_in, wVersion);
|
||||
stream_seek_BYTE(data_in); /* bPad */
|
||||
|
||||
DEBUG_SVC("wNumberOfFormats %d wVersion %d", wNumberOfFormats, wVersion);
|
||||
if (wNumberOfFormats < 1)
|
||||
@ -177,29 +179,29 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in
|
||||
n_out_formats = 0;
|
||||
|
||||
data_out = stream_new(24);
|
||||
stream_write_uint8(data_out, SNDC_FORMATS); /* msgType */
|
||||
stream_write_uint8(data_out, 0); /* bPad */
|
||||
stream_seek_uint16(data_out); /* BodySize */
|
||||
stream_write_uint32(data_out, TSSNDCAPS_ALIVE | TSSNDCAPS_VOLUME); /* dwFlags */
|
||||
stream_write_uint32(data_out, 0xFFFFFFFF); /* dwVolume */
|
||||
stream_write_uint32(data_out, 0); /* dwPitch */
|
||||
stream_write_uint16_be(data_out, 0); /* wDGramPort */
|
||||
stream_seek_uint16(data_out); /* wNumberOfFormats */
|
||||
stream_write_uint8(data_out, 0); /* cLastBlockConfirmed */
|
||||
stream_write_uint16(data_out, 6); /* wVersion */
|
||||
stream_write_uint8(data_out, 0); /* bPad */
|
||||
stream_write_BYTE(data_out, SNDC_FORMATS); /* msgType */
|
||||
stream_write_BYTE(data_out, 0); /* bPad */
|
||||
stream_seek_UINT16(data_out); /* BodySize */
|
||||
stream_write_UINT32(data_out, TSSNDCAPS_ALIVE | TSSNDCAPS_VOLUME); /* dwFlags */
|
||||
stream_write_UINT32(data_out, 0xFFFFFFFF); /* dwVolume */
|
||||
stream_write_UINT32(data_out, 0); /* dwPitch */
|
||||
stream_write_UINT16_be(data_out, 0); /* wDGramPort */
|
||||
stream_seek_UINT16(data_out); /* wNumberOfFormats */
|
||||
stream_write_BYTE(data_out, 0); /* cLastBlockConfirmed */
|
||||
stream_write_UINT16(data_out, 6); /* wVersion */
|
||||
stream_write_BYTE(data_out, 0); /* bPad */
|
||||
|
||||
for (nFormat = 0; nFormat < wNumberOfFormats; nFormat++)
|
||||
{
|
||||
stream_get_mark(data_in, format_mark);
|
||||
format = &out_formats[n_out_formats];
|
||||
stream_read_uint16(data_in, format->wFormatTag);
|
||||
stream_read_uint16(data_in, format->nChannels);
|
||||
stream_read_uint32(data_in, format->nSamplesPerSec);
|
||||
stream_seek_uint32(data_in); /* nAvgBytesPerSec */
|
||||
stream_read_uint16(data_in, format->nBlockAlign);
|
||||
stream_read_uint16(data_in, format->wBitsPerSample);
|
||||
stream_read_uint16(data_in, format->cbSize);
|
||||
stream_read_UINT16(data_in, format->wFormatTag);
|
||||
stream_read_UINT16(data_in, format->nChannels);
|
||||
stream_read_UINT32(data_in, format->nSamplesPerSec);
|
||||
stream_seek_UINT32(data_in); /* nAvgBytesPerSec */
|
||||
stream_read_UINT16(data_in, format->nBlockAlign);
|
||||
stream_read_UINT16(data_in, format->wBitsPerSample);
|
||||
stream_read_UINT16(data_in, format->cbSize);
|
||||
stream_get_mark(data_in, data_mark);
|
||||
stream_seek(data_in, format->cbSize);
|
||||
format->data = NULL;
|
||||
@ -222,7 +224,7 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in
|
||||
stream_write(data_out, format_mark, 18 + format->cbSize);
|
||||
if (format->cbSize > 0)
|
||||
{
|
||||
format->data = xmalloc(format->cbSize);
|
||||
format->data = malloc(format->cbSize);
|
||||
memcpy(format->data, data_mark, format->cbSize);
|
||||
}
|
||||
n_out_formats++;
|
||||
@ -236,15 +238,15 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in
|
||||
}
|
||||
else
|
||||
{
|
||||
xfree(out_formats);
|
||||
free(out_formats);
|
||||
DEBUG_WARN("no formats supported");
|
||||
}
|
||||
|
||||
pos = stream_get_pos(data_out);
|
||||
stream_set_pos(data_out, 2);
|
||||
stream_write_uint16(data_out, pos - 4);
|
||||
stream_write_UINT16(data_out, pos - 4);
|
||||
stream_set_pos(data_out, 18);
|
||||
stream_write_uint16(data_out, n_out_formats);
|
||||
stream_write_UINT16(data_out, n_out_formats);
|
||||
stream_set_pos(data_out, pos);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*)rdpsnd, data_out);
|
||||
@ -252,11 +254,11 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in
|
||||
if (wVersion >= 6)
|
||||
{
|
||||
data_out = stream_new(8);
|
||||
stream_write_uint8(data_out, SNDC_QUALITYMODE); /* msgType */
|
||||
stream_write_uint8(data_out, 0); /* bPad */
|
||||
stream_write_uint16(data_out, 4); /* BodySize */
|
||||
stream_write_uint16(data_out, HIGH_QUALITY); /* wQualityMode */
|
||||
stream_write_uint16(data_out, 0); /* Reserved */
|
||||
stream_write_BYTE(data_out, SNDC_QUALITYMODE); /* msgType */
|
||||
stream_write_BYTE(data_out, 0); /* bPad */
|
||||
stream_write_UINT16(data_out, 4); /* BodySize */
|
||||
stream_write_UINT16(data_out, HIGH_QUALITY); /* wQualityMode */
|
||||
stream_write_UINT16(data_out, 0); /* Reserved */
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*)rdpsnd, data_out);
|
||||
}
|
||||
@ -265,35 +267,35 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in
|
||||
/* server is getting a feel of the round trip time */
|
||||
static void rdpsnd_process_message_training(rdpsndPlugin* rdpsnd, STREAM* data_in)
|
||||
{
|
||||
uint16 wTimeStamp;
|
||||
uint16 wPackSize;
|
||||
UINT16 wTimeStamp;
|
||||
UINT16 wPackSize;
|
||||
STREAM* data_out;
|
||||
|
||||
stream_read_uint16(data_in, wTimeStamp);
|
||||
stream_read_uint16(data_in, wPackSize);
|
||||
stream_read_UINT16(data_in, wTimeStamp);
|
||||
stream_read_UINT16(data_in, wPackSize);
|
||||
|
||||
data_out = stream_new(8);
|
||||
stream_write_uint8(data_out, SNDC_TRAINING); /* msgType */
|
||||
stream_write_uint8(data_out, 0); /* bPad */
|
||||
stream_write_uint16(data_out, 4); /* BodySize */
|
||||
stream_write_uint16(data_out, wTimeStamp);
|
||||
stream_write_uint16(data_out, wPackSize);
|
||||
stream_write_BYTE(data_out, SNDC_TRAINING); /* msgType */
|
||||
stream_write_BYTE(data_out, 0); /* bPad */
|
||||
stream_write_UINT16(data_out, 4); /* BodySize */
|
||||
stream_write_UINT16(data_out, wTimeStamp);
|
||||
stream_write_UINT16(data_out, wPackSize);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*)rdpsnd, data_out);
|
||||
}
|
||||
|
||||
static void rdpsnd_process_message_wave_info(rdpsndPlugin* rdpsnd, STREAM* data_in, uint16 BodySize)
|
||||
static void rdpsnd_process_message_wave_info(rdpsndPlugin* rdpsnd, STREAM* data_in, UINT16 BodySize)
|
||||
{
|
||||
uint16 wFormatNo;
|
||||
UINT16 wFormatNo;
|
||||
|
||||
stream_read_uint16(data_in, rdpsnd->wTimeStamp);
|
||||
stream_read_uint16(data_in, wFormatNo);
|
||||
stream_read_uint8(data_in, rdpsnd->cBlockNo);
|
||||
stream_read_UINT16(data_in, rdpsnd->wTimeStamp);
|
||||
stream_read_UINT16(data_in, wFormatNo);
|
||||
stream_read_BYTE(data_in, rdpsnd->cBlockNo);
|
||||
stream_seek(data_in, 3); /* bPad */
|
||||
stream_read(data_in, rdpsnd->waveData, 4);
|
||||
rdpsnd->waveDataSize = BodySize - 8;
|
||||
rdpsnd->wave_timestamp = get_mstime();
|
||||
rdpsnd->expectingWave = true;
|
||||
rdpsnd->expectingWave = TRUE;
|
||||
|
||||
DEBUG_SVC("waveDataSize %d wFormatNo %d", rdpsnd->waveDataSize, wFormatNo);
|
||||
|
||||
@ -301,7 +303,7 @@ static void rdpsnd_process_message_wave_info(rdpsndPlugin* rdpsnd, STREAM* data_
|
||||
if (!rdpsnd->is_open)
|
||||
{
|
||||
rdpsnd->current_format = wFormatNo;
|
||||
rdpsnd->is_open = true;
|
||||
rdpsnd->is_open = TRUE;
|
||||
if (rdpsnd->device)
|
||||
IFCALL(rdpsnd->device->Open, rdpsnd->device, &rdpsnd->supported_formats[wFormatNo],
|
||||
rdpsnd->latency);
|
||||
@ -318,9 +320,9 @@ static void rdpsnd_process_message_wave_info(rdpsndPlugin* rdpsnd, STREAM* data_
|
||||
/* header is not removed from data in this function */
|
||||
static void rdpsnd_process_message_wave(rdpsndPlugin* rdpsnd, STREAM* data_in)
|
||||
{
|
||||
uint16 wTimeStamp;
|
||||
uint32 delay_ms;
|
||||
uint32 process_ms;
|
||||
UINT16 wTimeStamp;
|
||||
UINT32 delay_ms;
|
||||
UINT32 process_ms;
|
||||
struct data_out_item* item;
|
||||
|
||||
rdpsnd->expectingWave = 0;
|
||||
@ -342,12 +344,12 @@ static void rdpsnd_process_message_wave(rdpsndPlugin* rdpsnd, STREAM* data_in)
|
||||
|
||||
item = xnew(struct data_out_item);
|
||||
item->data_out = stream_new(8);
|
||||
stream_write_uint8(item->data_out, SNDC_WAVECONFIRM);
|
||||
stream_write_uint8(item->data_out, 0);
|
||||
stream_write_uint16(item->data_out, 4);
|
||||
stream_write_uint16(item->data_out, wTimeStamp);
|
||||
stream_write_uint8(item->data_out, rdpsnd->cBlockNo); /* cConfirmedBlockNo */
|
||||
stream_write_uint8(item->data_out, 0); /* bPad */
|
||||
stream_write_BYTE(item->data_out, SNDC_WAVECONFIRM);
|
||||
stream_write_BYTE(item->data_out, 0);
|
||||
stream_write_UINT16(item->data_out, 4);
|
||||
stream_write_UINT16(item->data_out, wTimeStamp);
|
||||
stream_write_BYTE(item->data_out, rdpsnd->cBlockNo); /* cConfirmedBlockNo */
|
||||
stream_write_BYTE(item->data_out, 0); /* bPad */
|
||||
item->out_timestamp = rdpsnd->wave_timestamp + delay_ms;
|
||||
|
||||
list_enqueue(rdpsnd->data_out_list, item);
|
||||
@ -365,9 +367,9 @@ static void rdpsnd_process_message_close(rdpsndPlugin* rdpsnd)
|
||||
|
||||
static void rdpsnd_process_message_setvolume(rdpsndPlugin* rdpsnd, STREAM* data_in)
|
||||
{
|
||||
uint32 dwVolume;
|
||||
UINT32 dwVolume;
|
||||
|
||||
stream_read_uint32(data_in, dwVolume);
|
||||
stream_read_UINT32(data_in, dwVolume);
|
||||
DEBUG_SVC("dwVolume 0x%X", dwVolume);
|
||||
if (rdpsnd->device)
|
||||
IFCALL(rdpsnd->device->SetVolume, rdpsnd->device, dwVolume);
|
||||
@ -376,8 +378,8 @@ static void rdpsnd_process_message_setvolume(rdpsndPlugin* rdpsnd, STREAM* data_
|
||||
static void rdpsnd_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
|
||||
{
|
||||
rdpsndPlugin* rdpsnd = (rdpsndPlugin*)plugin;
|
||||
uint8 msgType;
|
||||
uint16 BodySize;
|
||||
BYTE msgType;
|
||||
UINT16 BodySize;
|
||||
|
||||
if (rdpsnd->expectingWave)
|
||||
{
|
||||
@ -386,9 +388,9 @@ static void rdpsnd_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
|
||||
return;
|
||||
}
|
||||
|
||||
stream_read_uint8(data_in, msgType); /* msgType */
|
||||
stream_seek_uint8(data_in); /* bPad */
|
||||
stream_read_uint16(data_in, BodySize);
|
||||
stream_read_BYTE(data_in, msgType); /* msgType */
|
||||
stream_seek_BYTE(data_in); /* bPad */
|
||||
stream_read_UINT16(data_in, BodySize);
|
||||
|
||||
DEBUG_SVC("msgType %d BodySize %d", msgType, BodySize);
|
||||
|
||||
@ -427,7 +429,7 @@ static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlug
|
||||
rdpsnd->device = device;
|
||||
}
|
||||
|
||||
static boolean rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, RDP_PLUGIN_DATA* data)
|
||||
static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, RDP_PLUGIN_DATA* data)
|
||||
{
|
||||
FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints;
|
||||
PFREERDP_RDPSND_DEVICE_ENTRY entry;
|
||||
@ -441,11 +443,11 @@ static boolean rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name,
|
||||
strcpy(fullname, "rdpsnd_");
|
||||
strcat(fullname, name);
|
||||
entry = (PFREERDP_RDPSND_DEVICE_ENTRY)freerdp_load_plugin(fullname, RDPSND_DEVICE_EXPORT_FUNC_NAME);
|
||||
xfree(fullname);
|
||||
free(fullname);
|
||||
}
|
||||
if (entry == NULL)
|
||||
{
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
entryPoints.rdpsnd = rdpsnd;
|
||||
@ -454,9 +456,9 @@ static boolean rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name,
|
||||
if (entry(&entryPoints) != 0)
|
||||
{
|
||||
DEBUG_WARN("%s entry returns error.", name);
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void rdpsnd_process_plugin_data(rdpsndPlugin* rdpsnd, RDP_PLUGIN_DATA* data)
|
||||
@ -501,7 +503,7 @@ static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
|
||||
while (data && data->size > 0)
|
||||
{
|
||||
rdpsnd_process_plugin_data(rdpsnd, data);
|
||||
data = (RDP_PLUGIN_DATA*) (((uint8*) data) + data->size);
|
||||
data = (RDP_PLUGIN_DATA*) (((BYTE*) data) + data->size);
|
||||
}
|
||||
|
||||
if (rdpsnd->device == NULL)
|
||||
@ -554,15 +556,37 @@ static void rdpsnd_process_terminate(rdpSvcPlugin* plugin)
|
||||
while ((item = list_dequeue(rdpsnd->data_out_list)) != NULL)
|
||||
{
|
||||
stream_free(item->data_out);
|
||||
xfree(item);
|
||||
free(item);
|
||||
}
|
||||
list_free(rdpsnd->data_out_list);
|
||||
|
||||
rdpsnd_free_supported_formats(rdpsnd);
|
||||
|
||||
xfree(plugin);
|
||||
free(plugin);
|
||||
}
|
||||
|
||||
DEFINE_SVC_PLUGIN(rdpsnd, "rdpsnd",
|
||||
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP)
|
||||
/* rdpsnd is always built-in */
|
||||
#define VirtualChannelEntry rdpsnd_VirtualChannelEntry
|
||||
|
||||
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||
{
|
||||
rdpsndPlugin* _p;
|
||||
|
||||
_p = (rdpsndPlugin*) malloc(sizeof(rdpsndPlugin));
|
||||
ZeroMemory(_p, sizeof(rdpsndPlugin));
|
||||
|
||||
_p->plugin.channel_def.options =
|
||||
CHANNEL_OPTION_INITIALIZED |
|
||||
CHANNEL_OPTION_ENCRYPT_RDP;
|
||||
|
||||
strcpy(_p->plugin.channel_def.name, "rdpsnd");
|
||||
|
||||
_p->plugin.connect_callback = rdpsnd_process_connect;
|
||||
_p->plugin.receive_callback = rdpsnd_process_receive;
|
||||
_p->plugin.event_callback = rdpsnd_process_event;
|
||||
_p->plugin.terminate_callback = rdpsnd_process_terminate;
|
||||
|
||||
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Output Virtual Channel
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
@ -26,11 +26,11 @@ typedef struct rdpsnd_plugin rdpsndPlugin;
|
||||
|
||||
typedef struct rdpsnd_device_plugin rdpsndDevicePlugin;
|
||||
|
||||
typedef boolean (*pcFormatSupported) (rdpsndDevicePlugin* device, rdpsndFormat* format);
|
||||
typedef BOOL (*pcFormatSupported) (rdpsndDevicePlugin* device, rdpsndFormat* format);
|
||||
typedef void (*pcOpen) (rdpsndDevicePlugin* device, rdpsndFormat* format, int latency);
|
||||
typedef void (*pcSetFormat) (rdpsndDevicePlugin* device, rdpsndFormat* format, int latency);
|
||||
typedef void (*pcSetVolume) (rdpsndDevicePlugin* device, uint32 value);
|
||||
typedef void (*pcPlay) (rdpsndDevicePlugin* device, uint8* data, int size);
|
||||
typedef void (*pcSetVolume) (rdpsndDevicePlugin* device, UINT32 value);
|
||||
typedef void (*pcPlay) (rdpsndDevicePlugin* device, BYTE* data, int size);
|
||||
typedef void (*pcStart) (rdpsndDevicePlugin* device);
|
||||
typedef void (*pcClose) (rdpsndDevicePlugin* device);
|
||||
typedef void (*pcFree) (rdpsndDevicePlugin* device);
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -15,15 +15,18 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(MODULE_NAME "rdpsnd")
|
||||
set(MODULE_PREFIX "CHANNEL_RDPSND_SERVER")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
rdpsnd.c
|
||||
PARENT_SCOPE)
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
if(MONOLITHIC_BUILD)
|
||||
set(${MODULE_PREFIX}_LIBS freerdp PARENT_SCOPE)
|
||||
else()
|
||||
set(${MODULE_PREFIX}_LIBS freerdp-utils PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Server")
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Server Audio Virtual Channel
|
||||
*
|
||||
* Copyright 2012 Vic Lee
|
||||
@ -42,61 +42,64 @@ typedef struct _rdpsnd_server
|
||||
STREAM* rdpsnd_pdu;
|
||||
|
||||
FREERDP_DSP_CONTEXT* dsp_context;
|
||||
uint8* out_buffer;
|
||||
BYTE* out_buffer;
|
||||
int out_buffer_size;
|
||||
int out_frames;
|
||||
int out_pending_frames;
|
||||
|
||||
uint32 src_bytes_per_sample;
|
||||
uint32 src_bytes_per_frame;
|
||||
UINT32 src_bytes_per_sample;
|
||||
UINT32 src_bytes_per_frame;
|
||||
} rdpsnd_server;
|
||||
|
||||
#define RDPSND_PDU_INIT(_s, _msgType) \
|
||||
{ \
|
||||
stream_write_uint8(_s, _msgType); \
|
||||
stream_write_uint8(_s, 0); \
|
||||
stream_seek_uint16(_s); \
|
||||
stream_write_BYTE(_s, _msgType); \
|
||||
stream_write_BYTE(_s, 0); \
|
||||
stream_seek_UINT16(_s); \
|
||||
}
|
||||
|
||||
#define RDPSND_PDU_FINISH(_s) \
|
||||
{ \
|
||||
boolean _r; \
|
||||
BOOL _r; \
|
||||
int _pos; \
|
||||
_pos = stream_get_pos(_s); \
|
||||
stream_set_pos(_s, 2); \
|
||||
stream_write_uint16(_s, _pos - 4); \
|
||||
stream_write_UINT16(_s, _pos - 4); \
|
||||
stream_set_pos(_s, _pos); \
|
||||
_r = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(_s), stream_get_length(_s), NULL); \
|
||||
stream_set_pos(_s, 0); \
|
||||
return _r; \
|
||||
}
|
||||
|
||||
static boolean rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
||||
static BOOL rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
||||
{
|
||||
uint16 i;
|
||||
UINT16 i;
|
||||
|
||||
RDPSND_PDU_INIT(s, SNDC_FORMATS);
|
||||
|
||||
stream_write_uint32(s, 0); /* dwFlags */
|
||||
stream_write_uint32(s, 0); /* dwVolume */
|
||||
stream_write_uint32(s, 0); /* dwPitch */
|
||||
stream_write_uint16(s, 0); /* wDGramPort */
|
||||
stream_write_uint16(s, rdpsnd->context.num_server_formats); /* wNumberOfFormats */
|
||||
stream_write_uint8(s, rdpsnd->context.block_no); /* cLastBlockConfirmed */
|
||||
stream_write_uint16(s, 0x06); /* wVersion */
|
||||
stream_write_uint8(s, 0); /* bPad */
|
||||
stream_write_UINT32(s, 0); /* dwFlags */
|
||||
stream_write_UINT32(s, 0); /* dwVolume */
|
||||
stream_write_UINT32(s, 0); /* dwPitch */
|
||||
stream_write_UINT16(s, 0); /* wDGramPort */
|
||||
stream_write_UINT16(s, rdpsnd->context.num_server_formats); /* wNumberOfFormats */
|
||||
stream_write_BYTE(s, rdpsnd->context.block_no); /* cLastBlockConfirmed */
|
||||
stream_write_UINT16(s, 0x06); /* wVersion */
|
||||
stream_write_BYTE(s, 0); /* bPad */
|
||||
|
||||
for (i = 0; i < rdpsnd->context.num_server_formats; i++)
|
||||
{
|
||||
stream_write_uint16(s, rdpsnd->context.server_formats[i].wFormatTag); /* wFormatTag (WAVE_FORMAT_PCM) */
|
||||
stream_write_uint16(s, rdpsnd->context.server_formats[i].nChannels); /* nChannels */
|
||||
stream_write_uint32(s, rdpsnd->context.server_formats[i].nSamplesPerSec); /* nSamplesPerSec */
|
||||
stream_write_uint32(s, rdpsnd->context.server_formats[i].nSamplesPerSec *
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].wFormatTag); /* wFormatTag (WAVE_FORMAT_PCM) */
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].nChannels); /* nChannels */
|
||||
stream_write_UINT32(s, rdpsnd->context.server_formats[i].nSamplesPerSec); /* nSamplesPerSec */
|
||||
|
||||
stream_write_UINT32(s, rdpsnd->context.server_formats[i].nSamplesPerSec *
|
||||
rdpsnd->context.server_formats[i].nChannels *
|
||||
rdpsnd->context.server_formats[i].wBitsPerSample / 8); /* nAvgBytesPerSec */
|
||||
stream_write_uint16(s, rdpsnd->context.server_formats[i].nBlockAlign); /* nBlockAlign */
|
||||
stream_write_uint16(s, rdpsnd->context.server_formats[i].wBitsPerSample); /* wBitsPerSample */
|
||||
stream_write_uint16(s, rdpsnd->context.server_formats[i].cbSize); /* cbSize */
|
||||
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].nBlockAlign); /* nBlockAlign */
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].wBitsPerSample); /* wBitsPerSample */
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].cbSize); /* cbSize */
|
||||
|
||||
if (rdpsnd->context.server_formats[i].cbSize > 0)
|
||||
{
|
||||
stream_write(s, rdpsnd->context.server_formats[i].data, rdpsnd->context.server_formats[i].cbSize);
|
||||
@ -106,21 +109,21 @@ static boolean rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
||||
RDPSND_PDU_FINISH(s);
|
||||
}
|
||||
|
||||
static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
||||
static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (stream_get_left(s) < 20)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
stream_seek_uint32(s); /* dwFlags */
|
||||
stream_seek_uint32(s); /* dwVolume */
|
||||
stream_seek_uint32(s); /* dwPitch */
|
||||
stream_seek_uint16(s); /* wDGramPort */
|
||||
stream_read_uint16(s, rdpsnd->context.num_client_formats); /* wNumberOfFormats */
|
||||
stream_seek_uint8(s); /* cLastBlockConfirmed */
|
||||
stream_seek_uint16(s); /* wVersion */
|
||||
stream_seek_uint8(s); /* bPad */
|
||||
stream_seek_UINT32(s); /* dwFlags */
|
||||
stream_seek_UINT32(s); /* dwVolume */
|
||||
stream_seek_UINT32(s); /* dwPitch */
|
||||
stream_seek_UINT16(s); /* wDGramPort */
|
||||
stream_read_UINT16(s, rdpsnd->context.num_client_formats); /* wNumberOfFormats */
|
||||
stream_seek_BYTE(s); /* cLastBlockConfirmed */
|
||||
stream_seek_UINT16(s); /* wVersion */
|
||||
stream_seek_BYTE(s); /* bPad */
|
||||
|
||||
if (rdpsnd->context.num_client_formats > 0)
|
||||
{
|
||||
@ -130,18 +133,18 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
||||
{
|
||||
if (stream_get_left(s) < 18)
|
||||
{
|
||||
xfree(rdpsnd->context.client_formats);
|
||||
free(rdpsnd->context.client_formats);
|
||||
rdpsnd->context.client_formats = NULL;
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_uint16(s, rdpsnd->context.client_formats[i].wFormatTag);
|
||||
stream_read_uint16(s, rdpsnd->context.client_formats[i].nChannels);
|
||||
stream_read_uint32(s, rdpsnd->context.client_formats[i].nSamplesPerSec);
|
||||
stream_seek_uint32(s); /* nAvgBytesPerSec */
|
||||
stream_read_uint16(s, rdpsnd->context.client_formats[i].nBlockAlign);
|
||||
stream_read_uint16(s, rdpsnd->context.client_formats[i].wBitsPerSample);
|
||||
stream_read_uint16(s, rdpsnd->context.client_formats[i].cbSize);
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].wFormatTag);
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].nChannels);
|
||||
stream_read_UINT32(s, rdpsnd->context.client_formats[i].nSamplesPerSec);
|
||||
stream_seek_UINT32(s); /* nAvgBytesPerSec */
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].nBlockAlign);
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].wBitsPerSample);
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].cbSize);
|
||||
|
||||
if (rdpsnd->context.client_formats[i].cbSize > 0)
|
||||
{
|
||||
@ -150,7 +153,7 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void* rdpsnd_server_thread_func(void* arg)
|
||||
@ -158,13 +161,13 @@ static void* rdpsnd_server_thread_func(void* arg)
|
||||
void* fd;
|
||||
STREAM* s;
|
||||
void* buffer;
|
||||
uint8 msgType;
|
||||
uint16 BodySize;
|
||||
uint32 bytes_returned = 0;
|
||||
BYTE msgType;
|
||||
UINT16 BodySize;
|
||||
UINT32 bytes_returned = 0;
|
||||
rdpsnd_server* rdpsnd = (rdpsnd_server*) arg;
|
||||
freerdp_thread* thread = rdpsnd->rdpsnd_channel_thread;
|
||||
|
||||
if (WTSVirtualChannelQuery(rdpsnd->rdpsnd_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == true)
|
||||
if (WTSVirtualChannelQuery(rdpsnd->rdpsnd_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE)
|
||||
{
|
||||
fd = *((void**)buffer);
|
||||
WTSFreeMemory(buffer);
|
||||
@ -185,7 +188,7 @@ static void* rdpsnd_server_thread_func(void* arg)
|
||||
stream_set_pos(s, 0);
|
||||
|
||||
if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s),
|
||||
stream_get_size(s), &bytes_returned) == false)
|
||||
stream_get_size(s), &bytes_returned) == FALSE)
|
||||
{
|
||||
if (bytes_returned == 0)
|
||||
break;
|
||||
@ -193,13 +196,13 @@ static void* rdpsnd_server_thread_func(void* arg)
|
||||
stream_check_size(s, (int) bytes_returned);
|
||||
|
||||
if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s),
|
||||
stream_get_size(s), &bytes_returned) == false)
|
||||
stream_get_size(s), &bytes_returned) == FALSE)
|
||||
break;
|
||||
}
|
||||
|
||||
stream_read_uint8(s, msgType);
|
||||
stream_seek_uint8(s); /* bPad */
|
||||
stream_read_uint16(s, BodySize);
|
||||
stream_read_BYTE(s, msgType);
|
||||
stream_seek_BYTE(s); /* bPad */
|
||||
stream_read_UINT16(s, BodySize);
|
||||
|
||||
if (BodySize + 4 > (int) bytes_returned)
|
||||
continue;
|
||||
@ -223,7 +226,7 @@ static void* rdpsnd_server_thread_func(void* arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static boolean rdpsnd_server_initialize(rdpsnd_server_context* context)
|
||||
static BOOL rdpsnd_server_initialize(rdpsnd_server_context* context)
|
||||
{
|
||||
rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
|
||||
|
||||
@ -235,11 +238,11 @@ static boolean rdpsnd_server_initialize(rdpsnd_server_context* context)
|
||||
rdpsnd->rdpsnd_channel_thread = freerdp_thread_new();
|
||||
freerdp_thread_start(rdpsnd->rdpsnd_channel_thread, rdpsnd_server_thread_func, rdpsnd);
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,28 +290,29 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie
|
||||
|
||||
if (rdpsnd->out_buffer_size < out_buffer_size)
|
||||
{
|
||||
rdpsnd->out_buffer = xrealloc(rdpsnd->out_buffer, out_buffer_size);
|
||||
rdpsnd->out_buffer = realloc(rdpsnd->out_buffer, out_buffer_size);
|
||||
rdpsnd->out_buffer_size = out_buffer_size;
|
||||
}
|
||||
|
||||
freerdp_dsp_context_reset_adpcm(rdpsnd->dsp_context);
|
||||
}
|
||||
|
||||
static boolean rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd)
|
||||
static BOOL rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd)
|
||||
{
|
||||
STREAM* s = rdpsnd->rdpsnd_pdu;
|
||||
rdpsndFormat* format;
|
||||
int tbytes_per_frame;
|
||||
uint8* src;
|
||||
int size;
|
||||
BOOL r;
|
||||
BYTE* src;
|
||||
int frames;
|
||||
int fill_size;
|
||||
boolean r;
|
||||
rdpsndFormat* format;
|
||||
int tbytes_per_frame;
|
||||
STREAM* s = rdpsnd->rdpsnd_pdu;
|
||||
|
||||
format = &rdpsnd->context.client_formats[rdpsnd->context.selected_client_format];
|
||||
tbytes_per_frame = format->nChannels * rdpsnd->src_bytes_per_sample;
|
||||
|
||||
if (format->nSamplesPerSec == rdpsnd->context.src_format.nSamplesPerSec && format->nChannels == rdpsnd->context.src_format.nChannels)
|
||||
if ((format->nSamplesPerSec == rdpsnd->context.src_format.nSamplesPerSec) &&
|
||||
(format->nChannels == rdpsnd->context.src_format.nChannels))
|
||||
{
|
||||
src = rdpsnd->out_buffer;
|
||||
frames = rdpsnd->out_pending_frames;
|
||||
@ -349,13 +353,13 @@ static boolean rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd)
|
||||
|
||||
/* WaveInfo PDU */
|
||||
stream_set_pos(s, 0);
|
||||
stream_write_uint8(s, SNDC_WAVE); /* msgType */
|
||||
stream_write_uint8(s, 0); /* bPad */
|
||||
stream_write_uint16(s, size + fill_size + 8); /* BodySize */
|
||||
stream_write_BYTE(s, SNDC_WAVE); /* msgType */
|
||||
stream_write_BYTE(s, 0); /* bPad */
|
||||
stream_write_UINT16(s, size + fill_size + 8); /* BodySize */
|
||||
|
||||
stream_write_uint16(s, 0); /* wTimeStamp */
|
||||
stream_write_uint16(s, rdpsnd->context.selected_client_format); /* wFormatNo */
|
||||
stream_write_uint8(s, rdpsnd->context.block_no); /* cBlockNo */
|
||||
stream_write_UINT16(s, 0); /* wTimeStamp */
|
||||
stream_write_UINT16(s, rdpsnd->context.selected_client_format); /* wFormatNo */
|
||||
stream_write_BYTE(s, rdpsnd->context.block_no); /* cBlockNo */
|
||||
stream_seek(s, 3); /* bPad */
|
||||
stream_write(s, src, 4);
|
||||
|
||||
@ -364,8 +368,9 @@ static boolean rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd)
|
||||
|
||||
/* Wave PDU */
|
||||
stream_check_size(s, size + fill_size);
|
||||
stream_write_uint32(s, 0); /* bPad */
|
||||
stream_write_UINT32(s, 0); /* bPad */
|
||||
stream_write(s, src + 4, size - 4);
|
||||
|
||||
if (fill_size > 0)
|
||||
stream_write_zero(s, fill_size);
|
||||
|
||||
@ -377,60 +382,60 @@ static boolean rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd)
|
||||
return r;
|
||||
}
|
||||
|
||||
static boolean rdpsnd_server_send_samples(rdpsnd_server_context* context, const void* buf, int nframes)
|
||||
static BOOL rdpsnd_server_send_samples(rdpsnd_server_context* context, const void* buf, int nframes)
|
||||
{
|
||||
int cframes;
|
||||
int cframesize;
|
||||
rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
|
||||
|
||||
if (rdpsnd->context.selected_client_format < 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
while (nframes > 0)
|
||||
{
|
||||
cframes = MIN(nframes, rdpsnd->out_frames - rdpsnd->out_pending_frames);
|
||||
cframesize = cframes * rdpsnd->src_bytes_per_frame;
|
||||
memcpy(rdpsnd->out_buffer + (rdpsnd->out_pending_frames * rdpsnd->src_bytes_per_frame),
|
||||
buf, cframesize);
|
||||
buf = (uint8*)buf + cframesize;
|
||||
|
||||
memcpy(rdpsnd->out_buffer + (rdpsnd->out_pending_frames * rdpsnd->src_bytes_per_frame), buf, cframesize);
|
||||
buf = (BYTE*) buf + cframesize;
|
||||
nframes -= cframes;
|
||||
rdpsnd->out_pending_frames += cframes;
|
||||
|
||||
if (rdpsnd->out_pending_frames >= rdpsnd->out_frames)
|
||||
{
|
||||
if (!rdpsnd_server_send_audio_pdu(rdpsnd))
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static boolean rdpsnd_server_set_volume(rdpsnd_server_context* context, int left, int right)
|
||||
static BOOL rdpsnd_server_set_volume(rdpsnd_server_context* context, int left, int right)
|
||||
{
|
||||
rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
|
||||
STREAM* s = rdpsnd->rdpsnd_pdu;
|
||||
|
||||
RDPSND_PDU_INIT(s, SNDC_SETVOLUME);
|
||||
|
||||
stream_write_uint16(s, left);
|
||||
stream_write_uint16(s, right);
|
||||
stream_write_UINT16(s, left);
|
||||
stream_write_UINT16(s, right);
|
||||
|
||||
RDPSND_PDU_FINISH(s);
|
||||
}
|
||||
|
||||
static boolean rdpsnd_server_close(rdpsnd_server_context* context)
|
||||
static BOOL rdpsnd_server_close(rdpsnd_server_context* context)
|
||||
{
|
||||
rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
|
||||
STREAM* s = rdpsnd->rdpsnd_pdu;
|
||||
|
||||
if (rdpsnd->context.selected_client_format < 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
if (rdpsnd->out_pending_frames > 0)
|
||||
{
|
||||
if (!rdpsnd_server_send_audio_pdu(rdpsnd))
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rdpsnd->context.selected_client_format = -1;
|
||||
@ -466,15 +471,21 @@ void rdpsnd_server_context_free(rdpsnd_server_context* context)
|
||||
freerdp_thread_stop(rdpsnd->rdpsnd_channel_thread);
|
||||
freerdp_thread_free(rdpsnd->rdpsnd_channel_thread);
|
||||
}
|
||||
|
||||
if (rdpsnd->rdpsnd_channel)
|
||||
WTSVirtualChannelClose(rdpsnd->rdpsnd_channel);
|
||||
|
||||
if (rdpsnd->rdpsnd_pdu)
|
||||
stream_free(rdpsnd->rdpsnd_pdu);
|
||||
|
||||
if (rdpsnd->out_buffer)
|
||||
xfree(rdpsnd->out_buffer);
|
||||
free(rdpsnd->out_buffer);
|
||||
|
||||
if (rdpsnd->dsp_context)
|
||||
freerdp_dsp_context_free(rdpsnd->dsp_context);
|
||||
|
||||
if (rdpsnd->context.client_formats)
|
||||
xfree(rdpsnd->context.client_formats);
|
||||
xfree(rdpsnd);
|
||||
free(rdpsnd->context.client_formats);
|
||||
|
||||
free(rdpsnd);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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,17 +15,20 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(SKEL_SRCS
|
||||
set(MODULE_NAME "sample")
|
||||
set(MODULE_PREFIX "CHANNEL_SAMPLE_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
skel_main.c
|
||||
skel_main.h)
|
||||
|
||||
add_library(skel ${SKEL_SRCS})
|
||||
set_target_properties(skel PROPERTIES PREFIX "")
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(skel freerdp)
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp)
|
||||
else()
|
||||
target_link_libraries(skel freerdp-utils)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils)
|
||||
endif()
|
||||
|
||||
install(TARGETS skel DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Output Virtual Channel
|
||||
*
|
||||
* Copyright 2009-2012 Jay Sorg
|
||||
@ -129,7 +129,7 @@ static void skel_process_terminate(rdpSvcPlugin* plugin)
|
||||
|
||||
/* put your cleanup here */
|
||||
|
||||
xfree(plugin);
|
||||
free(plugin);
|
||||
}
|
||||
|
||||
DEFINE_SVC_PLUGIN(skel, "skel",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Output Virtual Channel
|
||||
*
|
||||
* Copyright 2012 Jay Sorg
|
||||
|
21
channels/serial/CMakeLists.txt
Normal file
21
channels/serial/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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()
|
||||
|
14
channels/serial/ChannelOptions.cmake
Normal file
14
channels/serial/ChannelOptions.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
set(CHANNEL_TYPE "device")
|
||||
set(CHANNEL_SHORT_NAME "serial")
|
||||
set(CHANNEL_LONG_NAME "Serial Port Virtual Channel Extension")
|
||||
set(CHANNEL_SPECIFICATIONS "[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()
|
||||
|
@ -1,9 +1,7 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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,21 +15,24 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(serial_SRCS
|
||||
set(MODULE_NAME "serial")
|
||||
set(MODULE_PREFIX "CHANNEL_DEVICE_SERIAL_CLIENT")
|
||||
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
serial_tty.c
|
||||
serial_tty.h
|
||||
serial_constants.h
|
||||
serial_main.c)
|
||||
|
||||
include_directories(..)
|
||||
|
||||
add_library(serial ${serial_SRCS})
|
||||
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
set_target_properties(serial PROPERTIES PREFIX "")
|
||||
|
||||
if(WITH_MONOLITHIC_BUILD)
|
||||
target_link_libraries(serial freerdp)
|
||||
if(MONOLITHIC_BUILD)
|
||||
target_link_libraries(${MODULE_NAME} freerdp)
|
||||
else()
|
||||
target_link_libraries(serial freerdp-utils)
|
||||
target_link_libraries(${MODULE_NAME} freerdp-utils)
|
||||
endif()
|
||||
|
||||
install(TARGETS serial DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client")
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Serial Port Device Service Virtual Channel
|
||||
*
|
||||
* Copyright 2011 O.S. Systems Software Ltda.
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Serial Port Device Service Virtual Channel
|
||||
*
|
||||
* Copyright 2011 O.S. Systems Software Ltda.
|
||||
@ -40,18 +40,18 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "rdpdr_types.h"
|
||||
#include "rdpdr_constants.h"
|
||||
#include "devman.h"
|
||||
#include "serial_tty.h"
|
||||
#include "serial_constants.h"
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/thread.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/wait_obj.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
typedef struct _SERIAL_DEVICE SERIAL_DEVICE;
|
||||
|
||||
struct _SERIAL_DEVICE
|
||||
{
|
||||
DEVICE device;
|
||||
@ -66,27 +66,27 @@ struct _SERIAL_DEVICE
|
||||
|
||||
fd_set read_fds;
|
||||
fd_set write_fds;
|
||||
uint32 nfds;
|
||||
UINT32 nfds;
|
||||
struct timeval tv;
|
||||
uint32 select_timeout;
|
||||
uint32 timeout_id;
|
||||
UINT32 select_timeout;
|
||||
UINT32 timeout_id;
|
||||
};
|
||||
|
||||
static void serial_abort_single_io(SERIAL_DEVICE* serial, uint32 file_id, uint32 abort_io, uint32 io_status);
|
||||
static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32 abort_io, UINT32 io_status);
|
||||
static void serial_check_for_events(SERIAL_DEVICE* serial);
|
||||
static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp);
|
||||
static boolean serial_check_fds(SERIAL_DEVICE* serial);
|
||||
static BOOL 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;
|
||||
UINT32 PathLength;
|
||||
UINT32 FileId;
|
||||
|
||||
stream_seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */
|
||||
/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
|
||||
stream_read_uint32(irp->input, PathLength);
|
||||
stream_read_UINT32(irp->input, PathLength);
|
||||
|
||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
|
||||
|
||||
@ -107,10 +107,10 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
|
||||
DEBUG_SVC("%s(%d) created.", serial->path, FileId);
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, FileId);
|
||||
stream_write_uint8(irp->output, 0);
|
||||
stream_write_UINT32(irp->output, FileId);
|
||||
stream_write_BYTE(irp->output, 0);
|
||||
|
||||
xfree(path);
|
||||
free(path);
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -142,12 +142,12 @@ static void serial_process_irp_close(SERIAL_DEVICE* serial, IRP* irp)
|
||||
static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
|
||||
{
|
||||
SERIAL_TTY* tty;
|
||||
uint32 Length;
|
||||
uint64 Offset;
|
||||
uint8* buffer = NULL;
|
||||
UINT32 Length;
|
||||
UINT64 Offset;
|
||||
BYTE* buffer = NULL;
|
||||
|
||||
stream_read_uint32(irp->input, Length);
|
||||
stream_read_uint64(irp->input, Offset);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
|
||||
DEBUG_SVC("length %u offset %llu", Length, Offset);
|
||||
|
||||
@ -162,12 +162,12 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = (uint8*) xmalloc(Length);
|
||||
buffer = (BYTE*) malloc(Length);
|
||||
|
||||
if (!serial_tty_read(tty, buffer, &Length))
|
||||
{
|
||||
irp->IoStatus = STATUS_UNSUCCESSFUL;
|
||||
xfree(buffer);
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
Length = 0;
|
||||
|
||||
@ -179,7 +179,7 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
|
||||
}
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, Length);
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
|
||||
if (Length > 0)
|
||||
{
|
||||
@ -187,7 +187,7 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
|
||||
stream_write(irp->output, buffer, Length);
|
||||
}
|
||||
|
||||
xfree(buffer);
|
||||
free(buffer);
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -195,11 +195,11 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
|
||||
static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp)
|
||||
{
|
||||
SERIAL_TTY* tty;
|
||||
uint32 Length;
|
||||
uint64 Offset;
|
||||
UINT32 Length;
|
||||
UINT64 Offset;
|
||||
|
||||
stream_read_uint32(irp->input, Length);
|
||||
stream_read_uint64(irp->input, Offset);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
stream_seek(irp->input, 20); /* Padding */
|
||||
|
||||
DEBUG_SVC("length %u offset %llu", Length, Offset);
|
||||
@ -225,8 +225,8 @@ static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp)
|
||||
DEBUG_SVC("write %llu-%llu to %s(%d).", Offset, Offset + Length, serial->path, tty->id);
|
||||
}
|
||||
|
||||
stream_write_uint32(irp->output, Length);
|
||||
stream_write_uint8(irp->output, 0); /* Padding */
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
stream_write_BYTE(irp->output, 0); /* Padding */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -234,16 +234,16 @@ static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp)
|
||||
static void serial_process_irp_device_control(SERIAL_DEVICE* serial, IRP* irp)
|
||||
{
|
||||
SERIAL_TTY* tty;
|
||||
uint32 IoControlCode;
|
||||
uint32 InputBufferLength;
|
||||
uint32 OutputBufferLength;
|
||||
uint32 abort_io = SERIAL_ABORT_IO_NONE;
|
||||
UINT32 IoControlCode;
|
||||
UINT32 InputBufferLength;
|
||||
UINT32 OutputBufferLength;
|
||||
UINT32 abort_io = SERIAL_ABORT_IO_NONE;
|
||||
|
||||
DEBUG_SVC("[in] pending size %d", list_size(serial->pending_irps));
|
||||
|
||||
stream_read_uint32(irp->input, InputBufferLength);
|
||||
stream_read_uint32(irp->input, OutputBufferLength);
|
||||
stream_read_uint32(irp->input, IoControlCode);
|
||||
stream_read_UINT32(irp->input, InputBufferLength);
|
||||
stream_read_UINT32(irp->input, OutputBufferLength);
|
||||
stream_read_UINT32(irp->input, IoControlCode);
|
||||
stream_seek(irp->input, 20); /* Padding */
|
||||
|
||||
tty = serial->tty;
|
||||
@ -394,7 +394,7 @@ static void serial_free(DEVICE* device)
|
||||
|
||||
list_free(serial->pending_irps);
|
||||
|
||||
xfree(serial);
|
||||
free(serial);
|
||||
}
|
||||
|
||||
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
@ -420,7 +420,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
serial->device.data = stream_new(len + 1);
|
||||
|
||||
for (i = 0; i <= len; i++)
|
||||
stream_write_uint8(serial->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
stream_write_BYTE(serial->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
|
||||
serial->path = path;
|
||||
serial->irp_list = list_new();
|
||||
@ -436,10 +436,10 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void serial_abort_single_io(SERIAL_DEVICE* serial, uint32 file_id, uint32 abort_io, uint32 io_status)
|
||||
static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32 abort_io, UINT32 io_status)
|
||||
{
|
||||
IRP* irp = NULL;
|
||||
uint32 major;
|
||||
UINT32 major;
|
||||
SERIAL_TTY* tty;
|
||||
|
||||
DEBUG_SVC("[in] pending size %d", list_size(serial->pending_irps));
|
||||
@ -478,7 +478,7 @@ static void serial_abort_single_io(SERIAL_DEVICE* serial, uint32 file_id, uint32
|
||||
/* Process a SINGLE FileId and MajorFunction */
|
||||
list_remove(serial->pending_irps, irp);
|
||||
irp->IoStatus = io_status;
|
||||
stream_write_uint32(irp->output, 0);
|
||||
stream_write_UINT32(irp->output, 0);
|
||||
irp->Complete(irp);
|
||||
|
||||
wait_obj_set(serial->in_event);
|
||||
@ -492,7 +492,7 @@ static void serial_check_for_events(SERIAL_DEVICE* serial)
|
||||
{
|
||||
IRP* irp = NULL;
|
||||
IRP* prev;
|
||||
uint32 result = 0;
|
||||
UINT32 result = 0;
|
||||
SERIAL_TTY* tty;
|
||||
|
||||
tty = serial->tty;
|
||||
@ -512,7 +512,7 @@ static void serial_check_for_events(SERIAL_DEVICE* serial)
|
||||
DEBUG_SVC("got event result %u", result);
|
||||
|
||||
irp->IoStatus = STATUS_SUCCESS;
|
||||
stream_write_uint32(irp->output, result);
|
||||
stream_write_UINT32(irp->output, result);
|
||||
irp->Complete(irp);
|
||||
|
||||
prev = irp;
|
||||
@ -530,14 +530,14 @@ static void serial_check_for_events(SERIAL_DEVICE* serial)
|
||||
DEBUG_SVC("[out] pending size %d", list_size(serial->pending_irps));
|
||||
}
|
||||
|
||||
void serial_get_timeouts(SERIAL_DEVICE* serial, IRP* irp, uint32* timeout, uint32* interval_timeout)
|
||||
void serial_get_timeouts(SERIAL_DEVICE* serial, IRP* irp, UINT32* timeout, UINT32* interval_timeout)
|
||||
{
|
||||
SERIAL_TTY* tty;
|
||||
uint32 Length;
|
||||
uint32 pos;
|
||||
UINT32 Length;
|
||||
UINT32 pos;
|
||||
|
||||
pos = stream_get_pos(irp->input);
|
||||
stream_read_uint32(irp->input, Length);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_set_pos(irp->input, pos);
|
||||
|
||||
DEBUG_SVC("length read %u", Length);
|
||||
@ -552,8 +552,8 @@ void serial_get_timeouts(SERIAL_DEVICE* serial, IRP* irp, uint32* timeout, uint3
|
||||
|
||||
static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp)
|
||||
{
|
||||
uint32 timeout = 0;
|
||||
uint32 itv_timeout = 0;
|
||||
UINT32 timeout = 0;
|
||||
UINT32 itv_timeout = 0;
|
||||
SERIAL_TTY* tty;
|
||||
|
||||
tty = serial->tty;
|
||||
@ -603,7 +603,7 @@ static void __serial_check_fds(SERIAL_DEVICE* serial)
|
||||
IRP* irp;
|
||||
IRP* prev;
|
||||
SERIAL_TTY* tty;
|
||||
uint32 result = 0;
|
||||
UINT32 result = 0;
|
||||
|
||||
memset(&serial->tv, 0, sizeof(struct timeval));
|
||||
tty = serial->tty;
|
||||
@ -639,7 +639,7 @@ static void __serial_check_fds(SERIAL_DEVICE* serial)
|
||||
DEBUG_SVC("got event result %u", result);
|
||||
|
||||
irp->IoStatus = STATUS_SUCCESS;
|
||||
stream_write_uint32(irp->output, result);
|
||||
stream_write_UINT32(irp->output, result);
|
||||
irp->Complete(irp);
|
||||
}
|
||||
break;
|
||||
@ -696,7 +696,7 @@ static void serial_set_fds(SERIAL_DEVICE* serial)
|
||||
}
|
||||
}
|
||||
|
||||
static boolean serial_check_fds(SERIAL_DEVICE* serial)
|
||||
static BOOL serial_check_fds(SERIAL_DEVICE* serial)
|
||||
{
|
||||
if (list_size(serial->pending_irps) == 0)
|
||||
return 1;
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Serial Port Device Service Virtual Channel
|
||||
*
|
||||
* Copyright 2011 O.S. Systems Software Ltda.
|
||||
@ -33,6 +33,7 @@
|
||||
#include <freerdp/utils/thread.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/utils/hexdump.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
@ -46,8 +47,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "rdpdr_constants.h"
|
||||
#include "rdpdr_types.h"
|
||||
#include "serial_tty.h"
|
||||
#include "serial_constants.h"
|
||||
|
||||
@ -74,49 +73,49 @@
|
||||
#define TIOCOUTQ FIONWRITE
|
||||
#endif
|
||||
|
||||
static uint32 tty_write_data(SERIAL_TTY* tty, uint8* data, int len);
|
||||
static UINT32 tty_write_data(SERIAL_TTY* tty, BYTE* data, int len);
|
||||
static void tty_set_termios(SERIAL_TTY* tty);
|
||||
static boolean tty_get_termios(SERIAL_TTY* tty);
|
||||
static BOOL tty_get_termios(SERIAL_TTY* tty);
|
||||
static int tty_get_error_status();
|
||||
|
||||
uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, STREAM* output, uint32* abort_io)
|
||||
UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, STREAM* input, STREAM* output, UINT32* abort_io)
|
||||
{
|
||||
int purge_mask;
|
||||
uint32 result;
|
||||
uint32 modemstate;
|
||||
uint8 immediate;
|
||||
uint32 ret = STATUS_SUCCESS;
|
||||
uint32 length = 0;
|
||||
uint32 pos;
|
||||
UINT32 result;
|
||||
UINT32 modemstate;
|
||||
BYTE immediate;
|
||||
UINT32 ret = STATUS_SUCCESS;
|
||||
UINT32 length = 0;
|
||||
UINT32 pos;
|
||||
|
||||
DEBUG_SVC("in");
|
||||
|
||||
stream_seek(output, sizeof(uint32));
|
||||
stream_seek(output, sizeof(UINT32));
|
||||
|
||||
switch (IoControlCode)
|
||||
{
|
||||
case IOCTL_SERIAL_SET_BAUD_RATE:
|
||||
stream_read_uint32(input, tty->baud_rate);
|
||||
stream_read_UINT32(input, tty->baud_rate);
|
||||
tty_set_termios(tty);
|
||||
DEBUG_SVC("SERIAL_SET_BAUD_RATE %d", tty->baud_rate);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_GET_BAUD_RATE:
|
||||
length = 4;
|
||||
stream_write_uint32(output, tty->baud_rate);
|
||||
stream_write_UINT32(output, tty->baud_rate);
|
||||
DEBUG_SVC("SERIAL_GET_BAUD_RATE %d", tty->baud_rate);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_QUEUE_SIZE:
|
||||
stream_read_uint32(input, tty->queue_in_size);
|
||||
stream_read_uint32(input, tty->queue_out_size);
|
||||
stream_read_UINT32(input, tty->queue_in_size);
|
||||
stream_read_UINT32(input, tty->queue_out_size);
|
||||
DEBUG_SVC("SERIAL_SET_QUEUE_SIZE in %d out %d", tty->queue_in_size, tty->queue_out_size);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_LINE_CONTROL:
|
||||
stream_read_uint8(input, tty->stop_bits);
|
||||
stream_read_uint8(input, tty->parity);
|
||||
stream_read_uint8(input, tty->word_length);
|
||||
stream_read_BYTE(input, tty->stop_bits);
|
||||
stream_read_BYTE(input, tty->parity);
|
||||
stream_read_BYTE(input, tty->word_length);
|
||||
tty_set_termios(tty);
|
||||
DEBUG_SVC("SERIAL_SET_LINE_CONTROL stop %d parity %d word %d",
|
||||
tty->stop_bits, tty->parity, tty->word_length);
|
||||
@ -125,21 +124,21 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input,
|
||||
case IOCTL_SERIAL_GET_LINE_CONTROL:
|
||||
DEBUG_SVC("SERIAL_GET_LINE_CONTROL");
|
||||
length = 3;
|
||||
stream_write_uint8(output, tty->stop_bits);
|
||||
stream_write_uint8(output, tty->parity);
|
||||
stream_write_uint8(output, tty->word_length);
|
||||
stream_write_BYTE(output, tty->stop_bits);
|
||||
stream_write_BYTE(output, tty->parity);
|
||||
stream_write_BYTE(output, tty->word_length);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_IMMEDIATE_CHAR:
|
||||
DEBUG_SVC("SERIAL_IMMEDIATE_CHAR");
|
||||
stream_read_uint8(input, immediate);
|
||||
stream_read_BYTE(input, immediate);
|
||||
tty_write_data(tty, &immediate, 1);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_CONFIG_SIZE:
|
||||
DEBUG_SVC("SERIAL_CONFIG_SIZE");
|
||||
length = 4;
|
||||
stream_write_uint32(output, 0);
|
||||
stream_write_UINT32(output, 0);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_GET_CHARS:
|
||||
@ -157,30 +156,30 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input,
|
||||
case IOCTL_SERIAL_GET_HANDFLOW:
|
||||
length = 16;
|
||||
tty_get_termios(tty);
|
||||
stream_write_uint32(output, tty->control);
|
||||
stream_write_uint32(output, tty->xonoff);
|
||||
stream_write_uint32(output, tty->onlimit);
|
||||
stream_write_uint32(output, tty->offlimit);
|
||||
stream_write_UINT32(output, tty->control);
|
||||
stream_write_UINT32(output, tty->xonoff);
|
||||
stream_write_UINT32(output, tty->onlimit);
|
||||
stream_write_UINT32(output, tty->offlimit);
|
||||
DEBUG_SVC("IOCTL_SERIAL_GET_HANDFLOW %X %X %X %X",
|
||||
tty->control, tty->xonoff, tty->onlimit, tty->offlimit);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_HANDFLOW:
|
||||
stream_read_uint32(input, tty->control);
|
||||
stream_read_uint32(input, tty->xonoff);
|
||||
stream_read_uint32(input, tty->onlimit);
|
||||
stream_read_uint32(input, tty->offlimit);
|
||||
stream_read_UINT32(input, tty->control);
|
||||
stream_read_UINT32(input, tty->xonoff);
|
||||
stream_read_UINT32(input, tty->onlimit);
|
||||
stream_read_UINT32(input, tty->offlimit);
|
||||
DEBUG_SVC("IOCTL_SERIAL_SET_HANDFLOW %X %X %X %X",
|
||||
tty->control, tty->xonoff, tty->onlimit, tty->offlimit);
|
||||
tty_set_termios(tty);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_TIMEOUTS:
|
||||
stream_read_uint32(input, tty->read_interval_timeout);
|
||||
stream_read_uint32(input, tty->read_total_timeout_multiplier);
|
||||
stream_read_uint32(input, tty->read_total_timeout_constant);
|
||||
stream_read_uint32(input, tty->write_total_timeout_multiplier);
|
||||
stream_read_uint32(input, tty->write_total_timeout_constant);
|
||||
stream_read_UINT32(input, tty->read_interval_timeout);
|
||||
stream_read_UINT32(input, tty->read_total_timeout_multiplier);
|
||||
stream_read_UINT32(input, tty->read_total_timeout_constant);
|
||||
stream_read_UINT32(input, tty->write_total_timeout_multiplier);
|
||||
stream_read_UINT32(input, tty->write_total_timeout_constant);
|
||||
|
||||
/* http://www.codeproject.com/KB/system/chaiyasit_t.aspx, see 'ReadIntervalTimeout' section
|
||||
http://msdn.microsoft.com/en-us/library/ms885171.aspx */
|
||||
@ -202,21 +201,21 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input,
|
||||
tty->read_total_timeout_multiplier,
|
||||
tty->read_total_timeout_constant);
|
||||
length = 20;
|
||||
stream_write_uint32(output, tty->read_interval_timeout);
|
||||
stream_write_uint32(output, tty->read_total_timeout_multiplier);
|
||||
stream_write_uint32(output, tty->read_total_timeout_constant);
|
||||
stream_write_uint32(output, tty->write_total_timeout_multiplier);
|
||||
stream_write_uint32(output, tty->write_total_timeout_constant);
|
||||
stream_write_UINT32(output, tty->read_interval_timeout);
|
||||
stream_write_UINT32(output, tty->read_total_timeout_multiplier);
|
||||
stream_write_UINT32(output, tty->read_total_timeout_constant);
|
||||
stream_write_UINT32(output, tty->write_total_timeout_multiplier);
|
||||
stream_write_UINT32(output, tty->write_total_timeout_constant);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_GET_WAIT_MASK:
|
||||
DEBUG_SVC("SERIAL_GET_WAIT_MASK %X", tty->wait_mask);
|
||||
length = 4;
|
||||
stream_write_uint32(output, tty->wait_mask);
|
||||
stream_write_UINT32(output, tty->wait_mask);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_WAIT_MASK:
|
||||
stream_read_uint32(input, tty->wait_mask);
|
||||
stream_read_UINT32(input, tty->wait_mask);
|
||||
DEBUG_SVC("SERIAL_SET_WAIT_MASK %X", tty->wait_mask);
|
||||
break;
|
||||
|
||||
@ -271,19 +270,19 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input,
|
||||
#endif
|
||||
DEBUG_SVC("SERIAL_GET_MODEMSTATUS %X", modemstate);
|
||||
length = 4;
|
||||
stream_write_uint32(output, modemstate);
|
||||
stream_write_UINT32(output, modemstate);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_GET_COMMSTATUS:
|
||||
length = 18;
|
||||
stream_write_uint32(output, 0); /* Errors */
|
||||
stream_write_uint32(output, 0); /* Hold reasons */
|
||||
stream_write_UINT32(output, 0); /* Errors */
|
||||
stream_write_UINT32(output, 0); /* Hold reasons */
|
||||
|
||||
result = 0;
|
||||
#ifdef TIOCINQ
|
||||
ioctl(tty->fd, TIOCINQ, &result);
|
||||
#endif
|
||||
stream_write_uint32(output, result); /* Amount in in queue */
|
||||
stream_write_UINT32(output, result); /* Amount in in queue */
|
||||
if (result)
|
||||
DEBUG_SVC("SERIAL_GET_COMMSTATUS in queue %d", result);
|
||||
|
||||
@ -291,15 +290,15 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input,
|
||||
#ifdef TIOCOUTQ
|
||||
ioctl(tty->fd, TIOCOUTQ, &result);
|
||||
#endif
|
||||
stream_write_uint32(output, result); /* Amount in out queue */
|
||||
stream_write_UINT32(output, result); /* Amount in out queue */
|
||||
DEBUG_SVC("SERIAL_GET_COMMSTATUS out queue %d", result);
|
||||
|
||||
stream_write_uint8(output, 0); /* EofReceived */
|
||||
stream_write_uint8(output, 0); /* WaitForImmediate */
|
||||
stream_write_BYTE(output, 0); /* EofReceived */
|
||||
stream_write_BYTE(output, 0); /* WaitForImmediate */
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_PURGE:
|
||||
stream_read_uint32(input, purge_mask);
|
||||
stream_read_UINT32(input, purge_mask);
|
||||
DEBUG_SVC("SERIAL_PURGE purge_mask %X", purge_mask);
|
||||
|
||||
/* See http://msdn.microsoft.com/en-us/library/ms901431.aspx
|
||||
@ -328,7 +327,7 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input,
|
||||
if (serial_tty_get_event(tty, &result))
|
||||
{
|
||||
DEBUG_SVC("WAIT end event = %X", result);
|
||||
stream_write_uint32(output, result);
|
||||
stream_write_UINT32(output, result);
|
||||
break;
|
||||
}
|
||||
ret = STATUS_PENDING;
|
||||
@ -364,13 +363,13 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input,
|
||||
/* Write OutputBufferLength */
|
||||
pos = stream_get_pos(output);
|
||||
stream_set_pos(output, 16);
|
||||
stream_write_uint32(output, length);
|
||||
stream_write_UINT32(output, length);
|
||||
stream_set_pos(output, pos);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
boolean serial_tty_read(SERIAL_TTY* tty, uint8* buffer, uint32* Length)
|
||||
BOOL serial_tty_read(SERIAL_TTY* tty, BYTE* buffer, UINT32* Length)
|
||||
{
|
||||
long timeout = 90;
|
||||
struct termios *ptermios;
|
||||
@ -411,18 +410,18 @@ boolean serial_tty_read(SERIAL_TTY* tty, uint8* buffer, uint32* Length)
|
||||
memset(buffer, 0, *Length);
|
||||
r = read(tty->fd, buffer, *Length);
|
||||
if (r < 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
tty->event_txempty = r;
|
||||
*Length = r;
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
boolean serial_tty_write(SERIAL_TTY* tty, uint8* buffer, uint32 Length)
|
||||
BOOL serial_tty_write(SERIAL_TTY* tty, BYTE* buffer, UINT32 Length)
|
||||
{
|
||||
ssize_t r;
|
||||
uint32 event_txempty = Length;
|
||||
UINT32 event_txempty = Length;
|
||||
|
||||
DEBUG_SVC("in");
|
||||
|
||||
@ -430,14 +429,14 @@ boolean serial_tty_write(SERIAL_TTY* tty, uint8* buffer, uint32 Length)
|
||||
{
|
||||
r = write(tty->fd, buffer, Length);
|
||||
if (r < 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
Length -= r;
|
||||
buffer += r;
|
||||
}
|
||||
tty->event_txempty = event_txempty;
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -458,13 +457,13 @@ void serial_tty_free(SERIAL_TTY* tty)
|
||||
close(tty->fd);
|
||||
}
|
||||
|
||||
xfree(tty->ptermios);
|
||||
xfree(tty->pold_termios);
|
||||
xfree(tty);
|
||||
free(tty->ptermios);
|
||||
free(tty->pold_termios);
|
||||
free(tty);
|
||||
}
|
||||
|
||||
|
||||
SERIAL_TTY* serial_tty_new(const char* path, uint32 id)
|
||||
SERIAL_TTY* serial_tty_new(const char* path, UINT32 id)
|
||||
{
|
||||
SERIAL_TTY* tty;
|
||||
|
||||
@ -532,10 +531,10 @@ SERIAL_TTY* serial_tty_new(const char* path, uint32 id)
|
||||
return tty;
|
||||
}
|
||||
|
||||
boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result)
|
||||
BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result)
|
||||
{
|
||||
int bytes;
|
||||
boolean ret = false;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
DEBUG_SVC("in");
|
||||
|
||||
@ -547,7 +546,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result)
|
||||
if (tty->wait_mask == 0)
|
||||
{
|
||||
tty->event_pending = 0;
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ioctl(tty->fd, TIOCINQ, &bytes);
|
||||
@ -563,7 +562,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result)
|
||||
{
|
||||
DEBUG_SVC("SERIAL_EV_RLSD");
|
||||
*result |= SERIAL_EV_RLSD;
|
||||
ret = true;
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@ -572,13 +571,13 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result)
|
||||
{
|
||||
DEBUG_SVC("SERIAL_EV_RXFLAG bytes %d", bytes);
|
||||
*result |= SERIAL_EV_RXFLAG;
|
||||
ret = true;
|
||||
ret = TRUE;
|
||||
}
|
||||
if ((tty->wait_mask & SERIAL_EV_RXCHAR))
|
||||
{
|
||||
DEBUG_SVC("SERIAL_EV_RXCHAR bytes %d", bytes);
|
||||
*result |= SERIAL_EV_RXCHAR;
|
||||
ret = true;
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@ -595,7 +594,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result)
|
||||
{
|
||||
DEBUG_SVC("SERIAL_EV_TXEMPTY");
|
||||
*result |= SERIAL_EV_TXEMPTY;
|
||||
ret = true;
|
||||
ret = TRUE;
|
||||
}
|
||||
tty->event_txempty = bytes;
|
||||
#endif
|
||||
@ -608,7 +607,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result)
|
||||
{
|
||||
DEBUG_SVC("SERIAL_EV_DSR %s", (bytes & TIOCM_DSR) ? "ON" : "OFF");
|
||||
*result |= SERIAL_EV_DSR;
|
||||
ret = true;
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -619,7 +618,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result)
|
||||
{
|
||||
DEBUG_SVC("SERIAL_EV_CTS %s", (bytes & TIOCM_CTS) ? "ON" : "OFF");
|
||||
*result |= SERIAL_EV_CTS;
|
||||
ret = true;
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -629,7 +628,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static boolean tty_get_termios(SERIAL_TTY* tty)
|
||||
static BOOL tty_get_termios(SERIAL_TTY* tty)
|
||||
{
|
||||
speed_t speed;
|
||||
struct termios *ptermios;
|
||||
@ -637,7 +636,7 @@ static boolean tty_get_termios(SERIAL_TTY* tty)
|
||||
|
||||
DEBUG_SVC("tcgetattr? %d", tcgetattr(tty->fd, ptermios) >= 0);
|
||||
if (tcgetattr(tty->fd, ptermios) < 0)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
speed = cfgetispeed(ptermios);
|
||||
switch (speed)
|
||||
@ -777,7 +776,7 @@ static boolean tty_get_termios(SERIAL_TTY* tty)
|
||||
tty->chars[SERIAL_CHAR_BREAK] = ptermios->c_cc[VINTR];
|
||||
tty->chars[SERIAL_CHAR_ERROR] = ptermios->c_cc[VKILL];
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void tty_set_termios(SERIAL_TTY* tty)
|
||||
@ -970,7 +969,7 @@ static void tty_set_termios(SERIAL_TTY* tty)
|
||||
tcsetattr(tty->fd, TCSANOW, ptermios);
|
||||
}
|
||||
|
||||
static uint32 tty_write_data(SERIAL_TTY* tty, uint8* data, int len)
|
||||
static UINT32 tty_write_data(SERIAL_TTY* tty, BYTE* data, int len)
|
||||
{
|
||||
ssize_t r;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol client.
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Serial Port Device Service Virtual Channel
|
||||
*
|
||||
* Copyright 2011 O.S. Systems Software Ltda.
|
||||
@ -28,31 +28,35 @@
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
|
||||
typedef struct _SERIAL_TTY SERIAL_TTY;
|
||||
|
||||
struct _SERIAL_TTY
|
||||
{
|
||||
uint32 id;
|
||||
UINT32 id;
|
||||
int fd;
|
||||
|
||||
int dtr;
|
||||
int rts;
|
||||
uint32 control;
|
||||
uint32 xonoff;
|
||||
uint32 onlimit;
|
||||
uint32 offlimit;
|
||||
uint32 baud_rate;
|
||||
uint32 queue_in_size;
|
||||
uint32 queue_out_size;
|
||||
uint32 wait_mask;
|
||||
uint32 read_interval_timeout;
|
||||
uint32 read_total_timeout_multiplier;
|
||||
uint32 read_total_timeout_constant;
|
||||
uint32 write_total_timeout_multiplier;
|
||||
uint32 write_total_timeout_constant;
|
||||
uint8 stop_bits;
|
||||
uint8 parity;
|
||||
uint8 word_length;
|
||||
uint8 chars[6];
|
||||
UINT32 control;
|
||||
UINT32 xonoff;
|
||||
UINT32 onlimit;
|
||||
UINT32 offlimit;
|
||||
UINT32 baud_rate;
|
||||
UINT32 queue_in_size;
|
||||
UINT32 queue_out_size;
|
||||
UINT32 wait_mask;
|
||||
UINT32 read_interval_timeout;
|
||||
UINT32 read_total_timeout_multiplier;
|
||||
UINT32 read_total_timeout_constant;
|
||||
UINT32 write_total_timeout_multiplier;
|
||||
UINT32 write_total_timeout_constant;
|
||||
BYTE stop_bits;
|
||||
BYTE parity;
|
||||
BYTE word_length;
|
||||
BYTE chars[6];
|
||||
struct termios* ptermios;
|
||||
struct termios* pold_termios;
|
||||
int event_txempty;
|
||||
@ -62,13 +66,13 @@ struct _SERIAL_TTY
|
||||
int event_pending;
|
||||
};
|
||||
|
||||
SERIAL_TTY* serial_tty_new(const char* path, uint32 id);
|
||||
SERIAL_TTY* serial_tty_new(const char* path, UINT32 id);
|
||||
void serial_tty_free(SERIAL_TTY* tty);
|
||||
|
||||
boolean serial_tty_read(SERIAL_TTY* tty, uint8* buffer, uint32* Length);
|
||||
boolean serial_tty_write(SERIAL_TTY* tty, uint8* buffer, uint32 Length);
|
||||
uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, STREAM* output, uint32* abort_io);
|
||||
BOOL serial_tty_read(SERIAL_TTY* tty, BYTE* buffer, UINT32* Length);
|
||||
BOOL serial_tty_write(SERIAL_TTY* tty, BYTE* buffer, UINT32 Length);
|
||||
UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, STREAM* input, STREAM* output, UINT32* abort_io);
|
||||
|
||||
boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result);
|
||||
BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result);
|
||||
|
||||
#endif /* __SERIAL_TTY_H */
|
@ -1,4 +1,4 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Client
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# FreeRDP cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
@ -15,8 +15,8 @@
|
||||
# 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")
|
||||
set(MODULE_NAME "freerdp-channels-server")
|
||||
set(MODULE_PREFIX "FREERDP_CHANNELS_SERVER")
|
||||
|
||||
foreach(_MODULE_NAME ${CHANNEL_BUILTIN_SERVER_MODULES})
|
||||
string(TOUPPER "CHANNEL_${_MODULE_NAME}" _MODULE_PREFIX)
|
||||
@ -35,3 +35,6 @@ set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL}
|
||||
|
||||
target_link_libraries(${MODULE_NAME} ${CHANNEL_SERVER_LIBS})
|
||||
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/Server")
|
||||
|
||||
|
21
channels/smartcard/CMakeLists.txt
Normal file
21
channels/smartcard/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
# FreeRDP: A Remote Desktop Protocol Implementation
|
||||
# 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()
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user