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

Add projectedfslib #910

Open
wants to merge 7 commits into
base: 0.3
Choose a base branch
from
Open

Add projectedfslib #910

wants to merge 7 commits into from

Conversation

fanzeyi
Copy link

@fanzeyi fanzeyi commented Jun 18, 2020

This PR adds bindings to Projected File System.

I want to open a pull request to avoid duplicate works. I think most things should work. However there are a few structs are not passing the structs x64 test because of possible incorrect definition of anonymous unions.

I also want to spend some time replicating the official RegFS example with this API, so we can be confident that this binding works fine.

  • Fix struct-x64 tests
  • Replicate RegFS example

Generated with:

```cpp
// This  ensures all anonymous structs and unions have a field name so you can get its size and alignment
 #define NONAMELESSUNION
 #include <cstdint>
 #include <iostream>
 #include <BaseTsd.h>
 #include <windows.h>
 #include <projectedfslib.h>

// Include whichever windows SDK headers are needed to get the correct types. Note that some headers cannot be included directly.
 #define PRINT(x) std::cout << "    assert_eq!(size_of::<"#x">(), " << sizeof(x) << ");" << std::endl;\
    std::cout << "    assert_eq!(align_of::<"#x">(), " << alignof(x) << ");" << std::endl;
int main() {
    PRINT(PRJ_NOTIFY_TYPES);
    PRINT(PRJ_NOTIFICATION);
    PRINT(PRJ_EXT_INFO_TYPE);
    PRINT(decltype(PRJ_EXTENDED_INFO::u.Symlink));
    PRINT(decltype(PRJ_EXTENDED_INFO::u));
    PRINT(PRJ_EXTENDED_INFO);
    PRINT(PRJ_NOTIFICATION_MAPPING);
    PRINT(PRJ_STARTVIRTUALIZING_FLAGS);
    PRINT(PRJ_STARTVIRTUALIZING_OPTIONS);
    PRINT(PRJ_VIRTUALIZATION_INSTANCE_INFO);
    PRINT(PRJ_PLACEHOLDER_ID);
    PRINT(PRJ_PLACEHOLDER_VERSION_INFO);
    PRINT(PRJ_FILE_BASIC_INFO);
    PRINT(decltype(PRJ_PLACEHOLDER_INFO::EaInformation));
    PRINT(decltype(PRJ_PLACEHOLDER_INFO::SecurityInformation));
    PRINT(decltype(PRJ_PLACEHOLDER_INFO::StreamsInformation));
    PRINT(PRJ_PLACEHOLDER_INFO);
    PRINT(PRJ_UPDATE_TYPES);
    PRINT(PRJ_UPDATE_FAILURE_CAUSES);
    PRINT(PRJ_FILE_STATE);
    PRINT(PRJ_CALLBACK_DATA_FLAGS);
    PRINT(PRJ_CALLBACK_DATA);
    PRINT(decltype(PRJ_NOTIFICATION_PARAMETERS::PostCreate));
    PRINT(decltype(PRJ_NOTIFICATION_PARAMETERS::FileRenamed));
    PRINT(decltype(PRJ_NOTIFICATION_PARAMETERS::FileDeletedOnHandleClose));
    PRINT(PRJ_NOTIFICATION_PARAMETERS);
    PRINT(PRJ_CALLBACKS);
    PRINT(PRJ_COMPLETE_COMMAND_TYPE);
    PRINT(decltype(PRJ_COMPLETE_COMMAND_EXTENDED_PARAMETERS::u.Notification));
    PRINT(decltype(PRJ_COMPLETE_COMMAND_EXTENDED_PARAMETERS::u.Enumeration));
    PRINT(decltype(PRJ_COMPLETE_COMMAND_EXTENDED_PARAMETERS::u));
    PRINT(PRJ_COMPLETE_COMMAND_EXTENDED_PARAMETERS);
    return 0;
}
```
@fanzeyi fanzeyi changed the title [WIP] Add projectedfslib Add projectedfslib Jun 19, 2020
src/um/projectedfslib.rs Outdated Show resolved Hide resolved
@retep998 retep998 added the waiting on review Waiting for a reviewer to review the PR label Jun 19, 2020
@fanzeyi
Copy link
Author

fanzeyi commented Jul 22, 2020

Alright, I've finished rewriting the RegFS example in Rust. It is available here: https://github.com/fanzeyi/prjfs-rs and it uses fairly amount of the API I added in this PR. It works!

byteOffset: UINT64,
length: UINT32,
) -> HRESULT;
pub fn PrjGetOnDiskFileState(destinationFileName: PCWSTR, fileState: *mut PRJ_FILE_STATE);
Copy link

Choose a reason for hiding this comment

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

This function should return an HRESULT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting on review Waiting for a reviewer to review the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants