Skip to content

Commit

Permalink
IRP_MJ_QUERY_INFORMATION (#12717)
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaiah Becker-Mayer committed Jul 13, 2022
1 parent af886a9 commit cef7d8e
Show file tree
Hide file tree
Showing 2 changed files with 251 additions and 98 deletions.
64 changes: 32 additions & 32 deletions lib/srv/desktop/rdp/rdpclient/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,38 @@ impl From<CGOSharedDirectoryInfoResponse> for SharedDirectoryInfoResponse {
}
}

/// FileSystemObject is a TDP structure containing the metadata
/// of a file or directory.
#[derive(Debug)]
#[allow(dead_code)]
pub struct FileSystemObject {
last_modified: u64,
size: u64,
file_type: u32, // TODO(isaiah): make an enum
path: String,
}

#[repr(C)]
pub struct CGOFileSystemObject {
pub last_modified: u64,
pub size: u64,
pub file_type: u32, // TODO(isaiah): make an enum
pub path: *const c_char,
}

impl From<CGOFileSystemObject> for FileSystemObject {
fn from(cgo_fso: CGOFileSystemObject) -> FileSystemObject {
unsafe {
FileSystemObject {
last_modified: cgo_fso.last_modified,
size: cgo_fso.size,
file_type: cgo_fso.file_type,
path: from_go_string(cgo_fso.path),
}
}
}
}

/// SharedDirectoryCreateRequest is sent by the TDP server to
/// the client to request the creation of a new file or directory.
#[derive(Debug)]
Expand Down Expand Up @@ -1095,38 +1127,6 @@ pub struct CGOSharedDirectoryDeleteRequest {
pub path: *const c_char,
}

/// FileSystemObject is a TDP structure containing the metadata
/// of a file or directory.
#[derive(Debug)]
#[allow(dead_code)]
pub struct FileSystemObject {
last_modified: u64,
size: u64,
file_type: u32, // TODO(isaiah): make an enum
path: String,
}

#[repr(C)]
pub struct CGOFileSystemObject {
pub last_modified: u64,
pub size: u64,
pub file_type: u32, // TODO(isaiah): make an enum
pub path: *const c_char,
}

impl From<CGOFileSystemObject> for FileSystemObject {
fn from(cgo_fso: CGOFileSystemObject) -> FileSystemObject {
unsafe {
FileSystemObject {
last_modified: cgo_fso.last_modified,
size: cgo_fso.size,
file_type: cgo_fso.file_type,
path: from_go_string(cgo_fso.path),
}
}
}
}

/// SharedDirectoryDeleteResponse is sent by the TDP client to the server
/// to acknowledge a SharedDirectoryDeleteRequest was received and executed.
pub type SharedDirectoryDeleteResponse = SharedDirectoryCreateResponse;
Expand Down
Loading

0 comments on commit cef7d8e

Please sign in to comment.