Implement rest of dir info.

This commit is contained in:
Michael Jumper 2013-12-11 14:11:16 -08:00
parent 672e20c051
commit 5e87949e31

View File

@ -53,16 +53,87 @@
void guac_rdpdr_fs_process_query_directory_info(guac_rdpdr_device* device, void guac_rdpdr_fs_process_query_directory_info(guac_rdpdr_device* device,
const char* entry_name, int file_id, int completion_id) { const char* entry_name, int file_id, int completion_id) {
/* STUB */ guac_rdp_fs_file* file;
GUAC_RDP_DEBUG(2, "[file_id=%i (entry_name=\"%s\")] STUB", file_id, entry_name);
wStream* output_stream;
int length = guac_utf8_strlen(entry_name);
int utf16_length = length*2;
unsigned char utf16_entry_name[256];
guac_rdp_utf8_to_utf16((const unsigned char*) entry_name, (char*) utf16_entry_name, length);
/* Get file */
file = guac_rdp_fs_get_file((guac_rdp_fs*) device->data, file_id);
if (file == NULL)
return;
GUAC_RDP_DEBUG(2, "[file_id=%i (entry_name=\"%s\")]", file_id, entry_name);
output_stream = guac_rdpdr_new_io_completion(device, completion_id,
STATUS_SUCCESS, 4 + 64 + utf16_length + 2);
Stream_Write_UINT32(output_stream,
64 + utf16_length + 2); /* Length */
Stream_Write_UINT32(output_stream, 0); /* NextEntryOffset */
Stream_Write_UINT32(output_stream, 0); /* FileIndex */
Stream_Write_UINT64(output_stream, file->ctime); /* CreationTime */
Stream_Write_UINT64(output_stream, file->atime); /* LastAccessTime */
Stream_Write_UINT64(output_stream, file->mtime); /* LastWriteTime */
Stream_Write_UINT64(output_stream, file->mtime); /* ChangeTime */
Stream_Write_UINT64(output_stream, file->size); /* EndOfFile */
Stream_Write_UINT64(output_stream, file->size); /* AllocationSize */
Stream_Write_UINT32(output_stream, file->attributes); /* FileAttributes */
Stream_Write_UINT32(output_stream, utf16_length+2); /* FileNameLength*/
Stream_Write(output_stream, utf16_entry_name, utf16_length); /* FileName */
Stream_Write(output_stream, "\0\0", 2);
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);
} }
void guac_rdpdr_fs_process_query_full_directory_info(guac_rdpdr_device* device, void guac_rdpdr_fs_process_query_full_directory_info(guac_rdpdr_device* device,
const char* entry_name, int file_id, int completion_id) { const char* entry_name, int file_id, int completion_id) {
/* STUB */ guac_rdp_fs_file* file;
GUAC_RDP_DEBUG(2, "[file_id=%i (entry_name=\"%s\")] STUB", file_id, entry_name);
wStream* output_stream;
int length = guac_utf8_strlen(entry_name);
int utf16_length = length*2;
unsigned char utf16_entry_name[256];
guac_rdp_utf8_to_utf16((const unsigned char*) entry_name, (char*) utf16_entry_name, length);
/* Get file */
file = guac_rdp_fs_get_file((guac_rdp_fs*) device->data, file_id);
if (file == NULL)
return;
GUAC_RDP_DEBUG(2, "[file_id=%i (entry_name=\"%s\")]", file_id, entry_name);
output_stream = guac_rdpdr_new_io_completion(device, completion_id,
STATUS_SUCCESS, 4 + 68 + utf16_length + 2);
Stream_Write_UINT32(output_stream,
68 + utf16_length + 2); /* Length */
Stream_Write_UINT32(output_stream, 0); /* NextEntryOffset */
Stream_Write_UINT32(output_stream, 0); /* FileIndex */
Stream_Write_UINT64(output_stream, file->ctime); /* CreationTime */
Stream_Write_UINT64(output_stream, file->atime); /* LastAccessTime */
Stream_Write_UINT64(output_stream, file->mtime); /* LastWriteTime */
Stream_Write_UINT64(output_stream, file->mtime); /* ChangeTime */
Stream_Write_UINT64(output_stream, file->size); /* EndOfFile */
Stream_Write_UINT64(output_stream, file->size); /* AllocationSize */
Stream_Write_UINT32(output_stream, file->attributes); /* FileAttributes */
Stream_Write_UINT32(output_stream, utf16_length+2); /* FileNameLength*/
Stream_Write_UINT32(output_stream, 0); /* EaSize */
Stream_Write(output_stream, utf16_entry_name, utf16_length); /* FileName */
Stream_Write(output_stream, "\0\0", 2);
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);
} }
@ -117,8 +188,35 @@ void guac_rdpdr_fs_process_query_both_directory_info(guac_rdpdr_device* device,
void guac_rdpdr_fs_process_query_names_info(guac_rdpdr_device* device, void guac_rdpdr_fs_process_query_names_info(guac_rdpdr_device* device,
const char* entry_name, int file_id, int completion_id) { const char* entry_name, int file_id, int completion_id) {
/* STUB */ guac_rdp_fs_file* file;
GUAC_RDP_DEBUG(2, "[file_id=%i (entry_name=\"%s\")] STUB", file_id, entry_name);
wStream* output_stream;
int length = guac_utf8_strlen(entry_name);
int utf16_length = length*2;
unsigned char utf16_entry_name[256];
guac_rdp_utf8_to_utf16((const unsigned char*) entry_name, (char*) utf16_entry_name, length);
/* Get file */
file = guac_rdp_fs_get_file((guac_rdp_fs*) device->data, file_id);
if (file == NULL)
return;
GUAC_RDP_DEBUG(2, "[file_id=%i (entry_name=\"%s\")]", file_id, entry_name);
output_stream = guac_rdpdr_new_io_completion(device, completion_id,
STATUS_SUCCESS, 4 + 12 + utf16_length + 2);
Stream_Write_UINT32(output_stream,
12 + utf16_length + 2); /* Length */
Stream_Write_UINT32(output_stream, 0); /* NextEntryOffset */
Stream_Write_UINT32(output_stream, 0); /* FileIndex */
Stream_Write_UINT32(output_stream, utf16_length+2); /* FileNameLength*/
Stream_Write(output_stream, utf16_entry_name, utf16_length); /* FileName */
Stream_Write(output_stream, "\0\0", 2);
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);
} }