Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IRP_MJ_DIRECTORY_CONTROL #12870

Merged

Conversation

ibeckermayer
Copy link
Contributor

Adds support for IRP_MJ_DIRECTORY_CONTROL, adding support for SharedDirectoryListRequest and SharedDirectoryListResponse in the process.

Isaiah Becker-Mayer added 30 commits March 31, 2022 15:35
…and cliprdr::Client's have the vchan::Client as a field.
…o trigger it by right-clicking, however it isn't working. One reason is that the vchannel PDU header isn't being added (see rdpdr::encode_message for how that's added to other messages). Noticing that made me notice that there is another cliprdr function for breaking outgoing messages into chunks that should be refactored into vchan to do that work + add the necessary vchan headers. This is a checkpoint commit while I go attend to that.
…lient parses the DeviceCreateRequest that's immediately sent back
…ugh in most cases, no need to neurotically add every bit of the documentation text to the code itself
/// each res.fso_list[i].path MUST be a non-null pointer to a C-style null terminated string.
///
/// This function MUST NOT hang on to any of the pointers passed in to it after it returns.
/// All passed data that needs to persist after this function MUST be copied into Rust-owned memory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have an advisory that on relates to the inner function itself on the function docstring?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I see your point. The general idea was to add this advisory on all these functions at the FFI, in order to be very explicit about what's expected of them in terms of memory safety. Are you suggesting that this would more appropriately located at SharedDirectoryListResponse::from?

Copy link
Contributor

@xacrimon xacrimon Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. My thought process is that notes on the FFI functions are advisories to the caller mostly. For impl notes about something I usually lean on placing it as a non docstring inside the body since the caller doesn't care and thus the docs shouldn't either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See c07f3e5

Comment on lines 438 to 440
// fsoList is memory handled by Go, and will be freed
// by the garbage collector automatically sometime after
// this code block ends.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious the reasoning behind this comment. Any time you make a slice in Go the memory is handled by Go. Was there some reason we felt the need to clarify that here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the first time I'd needed to pass something non-trivial across the FFI; this is basically me baby-talking myself through the memory management logic. It can be removed from the production code.

lib/srv/desktop/rdp/rdpclient/src/rdpdr/mod.rs Outdated Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/src/rdpdr/mod.rs Outdated Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/src/rdpdr/mod.rs Outdated Show resolved Hide resolved
@@ -2164,6 +2496,7 @@ impl ClientDriveQueryDirectoryResponse {
})
}

// TODO(isaiah): make this logic more sane
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with leaving a TODO, but make it something more actionable. We're not likely to remember what this even means.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaiah Becker-Mayer and others added 3 commits June 28, 2022 16:24
@ibeckermayer ibeckermayer changed the base branch from isaiah/irp-mj-create-refactor to windows-desktop-directory-sharing June 28, 2022 20:50
@ibeckermayer ibeckermayer merged commit 05b7574 into windows-desktop-directory-sharing Jun 28, 2022
ibeckermayer pushed a commit that referenced this pull request Jul 6, 2022
ibeckermayer pushed a commit that referenced this pull request Jul 13, 2022
ibeckermayer pushed a commit that referenced this pull request Aug 23, 2022
* `IRP_MJ_CREATE` (#12665)

* `IRP_MJ_QUERY_INFORMATION` (#12717)

* `IRP_MJ_CLOSE` (#12729)

* Refactor rdpdr client (#12750)

* Adding logic for `FILE_SUPERSEDE` (#12829)

* Improve `process_irp_create` (#12830)

* adds return statements that got lost in a merge

* `IRP_MJ_DIRECTORY_CONTROL` (#12870)

* `FileFullDirectoryInformation` (#12908)

* Improve `ClientDriveQueryDirectoryResponse.encode()` (#12912)

* `IRP_MJ_QUERY_VOLUME_INFORMATION` (#13071)

* Fix Shared Directory Request handling when feature is disabled (#13439)

* IRP_MJ_READ, IRP_MJ_WRITE, and IRP_MJ_SET_INFORMATION (#13995)

* Adds constants for sizing calculations (#14051)

Co-authored-by: Łukasz Kozłowski <lukasz.kozlowski@goteleport.com>
Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
ibeckermayer pushed a commit that referenced this pull request Aug 23, 2022
* `IRP_MJ_CREATE` (#12665)

* `IRP_MJ_QUERY_INFORMATION` (#12717)

* `IRP_MJ_CLOSE` (#12729)

* Refactor rdpdr client (#12750)

* Adding logic for `FILE_SUPERSEDE` (#12829)

* Improve `process_irp_create` (#12830)

* adds return statements that got lost in a merge

* `IRP_MJ_DIRECTORY_CONTROL` (#12870)

* `FileFullDirectoryInformation` (#12908)

* Improve `ClientDriveQueryDirectoryResponse.encode()` (#12912)

* `IRP_MJ_QUERY_VOLUME_INFORMATION` (#13071)

* Fix Shared Directory Request handling when feature is disabled (#13439)

* IRP_MJ_READ, IRP_MJ_WRITE, and IRP_MJ_SET_INFORMATION (#13995)

* Adds constants for sizing calculations (#14051)

Co-authored-by: Łukasz Kozłowski <lukasz.kozlowski@goteleport.com>
Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
ibeckermayer pushed a commit that referenced this pull request Sep 7, 2022
…ring) (#15770)

* Windows Desktop Directory Sharing (#13630)

* `IRP_MJ_CREATE` (#12665)

* `IRP_MJ_QUERY_INFORMATION` (#12717)

* `IRP_MJ_CLOSE` (#12729)

* Refactor rdpdr client (#12750)

* Adding logic for `FILE_SUPERSEDE` (#12829)

* Improve `process_irp_create` (#12830)

* adds return statements that got lost in a merge

* `IRP_MJ_DIRECTORY_CONTROL` (#12870)

* `FileFullDirectoryInformation` (#12908)

* Improve `ClientDriveQueryDirectoryResponse.encode()` (#12912)

* `IRP_MJ_QUERY_VOLUME_INFORMATION` (#13071)

* Fix Shared Directory Request handling when feature is disabled (#13439)

* IRP_MJ_READ, IRP_MJ_WRITE, and IRP_MJ_SET_INFORMATION (#13995)

* Adds constants for sizing calculations (#14051)

Co-authored-by: Łukasz Kozłowski <lukasz.kozlowski@goteleport.com>
Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>

* `UnixPath` and `WindowsPath` (#14267)

* `SharedDirectoryMoveRequest` and `SharedDirectoryMoveResponse` (#14959)

* `SharedDirectoryCreateResponse` update (#15289)

* Fix `process_irp_set_information` (#15364)

* Sanitize Rust Debug Logs (#15743)

* updates rdp-rs ref to include licensing changes

* Updates rdp-rs ref and fixes Cargo

Co-authored-by: Łukasz Kozłowski <lukasz.kozlowski@goteleport.com>
Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
@zmb3 zmb3 deleted the isaiah/irp-mj-directory-control branch September 9, 2022 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants