diff --git a/channels/disk/client/CMakeLists.txt b/channels/disk/client/CMakeLists.txt index e9f503d0b..1282048a5 100644 --- a/channels/disk/client/CMakeLists.txt +++ b/channels/disk/client/CMakeLists.txt @@ -24,7 +24,7 @@ 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) diff --git a/channels/disk/client/disk_file.c b/channels/disk/client/disk_file.c index 0bf28af66..48430a75b 100644 --- a/channels/disk/client/disk_file.c +++ b/channels/disk/client/disk_file.c @@ -85,17 +85,27 @@ static boolean disk_file_wildcard_match(const char* pattern, const char* filenam 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) diff --git a/channels/disk/client/disk_main.c b/channels/disk/client/disk_main.c index 473bfc640..d79100782 100644 --- a/channels/disk/client/disk_main.c +++ b/channels/disk/client/disk_main.c @@ -529,6 +529,8 @@ static void disk_process_irp_device_control(DISK_DEVICE* disk, IRP* irp) static void disk_process_irp(DISK_DEVICE* disk, IRP* irp) { + irp->IoStatus = STATUS_SUCCESS; + switch (irp->MajorFunction) { case IRP_MJ_CREATE: diff --git a/libfreerdp/channels/libchannels.c b/libfreerdp/channels/libchannels.c index 1a6131cd2..400709e67 100644 --- a/libfreerdp/channels/libchannels.c +++ b/libfreerdp/channels/libchannels.c @@ -932,7 +932,8 @@ static void freerdp_channels_process_sync(rdpChannels* channels, freerdp* instan lchannel_data->open_event_proc(lchannel_data->open_handle, CHANNEL_EVENT_WRITE_COMPLETE, item->UserData, sizeof(void*), sizeof(void*), 0); } - xfree(item); + + _aligned_free(item); } } diff --git a/libfreerdp/utils/unicode.c b/libfreerdp/utils/unicode.c index 027150b1c..530155206 100644 --- a/libfreerdp/utils/unicode.c +++ b/libfreerdp/utils/unicode.c @@ -56,6 +56,7 @@ int freerdp_UnicodeToAsciiAlloc(const WCHAR* wstr, CHAR** str, int length) *str = malloc((length * 2) + 1); WideCharToMultiByte(CP_UTF8, 0, wstr, length, *str, length, NULL, NULL); + (*str)[length] = 0; return length; }