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

Replace non-WMI filesystem compression implemented in b31efb95 #253

Open
Tracked by #287
BinToss opened this issue Jan 9, 2022 · 5 comments · May be fixed by #292
Open
Tracked by #287

Replace non-WMI filesystem compression implemented in b31efb95 #253

BinToss opened this issue Jan 9, 2022 · 5 comments · May be fixed by #292
Labels
enhancement New feature or request p:HIGH

Comments

@BinToss
Copy link
Member

BinToss commented Jan 9, 2022

We'll use P/Invoke (built-in P/Invoke, dotnet/PInvoke, and/or CsWin32) to leverage DeviceIoControl for compression operations.

A FLOSS implementation such as DiscUtils is preferable, but there's a much higher risk disk error due to of developer-error.
Like many other file system utilities, it does not provide SetCompression methods or something similar. However, it provides everything needed to write this method.
This may also bypass file/directory handles.

The PR to close this issue is being held up by #232 which will be resolved by CodeDead/deadlock-dotnet-sdk

@BinToss BinToss changed the title Test non-WMI filesystem compression implemented in 60d1a7a8 Test non-WMI filesystem compression implemented in b31efb95 Feb 21, 2022
@BinToss
Copy link
Member Author

BinToss commented Feb 22, 2022

b31efb9
I hope this works the way I think it does.
I'm worried the attribute will be set without the file being compressed.


https://docs.microsoft.com/en-us/dotnet/api/system.io.fileattributes?view=net-6.0#remarks

It is not possible to change the compression status of a File object by using the File.SetAttributes method

@BinToss
Copy link
Member Author

BinToss commented Feb 26, 2022

Current Options

Traditional P/Invoke

pinvoke.net
PITA. Prefer the other two options.

P/Invoke and Win32 NuGet packages

github:dotnet/pinvoke
https://www.nuget.org/profiles/PInvoke
Most of what I'll use is in PInvoke.Kernel32

P/Invoke and Win32 code generation

github:microsoft/CsWin32
Produces smaller assemblies than PInvoke packages (when not using Trim).

@BinToss
Copy link
Member Author

BinToss commented Feb 27, 2022

DeviceIoControl sucks. It should be broken down into dozens if not hundreds of specific functions. Telling it what to do via const/enums is terrible for documentation. Some parameters aren't used or need to be passed slightly differently depending on the operation code you use.
I've lost count of how many times I rewritten the function call simply because I don't know what the operation needs from the parameters.
Does it expect a pointer of a specific type here?

Is it safe to cast SafeHandle to SafeObjectHandle?
Is it safe to case short* to void*?
Why do the PInvoke NuGet packages lack IOCTL constants?
Why is OmniSharp unable to use the code generated by CsWin32?
Why can't I do sizeof(typeof((short) variable))?

@BinToss BinToss mentioned this issue Mar 6, 2022
3 tasks
@BinToss BinToss changed the title Test non-WMI filesystem compression implemented in b31efb95 Replace non-WMI filesystem compression implemented in b31efb95 Mar 13, 2022
@BinToss
Copy link
Member Author

BinToss commented Mar 14, 2022

What was lost has been replaced...

@BinToss BinToss linked a pull request Mar 14, 2022 that will close this issue
4 tasks
@BinToss BinToss added p:HIGH enhancement New feature or request labels Mar 18, 2022
@BinToss BinToss linked a pull request Apr 10, 2022 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p:HIGH
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant