Hi @Kyle Russell ,
Thank for posting.
The supplied arguments do not establish a specific violation of the documented Win32 contract, and error 87 alone does not identify which parameter was rejected.
The Win32 FILE_RENAME_INFO documentation explicitly permits a non-null RootDirectory when FileName is relative. It does not exclude a directory handle that refers to the source's existing parent.
Regarding the terminator, the documentation contains conflicting wording: FileName is described as NUL-terminated, but FileNameLength explicitly says that a terminating null character is not required. Based on that wording, the missing terminator alone does not establish a violation. Your buffer calculation is also consistent: 20 + 180 = 200 bytes.
Abour the access and sharing:
- The source handle includes
DELETE, which rename requires. - Nothing in the cited
SetFileInformationByHandleor rename documentation identifies the reported share mask, by itself, as anERROR_INVALID_PARAMETERcondition. - The directory mask
0x81lacksFILE_TRAVERSE. The driver documentation recommends traverse plus read-attributes to avoid sharing conflicts with an internal directory open, but that recommendation does not establish your mask as the cause of error 87. Directory permissions and other open handles still matter.
The driver documentation's NULL-root guidance describes the native interface: for a simple same-directory rename, it specifies RootDirectory = NULL, while separately documenting a relative-name form using a target-directory handle. This does not, by itself, establish that the directory-relative form expressly allowed by the Win32 page is forbidden.
For diagnosis, SetFileInformationByHandle exposes no documented facility that reports which structure member was rejected.
For deeper diagnosis, one option is to inspect the failing call under WinDbg and determine whether execution reaches ntdll!NtSetInformationFile. If it does, the native arguments and returned NTSTATUS may help distinguish a Win32-layer rejection from a lower-level failure. This is a diagnostic technique rather than part of the documented Win32 contract.
Also note that native FileRenameInformation and Win32 FileRenameInfo use different enumeration values: Win32 FileRenameInfo is class 3, whereas native FileRenameInformation is class 10.
Changing RootDirectory to NULL or adding a terminator could still be useful as controlled A/B tests, but success would only isolate which change affects the behavior. It would not, by itself, resolve the documentation discrepancy or prove that the original call violated a documented Win32 requirement.
If you found my support helpful, I’d really appreciate it if you could follow this guide so others with similar issue can benefit as well.
Thank you.