channels: start fixing compilation on Windows

This commit is contained in:
Marc-André Moreau 2012-07-28 22:24:14 -04:00
parent 8203876838
commit 52c697a7e2
17 changed files with 121 additions and 44 deletions

View File

@ -170,9 +170,7 @@ add_subdirectory(libfreerdp-channels)
add_subdirectory(libfreerdp-locale)
add_subdirectory(libfreerdp-core)
if(NOT WIN32)
add_subdirectory(channels)
endif()
add_subdirectory(channels)
option(WITH_CLIENT "Build client binaries" ON)
if(WITH_CLIENT)

View File

@ -17,11 +17,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
add_subdirectory(cliprdr)
add_subdirectory(drdynvc)
add_subdirectory(rdpdbg)
add_subdirectory(rdpdr)
add_subdirectory(rail)
add_subdirectory(rdpsnd)
add_subdirectory(skel)
if(NOT WIN32)
add_subdirectory(rdpdr)
add_subdirectory(cliprdr)
add_subdirectory(rail)
add_subdirectory(rdpsnd)
endif()

View File

@ -32,6 +32,8 @@ target_link_libraries(drdynvc freerdp-utils)
install(TARGETS drdynvc DESTINATION ${FREERDP_PLUGIN_PATH})
add_subdirectory(tsmf)
add_subdirectory(audin)
if(NOT WIN32)
add_subdirectory(tsmf)
endif()
add_subdirectory(audin)

View File

@ -248,7 +248,7 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, STRE
DEBUG_DVC("FramesPerPacket=%d initialFormat=%d",
FramesPerPacket, initialFormat);
if (initialFormat >= callback->formats_count)
if (initialFormat >= (uint32) callback->formats_count)
{
DEBUG_WARN("invalid format index %d (total %d)",
initialFormat, callback->formats_count);
@ -279,7 +279,7 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb
DEBUG_DVC("NewFormat=%d", NewFormat);
if (NewFormat >= callback->formats_count)
if (NewFormat >= (uint32) callback->formats_count)
{
DEBUG_WARN("invalid format index %d (total %d)",
NewFormat, callback->formats_count);

View File

@ -194,7 +194,7 @@ int dvcman_load_plugin(IWTSVirtualChannelManager* pChannelMgr, RDP_PLUGIN_DATA*
while (data && data->size > 0)
{
pDVCPluginEntry = freerdp_load_plugin((char*) data->data[0], "DVCPluginEntry");
pDVCPluginEntry = (PDVC_PLUGIN_ENTRY) freerdp_load_plugin((char*) data->data[0], "DVCPluginEntry");
if (pDVCPluginEntry != NULL)
{
@ -206,7 +206,7 @@ int dvcman_load_plugin(IWTSVirtualChannelManager* pChannelMgr, RDP_PLUGIN_DATA*
pDVCPluginEntry((IDRDYNVC_ENTRY_POINTS*) &entryPoints);
}
data = (RDP_PLUGIN_DATA*)(((void*) data) + data->size);
data = (RDP_PLUGIN_DATA*)(((uint8*) data) + data->size);
}
return 0;
@ -414,7 +414,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 > 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);

View File

@ -228,14 +228,18 @@ int tsmf_ifman_shutdown_presentation(TSMF_IFMAN* ifman)
int tsmf_ifman_on_stream_volume(TSMF_IFMAN* ifman)
{
DEBUG_DVC("on stream volume");
TSMF_PRESENTATION* presentation;
DEBUG_DVC("on stream volume");
presentation = tsmf_presentation_find_by_id(stream_get_tail(ifman->input));
if (presentation)
{
stream_seek(ifman->input, 16);
uint32 newVolume;
uint32 muted;
stream_seek(ifman->input, 16);
stream_read_uint32(ifman->input, newVolume);
DEBUG_DVC("on stream volume: new volume=[%d]", newVolume);
stream_read_uint32(ifman->input, muted);
@ -243,28 +247,37 @@ int tsmf_ifman_on_stream_volume(TSMF_IFMAN* ifman)
tsmf_presentation_volume_changed(presentation, newVolume, muted);
}
else
{
DEBUG_WARN("unknown presentation id");
}
ifman->output_pending = true;
return 0;
}
int tsmf_ifman_on_channel_volume(TSMF_IFMAN* ifman)
{
DEBUG_DVC("on channel volume");
TSMF_PRESENTATION* presentation;
DEBUG_DVC("on channel volume");
presentation = tsmf_presentation_find_by_id(stream_get_tail(ifman->input));
if (presentation)
{
stream_seek(ifman->input, 16);
uint32 channelVolume;
uint32 changedChannel;
stream_seek(ifman->input, 16);
stream_read_uint32(ifman->input, channelVolume);
DEBUG_DVC("on channel volume: channel volume=[%d]", channelVolume);
stream_read_uint32(ifman->input, changedChannel);
DEBUG_DVC("on stream volume: changed channel=[%d]", changedChannel);
}
ifman->output_pending = true;
return 0;
}
@ -310,7 +323,9 @@ int tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman)
numGeometryInfo, Width, Height, Left, Top, cbVisibleRect, num_rects);
if (presentation == NULL)
{
error = 1;
}
else
{
if (num_rects > 0)
@ -335,7 +350,9 @@ int tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman)
}
tsmf_presentation_set_geometry_info(presentation, Left, Top, Width, Height, num_rects, rects);
}
ifman->output_pending = true;
return error;
}
@ -472,11 +489,13 @@ int tsmf_ifman_on_playback_started(TSMF_IFMAN* ifman)
int tsmf_ifman_on_playback_paused(TSMF_IFMAN* ifman)
{
TSMF_PRESENTATION* presentation;
DEBUG_DVC("");
ifman->output_pending = true;
/* Added pause control so gstreamer pipeline can be paused accordingly */
TSMF_PRESENTATION* presentation;
presentation = tsmf_presentation_find_by_id(stream_get_tail(ifman->input));
if (presentation)
tsmf_presentation_paused(presentation);
@ -487,16 +506,20 @@ int tsmf_ifman_on_playback_paused(TSMF_IFMAN* ifman)
int tsmf_ifman_on_playback_restarted(TSMF_IFMAN* ifman)
{
TSMF_PRESENTATION* presentation;
DEBUG_DVC("");
ifman->output_pending = true;
/* Added restart control so gstreamer pipeline can be resumed accordingly */
TSMF_PRESENTATION* presentation;
presentation = tsmf_presentation_find_by_id(stream_get_tail(ifman->input));
if (presentation)
tsmf_presentation_restarted(presentation);
else
DEBUG_WARN("unknown presentation id");
return 0;
}
@ -507,6 +530,7 @@ int tsmf_ifman_on_playback_stopped(TSMF_IFMAN* ifman)
DEBUG_DVC("");
presentation = tsmf_presentation_find_by_id(stream_get_tail(ifman->input));
if (presentation)
tsmf_presentation_stop(presentation);
else

View File

@ -416,7 +416,7 @@ static void tsmf_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data)
}
}
data = (RDP_PLUGIN_DATA*)(((void*)data) + data->size);
data = (RDP_PLUGIN_DATA*)(((uint8*)data) + data->size);
}
}

