[PATCH v3 1/2] ntdll: Allow renaming a file/directory to a different casing of itself.

Gabriel Ivăncescu gabrielopcode at gmail.com
Fri Apr 16 07:56:54 CDT 2021


Hi,

Can someone review this please? I kept resending it to no avail—I'm of 
course open to *any* ideas how to fix this, it's not of concern and I 
have no strong opinions, just want it to work.

It does seem that prepending more data (such as the NtName now) is ok at 
the very least, so it can't be obviously too wrong or unacceptable. BTW 
I also made sure it can't crash the wineserver no matter what data it 
sends; I have checks for overflow.

We have to prepend the casing data due to the fact that:

1) We need the exact actual filename (without true casing) to test on 
the wineserver to see if it's the same file. This is important.

2) We need the casing of it, to know what to rename it into. Note that 
this is only needed in case it's different than the filename. For files 
that don't exist, no casing is prepended, and it's identical to before.

For already existing files, we still need the old (existing) filename, 
even if we somehow check some other way for "same file", because we need 
to remove the file first (unlink), then rename the new one into the 
actual casing (tests demonstrate this).

For example: existing file 'foobar' and 'bazfoo'. Rename file 'bazfoo' 
into 'FooBar' and replace the original 'foobar'. In this case, 'bazfoo' 
will now be called 'FooBar' (new casing) and the original 'foobar' is gone.

This patch also updates the NtName to use the actual casing of course, 
so it matches the new file name.

Thanks,
Gabriel



More information about the wine-devel mailing list