Commit 7ea18899 authored by Mike Gabriel's avatar Mike Gabriel

Imported Upstream version 1.1.0~git20140808.1.28f65ff

parent 46d9a93a
# CMake
CMakeFiles/
CMakeScripts/
CMakeCache.txt
config.h
install_manifest*.txt
CTestTestfile.cmake
freerdp.pc
Makefile
Testing
cmake_install.cmake
CPackConfig.cmake
CPackSourceConfig.cmake
DartConfiguration.tcl
_CPack_Packages
external/*
!external/README
# Packages
*.zip
*.exe
*.sh
*.deb
*.rpm
*.tar.Z
*.tar.gz
# Eclipse
*.project
*.cproject
*.settings
# .rdp files
*.rdp
*.RDP
# Documentation
docs/api
client/X11/xfreerdp.1
# Mac OS X
.DS_Store
*.xcodeproj/
DerivedData/
# iOS
FreeRDP.build
Debug-*
Release-*
# Windows
*.vcxproj
*.vcxproj.*
*.vcproj
*.vcproj.*
*.sdf
*.sln
*.suo
*.ncb
*.opensdf
Thumbs.db
ipch
Debug
RelWithDebInfo
# Binaries
*.a
*.so
*.so.*
*.dylib
bin
libs
cunit/test_freerdp
client/X11/xfreerdp
client/Mac/xcode
client/Sample/sfreerdp
client/DirectFB/dfreerdp
server/Sample/sfreerdp-server
server/X11/xfreerdp-server
xcode
# Other
*~
*.dir
Release
Win32
build*/
*.orig
default.log
*Amplifier XE*
*Inspector XE*
*.cbp
*.txt.user
*.autosave
......@@ -313,6 +313,10 @@ set(NPP_FEATURE_TYPE "OPTIONAL")
set(NPP_FEATURE_PURPOSE "performance")
set(NPP_FEATURE_DESCRIPTION "NVIDIA Performance Primitives library")
set(JPEG_FEATURE_TYPE "OPTIONAL")
set(JPEG_FEATURE_PURPOSE "codec")
set(JPEG_FEATURE_DESCRIPTION "use JPEG library")
if(WIN32)
set(X11_FEATURE_TYPE "DISABLED")
set(ZLIB_FEATURE_TYPE "DISABLED")
......@@ -372,6 +376,8 @@ find_feature(PCSC ${PCSC_FEATURE_TYPE} ${PCSC_FEATURE_PURPOSE} ${PCSC_FEATURE_DE
find_feature(FFmpeg ${FFMPEG_FEATURE_TYPE} ${FFMPEG_FEATURE_PURPOSE} ${FFMPEG_FEATURE_DESCRIPTION})
find_feature(Gstreamer ${GSTREAMER_FEATURE_TYPE} ${GSTREAMER_FEATURE_PURPOSE} ${GSTREAMER_FEATURE_DESCRIPTION})
find_feature(JPEG ${JPEG_FEATURE_TYPE} ${JPEG_FEATURE_PURPOSE} ${JPEG_FEATURE_DESCRIPTION})
if(TARGET_ARCH MATCHES "x86|x64")
if (NOT APPLE)
# Intel Performance Primitives
......@@ -400,12 +406,13 @@ set(FREERDP_ADDIN_PATH "${FREERDP_PLUGIN_PATH}")
set(FREERDP_EXTENSION_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp/extensions")
# Include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
# Configure files
add_definitions("-DHAVE_CONFIG_H")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
# RPATH configuration
set(CMAKE_SKIP_BUILD_RPATH FALSE)
......@@ -430,8 +437,8 @@ if(BUILD_TESTING)
endif()
# WinPR
set(WINPR_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/winpr/include")
include_directories(${WINPR_INCLUDE_DIR})
include_directories("${CMAKE_SOURCE_DIR}/winpr/include")
include_directories("${CMAKE_BINARY_DIR}/winpr/include")
add_subdirectory(winpr)
......@@ -465,7 +472,11 @@ endif()
if (IOS)
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
set(CMAKE_OSX_SYSROOT "iphoneos")
if (IOS_PLATFORM MATCHES "SIMULATOR")
set(CMAKE_OSX_SYSROOT "iphonesimulator")
else()
set(CMAKE_OSX_SYSROOT "iphoneos")
endif()
endif()
if(WITH_CLIENT)
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string></string>
<key>CFBundleIconFile</key>
<string>FreeRDP</string>
<key>CFBundleIdentifier</key>
<string>FreeRDP.Mac</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string></string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 __MyCompanyName__. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
......@@ -290,6 +290,17 @@ static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length
BYTE* encoded_data;
AudinPulseDevice* pulse = (AudinPulseDevice*) userdata;
/* There is a race condition here where we may receive this callback
* before the buffer has been set up in the main code. It's probably
* possible to fix with additional locking, but it's easier just to
* ignore input until the buffer is ready.
*/
if (pulse->buffer == NULL)
{
/* fprintf(stderr, "%s: ignoring input, pulse buffer not ready.\n", __func__); */
return;
}
pa_stream_peek(stream, &data, &length);
frames = length / pulse->bytes_per_frame;
......@@ -373,6 +384,7 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u
DEBUG_DVC("");
pulse->buffer = NULL;
pulse->receive = receive;
pulse->user_data = user_data;
......
......@@ -19,16 +19,16 @@ set(MODULE_NAME "freerdp-channels-client")
set(MODULE_PREFIX "FREERDP_CHANNELS_CLIENT")
set(${MODULE_PREFIX}_SRCS
tables.c
tables.h
addin.c
addin.h
init.c
init.h
open.c
open.h
channels.c
channels.h)
${CMAKE_CURRENT_BINARY_DIR}/tables.c
${CMAKE_CURRENT_SOURCE_DIR}/tables.h
${CMAKE_CURRENT_SOURCE_DIR}/addin.c
${CMAKE_CURRENT_SOURCE_DIR}/addin.h
${CMAKE_CURRENT_SOURCE_DIR}/init.c
${CMAKE_CURRENT_SOURCE_DIR}/init.h
${CMAKE_CURRENT_SOURCE_DIR}/open.c
${CMAKE_CURRENT_SOURCE_DIR}/open.h
${CMAKE_CURRENT_SOURCE_DIR}/channels.c
${CMAKE_CURRENT_SOURCE_DIR}/channels.h)
list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES)
......@@ -96,7 +96,7 @@ foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES})
endforeach()
set(CLIENT_STATIC_ADDIN_TABLE "${CLIENT_STATIC_ADDIN_TABLE}\n\t{ NULL, NULL, NULL }\n};")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tables.c.in ${CMAKE_CURRENT_SOURCE_DIR}/tables.c)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tables.c.in ${CMAKE_CURRENT_BINARY_DIR}/tables.c)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
......
......@@ -441,10 +441,14 @@ int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, c
int freerdp_drdynvc_on_channel_connected(DrdynvcClientContext* context, const char* name, void* pInterface)
{
int status = 0;
ChannelConnectedEventArgs e;
rdpChannels* channels = (rdpChannels*) context->custom;
freerdp* instance = channels->instance;
IFCALLRET(instance->OnChannelConnected, status, instance, name, pInterface);
EventArgsInit(&e, "freerdp");
e.name = name;
e.pInterface = pInterface;
PubSub_OnChannelConnected(instance->context->pubSub, instance->context, &e);
return status;
}
......@@ -452,10 +456,14 @@ int freerdp_drdynvc_on_channel_connected(DrdynvcClientContext* context, const ch
int freerdp_drdynvc_on_channel_disconnected(DrdynvcClientContext* context, const char* name, void* pInterface)
{
int status = 0;
ChannelDisconnectedEventArgs e;
rdpChannels* channels = (rdpChannels*) context->custom;
freerdp* instance = channels->instance;
IFCALLRET(instance->OnChannelDisconnected, status, instance, name, pInterface);
EventArgsInit(&e, "freerdp");
e.name = name;
e.pInterface = pInterface;
PubSub_OnChannelDisconnected(instance->context->pubSub, instance->context, &e);
return status;
}
......
......@@ -87,14 +87,15 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
if (!cliprdr->use_long_format_names)
name_length = 32;
Stream_EnsureRemainingCapacity(body, Stream_Capacity(body) + 4 + name_length);
Stream_EnsureRemainingCapacity(body, 4 + name_length);
Stream_Write_UINT32(body, cb_event->formats[i]);
Stream_Write(body, name, name_length);
}
s = cliprdr_packet_new(CB_FORMAT_LIST, 0, Stream_Capacity(body));
Stream_Write(s, Stream_Buffer(body), Stream_Capacity(body));
Stream_SealLength(body);
s = cliprdr_packet_new(CB_FORMAT_LIST, 0, Stream_Length(body));
Stream_Write(s, Stream_Buffer(body), Stream_Length(body));
Stream_Free(body, TRUE);
}
......@@ -290,16 +291,16 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
{
/* where is this documented? */
#if 0
/* http://msdn.microsoft.com/en-us/library/hh872154.aspx */
wMessage* event;
if ((msgFlags & CB_RESPONSE_FAIL) != 0)
{
event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_MONITOR_READY, NULL, NULL);
/* In case of an error the clipboard will not be synchronized with the server.
* Post this event to restart format negociation and data transfer. */
event = freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_MonitorReady, NULL, NULL);
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, event);
}
#endif
}
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
......
......@@ -299,15 +299,19 @@ DRIVE_FILE* drive_file_new(const char* base_path, const char* path, UINT32 id,
if (!drive_file_init(file, DesiredAccess, CreateDisposition, CreateOptions))
{
drive_file_free(file);
(void) drive_file_free(file, TRUE);
return NULL;
}
return file;
}
void drive_file_free(DRIVE_FILE* file)
int drive_file_free(DRIVE_FILE* file, BOOL recursive)
{
int retval;
retval = 0;
if (file->fd != -1)
close(file->fd);
......@@ -317,14 +321,36 @@ void drive_file_free(DRIVE_FILE* file)
if (file->delete_pending)
{
if (file->is_dir)
drive_file_remove_dir(file->fullpath);
{
if (recursive)
{
if (!drive_file_remove_dir(file->fullpath))
{
retval = EPERM;
}
}
else
{
if (rmdir(file->fullpath) != 0)
{
retval = errno;
}
}
}
else
unlink(file->fullpath);
{
if (unlink(file->fullpath) != 0)
{
retval = errno;
}
}
}
free(file->pattern);
free(file->fullpath);
free(file);
return retval;
}
BOOL drive_file_seek(DRIVE_FILE* file, UINT64 Offset)
......@@ -340,37 +366,55 @@ BOOL drive_file_seek(DRIVE_FILE* file, UINT64 Offset)
BOOL drive_file_read(DRIVE_FILE* file, BYTE* buffer, UINT32* Length)
{
ssize_t r;
size_t left;
BYTE *bufptr;
if (file->is_dir || file->fd == -1)
return FALSE;
r = read(file->fd, buffer, *Length);
if (r < 0)
return FALSE;
bufptr = buffer;
left = *Length;
while (left > 0)
{
ssize_t bytesRead;
bytesRead = read(file->fd, bufptr, left);
if (bytesRead < 0)
{
if ((errno == EAGAIN) || (errno == EINTR))
continue;
else
return FALSE;
}
else if (bytesRead == 0) break; /* EOF */
bufptr += bytesRead;
left -= bytesRead;
}
*Length = (UINT32) r;
*Length -= left;
return TRUE;
}
BOOL drive_file_write(DRIVE_FILE* file, BYTE* buffer, UINT32 Length)
BOOL drive_file_write(DRIVE_FILE* file, const BYTE* buffer, UINT32 Length)
{
ssize_t r;
if (file->is_dir || file->fd == -1)
return FALSE;
while (Length > 0)
{
r = write(file->fd, buffer, Length);
ssize_t bytesWritten;
bytesWritten = write(file->fd, buffer, Length);
if (r == -1)
return FALSE;
if (bytesWritten < 0)
{
if ((errno == EAGAIN) || (errno == EINTR))
continue;
else
return FALSE;
}
Length -= r;
buffer += r;
Length -= bytesWritten;
buffer += bytesWritten;
}
return TRUE;
......@@ -476,7 +520,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
else
m &= ~S_IWUSR;
if (m != st.st_mode)
fchmod(file->fd, st.st_mode);
fchmod(file->fd, m);
}
#endif
break;
......@@ -497,6 +541,25 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
Stream_Read_UINT8(input, file->delete_pending);
else
file->delete_pending = 1;
if (file->delete_pending && file->is_dir)
{
/* mstsc causes this to FAIL if the directory is not empty,
* and that's what the server is expecting. If we wait for
* the close to flag a failure, cut and paste of a folder
* will lose the folder's contents.
*/
int status;
status = rmdir(file->fullpath);
if (status == 0)
{
/* Put it back so the normal pending delete will work. */
mkdir(file->fullpath, 0755);
}
else
{
return FALSE;
}
}
break;
case FileRenameInformation:
......
......@@ -108,11 +108,11 @@ struct _DRIVE_FILE
DRIVE_FILE* drive_file_new(const char* base_path, const char* path, UINT32 id,
UINT32 DesiredAccess, UINT32 CreateDisposition, UINT32 CreateOptions);
void drive_file_free(DRIVE_FILE* file);
int drive_file_free(DRIVE_FILE* file, BOOL recursive);
BOOL drive_file_seek(DRIVE_FILE* file, UINT64 Offset);
BOOL drive_file_read(DRIVE_FILE* file, BYTE* buffer, UINT32* Length);
BOOL drive_file_write(DRIVE_FILE* file, BYTE* buffer, UINT32 Length);
BOOL drive_file_write(DRIVE_FILE* file, const BYTE* buffer, UINT32 Length);
BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, wStream* output);
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, wStream* input);
BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery,
......
......@@ -159,7 +159,8 @@ static void drive_process_irp_create(DRIVE_DEVICE* disk, IRP* irp)
/* map errno to windows result */
irp->IoStatus = drive_map_posix_err(file->err);
drive_file_free(file);
/* Already in the error path, no need to check return value here. */
(void) drive_file_free(file, TRUE);
}
else
{
......@@ -208,10 +209,12 @@ static void drive_process_irp_close(DRIVE_DEVICE* disk, IRP* irp)
}
else
{
int err;
DEBUG_SVC("%s(%d) closed.", file->fullpath, file->id);
list_remove(disk->files, file);
drive_file_free(file);
if ((err = drive_file_free(file, FALSE)) != 0)
irp->IoStatus = drive_map_posix_err(err);
}
Stream_Zero(irp->output, 5); /* Padding(5) */
......@@ -672,8 +675,9 @@ static void drive_free(DEVICE* device)
_aligned_free(disk->pIrpList);
/* Cleaning up; no need to check for drive_file_free error. */
while ((file = (DRIVE_FILE*) list_dequeue(disk->files)) != NULL)
drive_file_free(file);
(void) drive_file_free(file, TRUE);
list_free(disk->files);
......
......@@ -286,6 +286,7 @@ static void parallel_free(DEVICE* device)
MessageQueue_PostQuit(parallel->queue, 0);
WaitForSingleObject(parallel->thread, INFINITE);
Stream_Free(parallel->device.data, TRUE);
MessageQueue_Free(parallel->queue);
CloseHandle(parallel->thread);
......
......@@ -179,13 +179,16 @@ static void* printer_thread_func(void* arg)
{
IRP* irp;
PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) arg;
HANDLE obj[] = {printer_dev->event, printer_dev->stopEvent};
while (1)
{
WaitForSingleObject(printer_dev->event, INFINITE);
DWORD rc = WaitForMultipleObjects(2, obj, FALSE, INFINITE);
if (WaitForSingleObject(printer_dev->stopEvent, 0) == WAIT_OBJECT_0)
if (rc == WAIT_OBJECT_0 + 1)
break;
else if( rc != WAIT_OBJECT_0 )
continue;
ResetEvent(printer_dev->event);
......
......@@ -212,7 +212,7 @@ int rdpei_send_cs_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback)
Stream_Seek(s, RDPINPUT_HEADER_LENGTH);
Stream_Write_UINT32(s, flags); /* flags (4 bytes) */
Stream_Write_UINT32(s, RDPINPUT_PROTOCOL_V1); /* protocolVersion (4 bytes) */
Stream_Write_UINT32(s, RDPINPUT_PROTOCOL_V10); /* protocolVersion (4 bytes) */
Stream_Write_UINT16(s, rdpei->maxTouchContacts); /* maxTouchContacts (2 bytes) */
Stream_SealLength(s);
......@@ -249,6 +249,7 @@ void rdpei_print_contact_flags(UINT32 contactFlags)
int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
{
int index;
int rectSize = 2;
RDPINPUT_CONTACT_DATA* contact;
#ifdef WITH_DEBUG_RDPEI
......@@ -264,12 +265,18 @@ int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
*/
rdpei_write_8byte_unsigned(s, frame->frameOffset * 1000); /* frameOffset (EIGHT_BYTE_UNSIGNED_INTEGER) */
Stream_EnsureRemainingCapacity(s, frame->contactCount * 32);
Stream_EnsureRemainingCapacity(s, frame->contactCount * 64);
for (index = 0; index < frame->contactCount; index++)
{
contact = &frame->contacts[index];
contact->fieldsPresent |= CONTACT_DATA_CONTACTRECT_PRESENT;
contact->contactRectLeft = contact->x - rectSize;
contact->contactRectTop = contact->y - rectSize;
contact->contactRectRight = contact->x + rectSize;
contact->contactRectBottom = contact->y + rectSize;
#ifdef WITH_DEBUG_RDPEI
printf("contact[%d].contactId: %d\n", index, contact->contactId);
printf("contact[%d].fieldsPresent: %d\n", index, contact->fieldsPresent);
......@@ -325,7 +332,7 @@ int rdpei_send_touch_event_pdu(RDPEI_CHANNEL_CALLBACK* callback, RDPINPUT_TOUCH_
wStream* s;
UINT32 pduLength;
pduLength = 64 + (frame->contactCount * 32);
pduLength = 64 + (frame->contactCount * 64);
s = Stream_New(NULL, pduLength);
Stream_Seek(s, RDPINPUT_HEADER_LENGTH);
......@@ -355,11 +362,13 @@ int rdpei_recv_sc_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
Stream_Read_UINT32(s, protocolVersion); /* protocolVersion (4 bytes) */
if (protocolVersion != RDPINPUT_PROTOCOL_V1)
#if 0
if (protocolVersion != RDPINPUT_PROTOCOL_V10)
{
fprintf(stderr, "Unknown [MS-RDPEI] protocolVersion: 0x%08X\n", protocolVersion);
return -1;
}
#endif
return 0;
}
......
......@@ -35,7 +35,8 @@
/* Protocol Version */
#define RDPINPUT_PROTOCOL_V1 0x00010000
#define RDPINPUT_PROTOCOL_V10 0x00010000
#define RDPINPUT_PROTOCOL_V101 0x00010001
/* Client Ready Flags */
......
......@@ -63,11 +63,12 @@ struct _SERIAL_DEVICE
SERIAL_TTY* tty;
HANDLE thread;
HANDLE mthread;
HANDLE stopEvent;
HANDLE newEvent;
wQueue* queue;
LIST* pending_irps;
HANDLE in_event;
fd_set read_fds;
fd_set write_fds;
......@@ -81,6 +82,7 @@ static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32
static void serial_check_for_events(SERIAL_DEVICE* serial);
static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp);
static BOOL serial_check_fds(SERIAL_DEVICE* serial);
static void* serial_thread_mfunc(void* arg);
static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
{
......@@ -114,6 +116,18 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
else
{
serial->tty = tty;
serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_NONE,
STATUS_CANCELLED);
serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_READ,
STATUS_CANCELLED);
serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_WRITE,
STATUS_CANCELLED);
serial->mthread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) serial_thread_mfunc, (void*) serial,
0, NULL);
DEBUG_SVC("%s(%d) created.", serial->path, FileId);