Add file_id to volume queries, send real times and attributes back.

This commit is contained in:
Michael Jumper 2013-08-01 16:42:38 -07:00
parent 117e9053f4
commit 06c2dfd8d2
6 changed files with 42 additions and 27 deletions

View File

@ -161,7 +161,7 @@ void guac_rdpdr_fs_process_close(guac_rdpdr_device* device,
} }
void guac_rdpdr_fs_process_volume_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_volume_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id) { int file_id, int completion_id) {
int fs_information_class, length; int fs_information_class, length;
@ -178,23 +178,28 @@ void guac_rdpdr_fs_process_volume_info(guac_rdpdr_device* device, wStream* input
switch (fs_information_class) { switch (fs_information_class) {
case FileFsVolumeInformation: case FileFsVolumeInformation:
guac_rdpdr_fs_process_query_volume_info(device, input_stream, completion_id); guac_rdpdr_fs_process_query_volume_info(device, input_stream,
file_id, completion_id);
break; break;
case FileFsSizeInformation: case FileFsSizeInformation:
guac_rdpdr_fs_process_query_size_info(device, input_stream, completion_id); guac_rdpdr_fs_process_query_size_info(device, input_stream,
file_id, completion_id);
break; break;
case FileFsDeviceInformation: case FileFsDeviceInformation:
guac_rdpdr_fs_process_query_device_info(device, input_stream, completion_id); guac_rdpdr_fs_process_query_device_info(device, input_stream,
file_id, completion_id);
break; break;
case FileFsAttributeInformation: case FileFsAttributeInformation:
guac_rdpdr_fs_process_query_attribute_info(device, input_stream, completion_id); guac_rdpdr_fs_process_query_attribute_info(device, input_stream,
file_id, completion_id);
break; break;
case FileFsFullSizeInformation: case FileFsFullSizeInformation:
guac_rdpdr_fs_process_query_full_size_info(device, input_stream, completion_id); guac_rdpdr_fs_process_query_full_size_info(device, input_stream,
file_id, completion_id);
break; break;
default: default:

View File

@ -95,7 +95,7 @@ void guac_rdpdr_fs_process_device_control(guac_rdpdr_device* device, wStream* in
* separate file. * separate file.
*/ */
void guac_rdpdr_fs_process_volume_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_volume_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id); int file_id, int completion_id);
/** /**
* Handles a Server Drive Set Volume Information Request. Currently, this * Handles a Server Drive Set Volume Information Request. Currently, this

View File

@ -56,7 +56,8 @@ void guac_rdpdr_fs_process_query_basic_info(guac_rdpdr_device* device, wStream*
int file_id, int completion_id) { int file_id, int completion_id) {
wStream* output_stream = Stream_New(NULL, 60); wStream* output_stream = Stream_New(NULL, 60);
/*guac_rdpdr_fs_file* file = device->files[file_id];*/ guac_rdpdr_fs_data* data = (guac_rdpdr_fs_data*) device->data;
guac_rdpdr_fs_file* file = &(data->files[file_id]);
/* Write header */ /* Write header */
Stream_Write_UINT16(output_stream, RDPDR_CTYP_CORE); Stream_Write_UINT16(output_stream, RDPDR_CTYP_CORE);
@ -68,12 +69,19 @@ void guac_rdpdr_fs_process_query_basic_info(guac_rdpdr_device* device, wStream*
Stream_Write_UINT32(output_stream, STATUS_SUCCESS); Stream_Write_UINT32(output_stream, STATUS_SUCCESS);
Stream_Write_UINT32(output_stream, 18 + GUAC_FILESYSTEM_NAME_LENGTH); Stream_Write_UINT32(output_stream, 18 + GUAC_FILESYSTEM_NAME_LENGTH);
Stream_Write_UINT64(output_stream, WINDOWS_TIME(0)); /* CreationTime */ Stream_Write_UINT64(output_stream, WINDOWS_TIME(file->ctime)); /* CreationTime */
Stream_Write_UINT64(output_stream, WINDOWS_TIME(0)); /* LastAccessTime */ Stream_Write_UINT64(output_stream, WINDOWS_TIME(file->atime)); /* LastAccessTime */
Stream_Write_UINT64(output_stream, WINDOWS_TIME(0)); /* LastWriteTime */ Stream_Write_UINT64(output_stream, WINDOWS_TIME(file->mtime)); /* LastWriteTime */
Stream_Write_UINT64(output_stream, WINDOWS_TIME(0)); /* ChangeTime */ Stream_Write_UINT64(output_stream, WINDOWS_TIME(file->mtime)); /* ChangeTime */
Stream_Write_UINT32(output_stream, FILE_ATTRIBUTE_NORMAL); /* FileAttributes */
Stream_Write_UINT32(output_stream, 0); /* Reserved */ /* FileAttributes */
if (file->type == GUAC_RDPDR_FS_DIRECTORY)
Stream_Write_UINT32(output_stream, FILE_ATTRIBUTE_DIRECTORY);
else
Stream_Write_UINT32(output_stream, FILE_ATTRIBUTE_NORMAL); /* FileAttributes */
/* Reserved */
Stream_Write_UINT32(output_stream, 0);
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream); svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);

View File

@ -52,9 +52,11 @@
#include <freerdp/utils/svc_plugin.h> #include <freerdp/utils/svc_plugin.h>
void guac_rdpdr_fs_process_query_volume_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_volume_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id) { int file_id, int completion_id) {
wStream* output_stream = Stream_New(NULL, 38 + GUAC_FILESYSTEM_NAME_LENGTH); wStream* output_stream = Stream_New(NULL, 38 + GUAC_FILESYSTEM_NAME_LENGTH);
guac_rdpdr_fs_data* data = (guac_rdpdr_fs_data*) device->data;
guac_rdpdr_fs_file* file = &(data->files[file_id]);
/* Write header */ /* Write header */
Stream_Write_UINT16(output_stream, RDPDR_CTYP_CORE); Stream_Write_UINT16(output_stream, RDPDR_CTYP_CORE);
@ -66,8 +68,8 @@ void guac_rdpdr_fs_process_query_volume_info(guac_rdpdr_device* device, wStream*
Stream_Write_UINT32(output_stream, STATUS_SUCCESS); Stream_Write_UINT32(output_stream, STATUS_SUCCESS);
Stream_Write_UINT32(output_stream, 18 + GUAC_FILESYSTEM_NAME_LENGTH); Stream_Write_UINT32(output_stream, 18 + GUAC_FILESYSTEM_NAME_LENGTH);
Stream_Write_UINT64(output_stream, WINDOWS_TIME(0)); /* VolumeCreationTime */ Stream_Write_UINT64(output_stream, WINDOWS_TIME(file->ctime)); /* VolumeCreationTime */
Stream_Write(output_stream, "GUAC", 4); /* VolumeSerialNumber */ Stream_Write(output_stream, "GUAC", 4); /* VolumeSerialNumber */
Stream_Write_UINT32(output_stream, GUAC_FILESYSTEM_NAME_LENGTH); Stream_Write_UINT32(output_stream, GUAC_FILESYSTEM_NAME_LENGTH);
Stream_Write_UINT8(output_stream, FALSE); /* SupportsObjects */ Stream_Write_UINT8(output_stream, FALSE); /* SupportsObjects */
Stream_Write_UINT8(output_stream, 0); /* Reserved */ Stream_Write_UINT8(output_stream, 0); /* Reserved */
@ -78,28 +80,28 @@ void guac_rdpdr_fs_process_query_volume_info(guac_rdpdr_device* device, wStream*
} }
void guac_rdpdr_fs_process_query_size_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_size_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id) { int file_id, int completion_id) {
/* STUB */ /* STUB */
guac_client_log_error(device->rdpdr->client, guac_client_log_error(device->rdpdr->client,
"Unimplemented stub: guac_rdpdr_fs_query_size_info"); "Unimplemented stub: guac_rdpdr_fs_query_size_info");
} }
void guac_rdpdr_fs_process_query_device_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_device_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id) { int file_id, int completion_id) {
/* STUB */ /* STUB */
guac_client_log_error(device->rdpdr->client, guac_client_log_error(device->rdpdr->client,
"Unimplemented stub: guac_rdpdr_fs_query_devive_info"); "Unimplemented stub: guac_rdpdr_fs_query_devive_info");
} }
void guac_rdpdr_fs_process_query_attribute_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_attribute_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id) { int file_id, int completion_id) {
/* STUB */ /* STUB */
guac_client_log_error(device->rdpdr->client, guac_client_log_error(device->rdpdr->client,
"Unimplemented stub: guac_rdpdr_fs_query_attribute_info"); "Unimplemented stub: guac_rdpdr_fs_query_attribute_info");
} }
void guac_rdpdr_fs_process_query_full_size_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_full_size_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id) { int file_id, int completion_id) {
/* STUB */ /* STUB */
guac_client_log_error(device->rdpdr->client, guac_client_log_error(device->rdpdr->client,
"Unimplemented stub: guac_rdpdr_fs_query_full_size_info"); "Unimplemented stub: guac_rdpdr_fs_query_full_size_info");

View File

@ -60,31 +60,31 @@
* file system is mounted." * file system is mounted."
*/ */
void guac_rdpdr_fs_process_query_volume_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_volume_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id); int file_id, int completion_id);
/** /**
* Processes a query request for FileFsSizeInformation. * Processes a query request for FileFsSizeInformation.
*/ */
void guac_rdpdr_fs_process_query_size_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_size_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id); int file_id, int completion_id);
/** /**
* Processes a query request for FileFsAttributeInformation. * Processes a query request for FileFsAttributeInformation.
*/ */
void guac_rdpdr_fs_process_query_attribute_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_attribute_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id); int file_id, int completion_id);
/** /**
* Processes a query request for FileFsFullSizeInformation. * Processes a query request for FileFsFullSizeInformation.
*/ */
void guac_rdpdr_fs_process_query_full_size_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_full_size_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id); int file_id, int completion_id);
/** /**
* Processes a query request for FileFsDeviceInformation. * Processes a query request for FileFsDeviceInformation.
*/ */
void guac_rdpdr_fs_process_query_device_info(guac_rdpdr_device* device, wStream* input_stream, void guac_rdpdr_fs_process_query_device_info(guac_rdpdr_device* device, wStream* input_stream,
int completion_id); int file_id, int completion_id);
#endif #endif

View File

@ -99,7 +99,7 @@ static void guac_rdpdr_device_fs_iorequest_handler(guac_rdpdr_device* device,
/* Query volume (drive) information */ /* Query volume (drive) information */
case IRP_MJ_QUERY_VOLUME_INFORMATION: case IRP_MJ_QUERY_VOLUME_INFORMATION:
guac_rdpdr_fs_process_volume_info(device, input_stream, completion_id); guac_rdpdr_fs_process_volume_info(device, input_stream, file_id, completion_id);
break; break;
/* Set volume (drive) information */ /* Set volume (drive) information */