rbtcollins / fs_at

Filesystem 'at' implementations for Unix and Windows
13 stars 15 forks source link

Migrate to windows[-sys] crate #40

Closed rbtcollins closed 1 year ago

rbtcollins commented 1 year ago

This is partially done, but a little stuck on:

@Xaeroxe offered in https://github.com/XAMPPRocky/remove_dir_all/pull/42 to help out; this is a call for that help :)

Xaeroxe commented 1 year ago

I'll take a look at this today or tomorrow

rbtcollins commented 1 year ago

I apologise in advance for some of the code quality; this was implemented from necessity - I think its broadly fine and there is room to tidy it up, isolate the unsafe more etc. Just shout out if anything is unobvious (for example why X function rather than Y which is supported).

And you can find me on the rust (https://discord.gg/rust-lang) discord as lifeless if you want chat in realtime.

Xaeroxe commented 1 year ago

https://github.com/microsoft/windows-rs/issues/2333

Is there a reason we couldn't just create a safe shim over RtlUnicodeStringInit? Seems the major feature of the *Ex version is that it can safely accept null pointers.

rbtcollins commented 1 year ago

RtlUnicodeString doesn't handle long strings correctly, ..Ex does. Compare https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/rtl/string/initunicodestringex.htm and https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/rtl/string/initunicodestring.htm

rbtcollins commented 1 year ago

(That said, I have no objection to using the non-Ex version, but we'll want to add the safety belts ourselves: since we're dealing with considerable unsafe code, I feel it is important to be as safe as possible ourselves).

Xaeroxe commented 1 year ago

PR up at https://github.com/rbtcollins/fs_at/pull/42

rbtcollins commented 1 year ago

Thank you, I've had a quick look.

I'm ok in principle with having local definitions as these things don't move super fast. OTOH the windows crate folk have been decently quick about the other bugs I've filed in the past, so perhaps lets get all the bugs filed and give them a week, and then if its still some undefined future time, we can merge and carry the local definitions.

Xaeroxe commented 1 year ago

Sounds good to me!