From 1263d261f446447aca31c8c7aa35320d25c70c04 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 31 Jul 2013 15:13:11 -0700 Subject: [PATCH] Add stubs for dir information handlers --- src/protocols/rdp/Makefile.am | 2 + .../rdp/guac_rdpdr/rdpdr_fs_messages.c | 51 +++++++++++++- .../guac_rdpdr/rdpdr_fs_messages_dir_info.c | 69 +++++++++++++++++++ .../guac_rdpdr/rdpdr_fs_messages_dir_info.h | 62 +++++++++++++++++ src/protocols/rdp/guac_rdpdr/rdpdr_messages.h | 9 +++ 5 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.c create mode 100644 src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.h diff --git a/src/protocols/rdp/Makefile.am b/src/protocols/rdp/Makefile.am index 508ed599..4b5aac3f 100644 --- a/src/protocols/rdp/Makefile.am +++ b/src/protocols/rdp/Makefile.am @@ -66,6 +66,7 @@ guacsnd_sources = \ guacdr_sources = \ guac_rdpdr/rdpdr_fs.c \ guac_rdpdr/rdpdr_fs_messages.c \ + guac_rdpdr/rdpdr_fs_messages_dir_info.c \ guac_rdpdr/rdpdr_fs_messages_file_info.c \ guac_rdpdr/rdpdr_fs_messages_vol_info.c \ guac_rdpdr/rdpdr_fs_service.c \ @@ -78,6 +79,7 @@ noinst_HEADERS = \ compat/client-cliprdr.h \ guac_rdpdr/rdpdr_fs.h \ guac_rdpdr/rdpdr_fs_messages.h \ + 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 \ diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages.c b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages.c index c7b17245..5785d15f 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages.c +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages.c @@ -47,6 +47,7 @@ #include "rdpdr_fs_messages.h" #include "rdpdr_fs_messages_vol_info.h" #include "rdpdr_fs_messages_file_info.h" +#include "rdpdr_fs_messages_dir_info.h" #include "rdpdr_messages.h" #include "rdpdr_service.h" #include "client.h" @@ -268,8 +269,54 @@ void guac_rdpdr_fs_process_notify_change_directory(guac_rdpdr_device* device, void guac_rdpdr_fs_process_query_directory(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id) { - /* STUB */ - guac_client_log_info(device->rdpdr->client, "STUB: %s", __func__); + + int fs_information_class, initial_query; + int path_length; + + /* Read main header */ + Stream_Read_UINT32(input_stream, fs_information_class); + Stream_Read_UINT8(input_stream, initial_query); + Stream_Read_UINT32(input_stream, path_length); + + /* If this is the first query, the path is included after padding */ + if (initial_query) { + Stream_Seek(input_stream, 23); /* Padding */ + /* Path here */ + } + + guac_client_log_info(device->rdpdr->client, + "Received dir query - class=0x%x, path_length=%i", + fs_information_class, path_length); + + /* Dispatch to appropriate class-specific handler */ + switch (fs_information_class) { + + case FileDirectoryInformation: + guac_rdpdr_fs_process_query_directory_info(device, input_stream, + file_id, completion_id); + break; + + case FileFullDirectoryInformation: + guac_rdpdr_fs_process_query_full_directory_info(device, input_stream, + file_id, completion_id); + break; + + case FileBothDirectoryInformation: + guac_rdpdr_fs_process_query_both_directory_info(device, input_stream, + file_id, completion_id); + break; + + case FileNamesInformation: + guac_rdpdr_fs_process_query_names_info(device, input_stream, + file_id, completion_id); + break; + + default: + guac_client_log_info(device->rdpdr->client, + "Unknown dir information class: 0x%x", fs_information_class); + } + + } void guac_rdpdr_fs_process_lock_control(guac_rdpdr_device* device, wStream* input_stream, diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.c b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.c new file mode 100644 index 00000000..b8a22acc --- /dev/null +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.c @@ -0,0 +1,69 @@ + +/* ***** 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 "rdpdr_service.h" + +void guac_rdpdr_fs_process_query_directory_info(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id) { + /* STUB */ + guac_client_log_info(device->rdpdr->client, "STUB: %s", __func__); +} + +void guac_rdpdr_fs_process_query_full_directory_info(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id) { + /* STUB */ + guac_client_log_info(device->rdpdr->client, "STUB: %s", __func__); +} + +void guac_rdpdr_fs_process_query_both_directory_info(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id) { + /* STUB */ + guac_client_log_info(device->rdpdr->client, "STUB: %s", __func__); +} + +void guac_rdpdr_fs_process_query_names_info(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id) { + /* STUB */ + guac_client_log_info(device->rdpdr->client, "STUB: %s", __func__); +} + 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 new file mode 100644 index 00000000..3108976a --- /dev/null +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs_messages_dir_info.h @@ -0,0 +1,62 @@ + +/* ***** 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 ***** */ + +#ifndef __GUAC_RDPDR_FS_MESSAGES_DIR_INFO_H +#define __GUAC_RDPDR_FS_MESSAGES_DIR_INFO_H + +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-stream.h" +#endif + +#include "rdpdr_service.h" + +void guac_rdpdr_fs_process_query_directory_info(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id); + +void guac_rdpdr_fs_process_query_full_directory_info(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id); + +void guac_rdpdr_fs_process_query_both_directory_info(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id); + +void guac_rdpdr_fs_process_query_names_info(guac_rdpdr_device* device, + wStream* input_stream, int file_id, int completion_id); + +#endif + diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_messages.h b/src/protocols/rdp/guac_rdpdr/rdpdr_messages.h index df394d08..918d2bdc 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_messages.h +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_messages.h @@ -226,6 +226,15 @@ #define FileStandardInformation 0x00000005 #define FileAttributeTagInformation 0x00000023 +/* + * Directory information constants. + */ + +#define FileDirectoryInformation 0x00000001 +#define FileFullDirectoryInformation 0x00000002 +#define FileBothDirectoryInformation 0x00000003 +#define FileNamesInformation 0x0000000C + /* * Message handlers. */