diff --git a/src/protocols/rdp/Makefile.am b/src/protocols/rdp/Makefile.am index 4b5aac3f..76e9918f 100644 --- a/src/protocols/rdp/Makefile.am +++ b/src/protocols/rdp/Makefile.am @@ -82,7 +82,6 @@ noinst_HEADERS = \ guac_rdpdr/rdpdr_fs_messages_dir_info.h \ guac_rdpdr/rdpdr_fs_messages_file_info.h \ guac_rdpdr/rdpdr_fs_messages_vol_info.h \ - guac_rdpdr/rdpdr_fs_service.h \ guac_rdpdr/rdpdr_messages.h \ guac_rdpdr/rdpdr_printer.h \ guac_rdpdr/rdpdr_service.h \ diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs.h b/src/protocols/rdp/guac_rdpdr/rdpdr_fs.h index 1312a772..6f6c23bf 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_fs.h +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs.h @@ -38,6 +38,17 @@ #ifndef __GUAC_RDPDR_FS_H #define __GUAC_RDPDR_FS_H +/** + * Functions and macros specific to filesystem handling and initialization + * independent of RDP. The functions here may deal with the RDPDR device + * directly, but their semantics must not deal with RDP protocol messaging. + * Functions here represent a virtual Windows-style filesystem on top of UNIX + * system calls and structures, using the guac_rdpdr_device structure as a home + * for common data. + * + * @file rdpdr_fs.h + */ + #ifdef ENABLE_WINPR #include #else @@ -48,8 +59,6 @@ #include "rdpdr_service.h" -#include - /** * The index of the blob to use when sending files. */ @@ -167,7 +176,8 @@ typedef struct guac_rdpdr_fs_data { void guac_rdpdr_register_fs(guac_rdpdrPlugin* rdpdr); /** - * Returns the next available file ID, or -1 if none available. + * Returns the next available file ID, or an error code less than zero + * if an error occurs. */ int guac_rdpdr_fs_open(guac_rdpdr_device* device, const char* path, int access, int create_disposition); diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages.h b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages.h index 8fa79ed8..ff9ae98d 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages.h +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages.h @@ -35,6 +35,17 @@ * * ***** END LICENSE BLOCK ***** */ +#ifndef __GUAC_RDPDR_FS_MESSAGES_H +#define __GUAC_RDPDR_FS_MESSAGES_H + +/** + * Handlers for core drive I/O requests. Requests handled here may be simple + * messages handled directly, or more complex multi-type messages handled + * elsewhere. + * + * @file rdpdr_fs_messages.h + */ + #ifdef ENABLE_WINPR #include #else @@ -43,48 +54,93 @@ #include -#include "rdpdr_messages.h" -#include "rdpdr_fs.h" #include "rdpdr_service.h" -#include "client.h" -#include "unicode.h" - -#include - +/** + * Handles a Server Create Drive Request. Despite its name, this request opens + * a file. + */ void guac_rdpdr_fs_process_create(guac_rdpdr_device* device, wStream* input_stream, int completion_id); -void guac_rdpdr_fs_process_read(guac_rdpdr_device* device, - wStream* input_stream, int file_id, int completion_id); - -void guac_rdpdr_fs_process_write(guac_rdpdr_device* device, - wStream* input_stream, int file_id, int completion_id); - +/** + * Handles a Server Close Drive Reqiest. This request closes an open file. + */ void guac_rdpdr_fs_process_close(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); -void guac_rdpdr_fs_process_volume_info(guac_rdpdr_device* device, wStream* input_stream, - int completion_id); +/** + * Handles a Server Drive Read Request. This request reads from a file. + */ +void guac_rdpdr_fs_process_read(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id); -void guac_rdpdr_fs_process_set_volume_info(guac_rdpdr_device* device, wStream* input_stream, - int file_id, int completion_id); - -void guac_rdpdr_fs_process_file_info(guac_rdpdr_device* device, wStream* input_stream, - int file_id, int completion_id); - -void guac_rdpdr_fs_process_set_file_info(guac_rdpdr_device* device, wStream* input_stream, - int file_id, int completion_id); +/** + * Handles a Server Drive Write Request. This request writes to a file. + */ +void guac_rdpdr_fs_process_write(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id); +/** + * Handles a Server Drive Control Request. This request handles one of any + * number of Windows FSCTL_* control functions. + */ void guac_rdpdr_fs_process_device_control(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); -void guac_rdpdr_fs_process_notify_change_directory(guac_rdpdr_device* device, - wStream* input_stream, int file_id, int completion_id); +/** + * Handles a Server Drive Query Volume Information Request. This request + * queries information about the redirected volume (drive). This request + * has several query types which have their own handlers defined in a + * separate file. + */ +void guac_rdpdr_fs_process_volume_info(guac_rdpdr_device* device, wStream* input_stream, + int completion_id); +/** + * Handles a Server Drive Set Volume Information Request. Currently, this + * RDPDR implementation does not support setting of volume information. + */ +void guac_rdpdr_fs_process_set_volume_info(guac_rdpdr_device* device, wStream* input_stream, + int file_id, int completion_id); + +/** + * Handles a Server Drive Query Information Request. This request queries + * information about a specific file. This request has several query types + * which have their own handlers defined in a separate file. + */ +void guac_rdpdr_fs_process_file_info(guac_rdpdr_device* device, wStream* input_stream, + int file_id, int completion_id); + +/** + * Handles a Server Drive Set Information Request. This request sets + * information about a specific file. Currently, this RDPDR implementation does + * not support setting of file information. + */ +void guac_rdpdr_fs_process_set_file_info(guac_rdpdr_device* device, wStream* input_stream, + int file_id, int completion_id); + +/** + * Handles a Server Drive Query Directory Request. This request queries + * information about a specific directory. This request has several query types + * which have their own handlers defined in a separate file. + */ void guac_rdpdr_fs_process_query_directory(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); +/** + * Handles a Server Drive NotifyChange Directory Request. This request requests + * directory change notification. + */ +void guac_rdpdr_fs_process_notify_change_directory(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id); + +/** + * Handles a Server Drive Lock Control Request. This request locks or unlocks + * portions of a file. + */ void guac_rdpdr_fs_process_lock_control(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); +#endif + diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.h b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.h index 3108976a..cef128c4 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.h +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.h @@ -38,6 +38,14 @@ #ifndef __GUAC_RDPDR_FS_MESSAGES_DIR_INFO_H #define __GUAC_RDPDR_FS_MESSAGES_DIR_INFO_H +/** + * Handlers for directory queries received over the RDPDR channel via the + * IRP_MJ_DIRECTORY_CONTROL major function and the IRP_MN_QUERY_DIRECTORY minor + * function. + * + * @file rdpdr_fs_messages_dir_info.h + */ + #ifdef ENABLE_WINPR #include #else @@ -46,15 +54,34 @@ #include "rdpdr_service.h" +/** + * Processes a query request for FileDirectoryInformation. From the + * documentation this is "defined as the file's name, time stamp, and size, or its + * attributes." + */ void guac_rdpdr_fs_process_query_directory_info(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); +/** + * Processes a query request for FileFullDirectoryInformation. From the + * documentation, this is "defined as all the basic information, plus extended + * attribute size." + */ void guac_rdpdr_fs_process_query_full_directory_info(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); +/** + * Processes a query request for FileBothDirectoryInformation. From the + * documentation, this absurdly-named request is "basic information plus + * extended attribute size and short name about a file or directory." + */ void guac_rdpdr_fs_process_query_both_directory_info(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); +/** + * Processes a query request for FileNamesInformation. From the documentation, + * this is "detailed information on the names of files in a directory." + */ void guac_rdpdr_fs_process_query_names_info(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_file_info.h b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_file_info.h index b03beed0..9971dba3 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_file_info.h +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_file_info.h @@ -35,28 +35,45 @@ * * ***** END LICENSE BLOCK ***** */ +#ifndef __GUAC_RDPDR_FS_MESSAGES_FILE_INFO_H +#define __GUAC_RDPDR_FS_MESSAGES_FILE_INFO_H + +/** + * Handlers for file queries received over the RDPDR channel via the + * IRP_MJ_QUERY_INFORMATION major function. + * + * @file rdpdr_fs_messages_file_info.h + */ + #ifdef ENABLE_WINPR #include #else #include "compat/winpr-stream.h" #endif -#include - -#include "rdpdr_messages.h" -#include "rdpdr_fs.h" #include "rdpdr_service.h" -#include "client.h" -#include "unicode.h" - -#include +/** + * Processes a query for FileBasicInformation. From the documentation, this is + * "used to query a file for the times of creation, last access, last write, + * and change, in addition to file attribute information." + */ void guac_rdpdr_fs_process_query_basic_info(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); +/** + * Processes a query for FileStandardInformation. From the documentation, this + * is "used to query for file information such as allocation size, end-of-file + * position, and number of links." + */ void guac_rdpdr_fs_process_query_standard_info(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); +/** + * Processes a query for FileAttributeTagInformation. From the documentation + * this is "used to query for file attribute and reparse tag information." + */ void guac_rdpdr_fs_process_query_attribute_tag_info(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id); +#endif diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_vol_info.h b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_vol_info.h index bf9eab74..74b23083 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_vol_info.h +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_vol_info.h @@ -35,34 +35,56 @@ * * ***** END LICENSE BLOCK ***** */ +#ifndef __GUAC_RDPDR_FS_MESSAGES_VOL_INFO_H +#define __GUAC_RDPDR_FS_MESSAGES_VOL_INFO_H + +/** + * Handlers for directory queries received over the RDPDR channel via the + * IRP_MJ_DIRECTORY_CONTROL major function and the IRP_MN_QUERY_DIRECTORY minor + * function. + * + * @file rdpdr_fs_messages_vol_info.h + */ + #ifdef ENABLE_WINPR #include #else #include "compat/winpr-stream.h" #endif -#include - -#include "rdpdr_messages.h" -#include "rdpdr_fs.h" #include "rdpdr_service.h" -#include "client.h" -#include "unicode.h" - -#include +/** + * Processes a query request for FileFsVolumeInformation. According to the + * documentation, this is "used to query information for a volume on which a + * file system is mounted." + */ void guac_rdpdr_fs_process_query_volume_info(guac_rdpdr_device* device, wStream* input_stream, int completion_id); +/** + * Processes a query request for FileFsSizeInformation. + */ void guac_rdpdr_fs_process_query_size_info(guac_rdpdr_device* device, wStream* input_stream, int completion_id); -void guac_rdpdr_fs_process_query_device_info(guac_rdpdr_device* device, wStream* input_stream, - int completion_id); - +/** + * Processes a query request for FileFsAttributeInformation. + */ void guac_rdpdr_fs_process_query_attribute_info(guac_rdpdr_device* device, wStream* input_stream, int completion_id); +/** + * Processes a query request for FileFsFullSizeInformation. + */ void guac_rdpdr_fs_process_query_full_size_info(guac_rdpdr_device* device, wStream* input_stream, int completion_id); +/** + * Processes a query request for FileFsDeviceInformation. + */ +void guac_rdpdr_fs_process_query_device_info(guac_rdpdr_device* device, wStream* input_stream, + int completion_id); + +#endif + diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_service.h b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_service.h deleted file mode 100644 index 4a3a87ac..00000000 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_service.h +++ /dev/null @@ -1,55 +0,0 @@ - -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (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.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is libguac-client-rdp. - * - * The Initial Developer of the Original Code is - * Michael Jumper. - * Portions created by the Initial Developer are Copyright (C) 2011 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifdef ENABLE_WINPR -#include -#else -#include "compat/winpr-stream.h" -#endif - -#include - -#include "rdpdr_messages.h" -#include "rdpdr_fs.h" -#include "rdpdr_service.h" -#include "client.h" -#include "unicode.h" - -#include - -void guac_rdpdr_register_fs(guac_rdpdrPlugin* rdpdr); -