View File

@ -22,8 +22,15 @@
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef _WIN32
#include <sys/time.h>
#endif
#include <freerdp/utils/memory.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/list.h>
@ -238,18 +245,19 @@ static void tsmf_stream_process_ack(TSMF_STREAM* stream)
TSMF_PRESENTATION* tsmf_presentation_new(const uint8* guid, IWTSVirtualChannelCallback* pChannelCallback)
{
TSMF_PRESENTATION* presentation;
pthread_t thid = pthread_self();
FILE* fout = NULL;
fout = fopen("/tmp/tsmf.tid", "wt");
if (fout)
{
fprintf(fout, "%d\n", (int) thid);
fclose(fout);
}
TSMF_PRESENTATION* presentation;
presentation = tsmf_presentation_find_by_id(guid);
if (presentation)
{
DEBUG_WARN("duplicated presentation id!");
@ -319,6 +327,7 @@ static void tsmf_sample_playback_video(TSMF_SAMPLE* sample)
if (sample->data)
{
t = get_current_time();
if (stream->next_start_time > t &&
(sample->end_time >= presentation->audio_start_time ||
sample->end_time < stream->last_end_time))
@ -1006,14 +1015,17 @@ void tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pC
uint32 sample_id, uint64 start_time, uint64 end_time, uint64 duration, uint32 extensions,
uint32 data_size, uint8* data)
{
TSMF_SAMPLE* sample;
pthread_mutex_lock(&tsmf_mutex);
if (TERMINATING)
{
pthread_mutex_unlock(&tsmf_mutex);
return;
}
pthread_mutex_unlock(&tsmf_mutex);
TSMF_SAMPLE* sample;
sample = xnew(TSMF_SAMPLE);
@ -1033,6 +1045,8 @@ void tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pC
freerdp_thread_unlock(stream->thread);
}
#ifndef _WIN32
static void tsmf_signal_handler(int s)
{
pthread_mutex_lock(&tsmf_mutex);
@ -1069,14 +1083,18 @@ static void tsmf_signal_handler(int s)
}
}
#endif
void tsmf_media_init(void)
{
#ifndef _WIN32
struct sigaction sigtrap;
sigtrap.sa_handler = tsmf_signal_handler;
sigemptyset(&sigtrap.sa_mask);
sigtrap.sa_flags = 0;
sigaction(SIGINT, &sigtrap, 0);
sigaction(SIGUSR1, &sigtrap, 0);
#endif
if (presentation_list == NULL)
presentation_list = list_new();

View File

@ -37,10 +37,12 @@ target_link_libraries(rdpdr freerdp-utils)
install(TARGETS rdpdr DESTINATION ${FREERDP_PLUGIN_PATH})
add_subdirectory(disk)
add_subdirectory(printer)
add_subdirectory(parallel)
add_subdirectory(serial)
if(NOT WIN32)
add_subdirectory(disk)
add_subdirectory(printer)
add_subdirectory(parallel)
add_subdirectory(serial)
endif()
if(WITH_PCSC)
add_subdirectory(smartcard)

View File

@ -22,11 +22,14 @@
#define __DISK_FILE_H
#include <sys/types.h>
#include <sys/statvfs.h>
#include <sys/stat.h>
#include <dirent.h>
#if defined WIN32
#ifndef _WIN32
#include <dirent.h>
#include <sys/statvfs.h>
#endif
#ifdef _WIN32
#define STAT stat
#define OPEN open
#define LSEEK lseek
@ -60,10 +63,6 @@
(_f->delete_pending ? FILE_ATTRIBUTE_TEMPORARY : 0) | \
(st.st_mode & S_IWUSR ? 0 : FILE_ATTRIBUTE_READONLY))
typedef struct _DISK_FILE DISK_FILE;
struct _DISK_FILE
{

View File

@ -22,12 +22,19 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#ifndef _WIN32
#include <termios.h>
#include <strings.h>
#include <sys/ioctl.h>
#endif
#ifdef __LINUX__
#include <linux/ppdev.h>
#include <linux/parport.h>
@ -74,6 +81,7 @@ static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
parallel->id = irp->devman->id_sequence++;
parallel->file = open(parallel->path, O_RDWR);
if (parallel->file < 0)
{
irp->IoStatus = STATUS_ACCESS_DENIED;
@ -163,6 +171,7 @@ static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp)
DEBUG_SVC("Length %u Offset %llu", Length, Offset);
len = Length;
while (len > 0)
{
status = write(parallel->file, stream_get_tail(irp->input), len);

View File

@ -124,6 +124,8 @@ enum FILE_CREATE_OPTION
};
/* DR_CREATE_REQ.DesiredAccess [MS-SMB2] */
#ifndef _WIN32
enum FILE_ACCESS
{
FILE_READ_DATA = 0x00000001,
@ -146,6 +148,7 @@ enum FILE_ACCESS
GENERIC_WRITE = 0x40000000,
GENERIC_READ = 0x80000000
};
#endif
/* DR_CREATE_RSP.Information */
/* DR_DRIVE_CREATE_RSP.DeviceCreateResponse */
@ -221,8 +224,10 @@ enum RDP_LOWIO_OP
enum NTSTATUS
{
STATUS_SUCCESS = 0x00000000,
#ifndef _WIN32
STATUS_TIMEOUT = 0x00000102,
STATUS_PENDING = 0x00000103,
#endif
STATUS_REPARSE = 0x00000104,
STATUS_MORE_ENTRIES = 0x00000105,
STATUS_NOT_ALL_ASSIGNED = 0x00000106,
@ -245,8 +250,10 @@ enum NTSTATUS
STATUS_UNSUCCESSFUL = 0xC0000001,
STATUS_NOT_IMPLEMENTED = 0xC0000002,
STATUS_INVALID_INFO_CLASS = 0xC0000003,
#ifndef _WIN32
STATUS_INVALID_HANDLE = 0xC0000008,
STATUS_INVALID_PARAMETER = 0xC000000D,
#endif
STATUS_NO_SUCH_DEVICE = 0xC000000E,
STATUS_NO_SUCH_FILE = 0xC000000F,
STATUS_INVALID_DEVICE_REQUEST = 0xC0000010,
@ -289,6 +296,9 @@ enum RDPDR_PRINTER_ANNOUNCE_FLAG
};
/* [MS-FSCC] FileAttributes */
#ifndef _WIN32
enum FILE_ATTRIBUTE
{
FILE_ATTRIBUTE_ARCHIVE = 0x00000020,
@ -306,6 +316,8 @@ enum FILE_ATTRIBUTE
FILE_ATTRIBUTE_TEMPORARY = 0x00000100
};
#endif
/* [MS-FSCC] FSCTL Structures */
enum FSCTL_STRUCTURE
{
@ -337,6 +349,9 @@ enum FSCTL_STRUCTURE
};
/* [MS-FSCC] FileFsAttributeInformation.FileSystemAttributes */
#ifndef _WIN32
enum FILE_FS_ATTRIBUTE_INFORMATION
{
FILE_SUPPORTS_USN_JOURNAL = 0x02000000,
@ -361,6 +376,8 @@ enum FILE_FS_ATTRIBUTE_INFORMATION
FILE_CASE_SENSITIVE_SEARCH = 0x00000001
};
#endif
/* [MS-FSCC] FileFsDeviceInformation.DeviceType */
enum FILE_FS_DEVICE_TYPE
{

View File

@ -59,7 +59,7 @@ static void rdpdr_process_connect(rdpSvcPlugin* plugin)
{
devman_load_device_service(rdpdr->devman, data);
}
data = (RDP_PLUGIN_DATA*) (((void*) data) + data->size);
data = (RDP_PLUGIN_DATA*) (((uint8*) data) + data->size);
}
}
@ -83,7 +83,7 @@ static void rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
stream_write_uint16(data_out, rdpdr->versionMajor);
stream_write_uint16(data_out, rdpdr->versionMinor);
stream_write_uint32(data_out, rdpdr->clientID);
stream_write_uint32(data_out, (uint32) rdpdr->clientID);
svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out);
}

