Useful with unix integration of redirected standard handles. Simple testcase:
```c #include <windows.h> #include <stdio.h>
int main(int argc, char **argv) { char buf[4096] = {0}; FILE_NAME_INFO *name_info = (FILE_NAME_INFO*)buf;
if (!GetFileInformationByHandleEx(GetStdHandle(STD_OUTPUT_HANDLE), FileNameInfo, name_info, sizeof(buf))) { fprintf(stderr, "GetFileInformationByHandleEx failed %08lx\n", GetLastError()); return 1; }
WriteFile(GetStdHandle(STD_ERROR_HANDLE), name_info->FileName, name_info->FileNameLength, NULL, NULL); return 0; } ``` On Windows: ``` test.exe > C:\Temp\test.txt ``` Output: ``` \Temp\test.txt ``` On wine: ``` wine test.exe > /tmp/wine/testprefix/drive_c/Temp/test.txt ``` Upstream output: ``` GetFileInformationByHandleEx failed 00000006 ``` With this MR: ``` \Temp\test.txt ```
-- v2: server: Try to retrieve the unix name on handles created from file