-
-
Notifications
You must be signed in to change notification settings - Fork 391
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 fltlib API #923
Add fltlib API #923
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires changes.
-
Organization of code
- All definitions go into the source file that directly maps to the header the definition is from:
⚠️ some definitions in fltuser should go in a separateshared::fltuserstructures
module.
- Definitions are defined in the same order as they are in the original header
⚠️ Definitions are not given in the same order as the original header.
- All definitions go into the source file that directly maps to the header the definition is from:
-
Extern functions
- ABIS are correct (WINAPI = "system"): ✔️
- Names are correct (functions, parameters): ✔️
- Parameter types are correct:
⚠️ PHANDLE used instead of *mut HANDLE (resolves to the same underlying type). - Return types are correct: ✔️
-
Constants
- Names are correct: ✔️
- Values are correct: ✔️
- Types are correct: ✔️
- All the ULONG consts go in various ULONG members of structures.
FLT_PORT_FLAG_SYNC_HANDLE
is used withFilterConnectCommunicationPort
' dwOptions, a DWORD.
-
Structs
- Struct definitions are wrapped in
STRUCT!
macro: ✔️ - Struct names are correct:
⚠️ problems around anonymous names - Param names are correct: ✔️
- Param types are correct: ✔️
- Struct definitions are wrapped in
-
Unions
- Unions are wrapped in the
UNION!
macro: ✔️ - Union names are correct:
⚠️ problems around anonymous unions - Union container size is correct: ✔️
- Union member names are correct: ✔️
- Union member mutable accessor is in form
FieldName_mut
:⚠️ - Union member types are correct: ✔️
- Unions are wrapped in the
-
Enums
- Enum definitions are wrapped in
ENUM!
macro: ✔️ - Enum names are correct: ✔️
- Enum variant names are correct: ✔️
- Enum variant values are correct: ✔️
- Enum definitions are wrapped in
src/um/fltuser.rs
Outdated
pub fn FilterUnload( | ||
lpFilterName: LPCWSTR | ||
) -> HRESULT; | ||
// FilterVolumeClose@4 // ????? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// FilterVolumeClose@4 // ????? |
Not sure what this comment is about? I couldn't find FilterVolumeClose in the header.
src/um/fltuser.rs
Outdated
use shared::ntdef::NTSTATUS; | ||
use um::minwinbase::{LPOVERLAPPED, LPSECURITY_ATTRIBUTES}; | ||
use um::winnt::{HANDLE, HRESULT, LPCWSTR, LPWSTR, PHANDLE, ULONGLONG, WCHAR}; | ||
pub type HFILTER = HANDLE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of those definitions should go in a module shared::fltuserstructures
, as they are defined in a header called shared/fltuserstructures.h
src/um/fltuser.rs
Outdated
use um::minwinbase::{LPOVERLAPPED, LPSECURITY_ATTRIBUTES}; | ||
use um::winnt::{HANDLE, HRESULT, LPCWSTR, LPWSTR, PHANDLE, ULONGLONG, WCHAR}; | ||
pub type HFILTER = HANDLE; | ||
pub type PHFILTER = *mut HFILTER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub type PHFILTER = *mut HFILTER; |
I couldn't find PHFILTER
in the windows header files.
src/um/fltuser.rs
Outdated
pub type HFILTER = HANDLE; | ||
pub type PHFILTER = *mut HFILTER; | ||
pub type HFILTER_INSTANCE = HANDLE; | ||
pub type PHFILTER_INSTANCE = *mut HFILTER_INSTANCE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub type PHFILTER_INSTANCE = *mut HFILTER_INSTANCE; |
I couldn't find PHFILTER_INSTANCE
in the windows header files.
src/um/fltuser.rs
Outdated
FLT_FSTYPE_CIMFS, //Composite Image file system (\FileSystem\cimfs) | ||
}} | ||
ENUM!{enum FILTER_INFORMATION_CLASS { | ||
FilterFullInformation = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FilterFullInformation = 0, | |
FilterFullInformation, |
Windows header file doesn't specify = 0
.
src/um/fltuser.rs
Outdated
UNION!{union INSTANCE_AGGREGATE_STANDARD_INFORMATION_Type_u { | ||
[u32; 8], | ||
MiniFilter mut_MiniFilter: INSTANCE_AGGREGATE_STANDARD_INFORMATION_u_s_MiniFilter, | ||
LegacyFilter mut_LegacyFilter: INSTANCE_AGGREGATE_STANDARD_INFORMATION_u_s_LegacyFilter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LegacyFilter mut_LegacyFilter: INSTANCE_AGGREGATE_STANDARD_INFORMATION_u_s_LegacyFilter, | |
LegacyFilter LegacyFilter_mut: INSTANCE_AGGREGATE_STANDARD_INFORMATION_Type_LegacyFilter, |
src/um/fltuser.rs
Outdated
STRUCT!{struct INSTANCE_AGGREGATE_STANDARD_INFORMATION { | ||
NextEntryOffset: ULONG, | ||
Flags: ULONG, | ||
Type: INSTANCE_AGGREGATE_STANDARD_INFORMATION_Type_u, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type: INSTANCE_AGGREGATE_STANDARD_INFORMATION_Type_u, | |
Type: INSTANCE_AGGREGATE_STANDARD_INFORMATION_Type, |
src/um/fltuser.rs
Outdated
lpContext: LPCVOID, | ||
wSizeOfContext: WORD, | ||
lpSecurityAttributes: LPSECURITY_ATTRIBUTES, | ||
hPort: PHANDLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hPort: PHANDLE | |
hPort: *mut HANDLE |
The windows header file uses a raw pointer here.
src/um/fltuser.rs
Outdated
) -> HRESULT; | ||
pub fn FilterCreate( | ||
lpFilterName: LPCWSTR, | ||
hFilter: PHFILTER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hFilter: PHFILTER | |
hFilter: *mut HFILTER |
src/um/fltuser.rs
Outdated
lpFilterName: LPCWSTR, | ||
lpVolumeName: LPCWSTR, | ||
lpInstanceName: LPCWSTR, | ||
hInstance: PHFILTER_INSTANCE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hInstance: PHFILTER_INSTANCE | |
hInstance: *mut HFILTER_INSTANCE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
All problems from previous review fixed!
Any estimate on when this will be merged and when a new version will be published? |
this PR adds support for fltlib API :
This way, winapi is (normally) able to load/unload, connect to a minifilter..