View File

@ -30,13 +30,16 @@
#include <freerdp/utils/svc_plugin.h>
#include <freerdp/utils/hexdump.h>
#ifndef _WIN32
#include <unistd.h>
#include <termios.h>
#include <dirent.h>
#include <sys/ioctl.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/ioctl.h>
#include <errno.h>
#include "rdpdr_constants.h"

View File

@ -23,7 +23,10 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifndef _WIN32
#include <dirent.h>
#endif
typedef struct _SERIAL_TTY SERIAL_TTY;
struct _SERIAL_TTY
@ -59,7 +62,6 @@ struct _SERIAL_TTY
int event_pending;
};
SERIAL_TTY* serial_tty_new(const char* path, uint32 id);
void serial_tty_free(SERIAL_TTY* tty);

View File

@ -477,7 +477,7 @@ static void rdpsnd_process_plugin_data(rdpsndPlugin* rdpsnd, RDP_PLUGIN_DATA* da
static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
{
rdpsndPlugin* rdpsnd = (rdpsndPlugin*)plugin;
rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
RDP_PLUGIN_DATA* data;
RDP_PLUGIN_DATA default_data[2] = { { 0 }, { 0 } };
@ -489,10 +489,11 @@ static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
rdpsnd->latency = -1;
data = (RDP_PLUGIN_DATA*)plugin->channel_entry_points.pExtendedData;
while (data && data->size > 0)
{
rdpsnd_process_plugin_data(rdpsnd, data);
data = (RDP_PLUGIN_DATA*) (((void*) data) + data->size);
data = (RDP_PLUGIN_DATA*) (((uint8*) data) + data->size);
}
if (rdpsnd->device == NULL)

View File

@ -40,7 +40,7 @@ static __inline void __attribute__((__gnu_inline__, __always_inline__, __artific
_mm_prefetch_buffer(char * buffer, int num_bytes)
{
__m128i * buf = (__m128i*) buffer;
int i;
unsigned int i;
for (i = 0; i < (num_bytes / sizeof(__m128i)); i+=(CACHE_LINE_BYTES / sizeof(__m128i)))
{
_mm_prefetch((char*)(&buf[i]), _MM_HINT_NTA);