it appears that calling GetFinalPathNameByHandle on files on a RAM disk fails with ERROR_INVALID_FUNCTION, which seems to be translated from an NTSTATUS of STATUS_INVALID_DEVICE_REQUEST.
This causes trouble with some MSI installers. For example, Evernote updates won't run because my Temp directory is on a RAM disk, and the installer calls GetFinalPathNameByHandle and this ends up as an error box "The system cannot open the device or file specified." for some reason. The log shows "Error: Getting file path failed: R:\Temp\Evernote.msi, error = 1".
This seems to affect others as well, see for example https://developercom...ckageac-14.html or https://forums.virtu...php?f=6&t=92826. Of course I can't tell what RAM disk software those people are using, but it's likely that it's the same issue.
I wrote a FreeBASIC program that can reproduce this problem:
#Define _WIN32_WINNT &h0602 #Include "windows.bi" Sub Test(filename As String) Var hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ Or FILE_SHARE_WRITE Or FILE_SHARE_DELETE, NULL, OPEN_EXISTING, NULL, NULL) Dim s As ZString * MAX_PATH Var res = GetFinalPathNameByHandle(hFile, @s, SizeOf(s) - 1, FILE_NAME_OPENED) Var lastError = GetLastError() CloseHandle(hFile) Print filename, res, lastError, s End Sub Test("c:\windows\explorer.exe") Test("r:\temp\update.dat") Sleep /' RESULT: c:\windows\explorer.exe 27 0 \\?\C:\Windows\explorer.exe r:\temp\update.dat 0 1 '/
As you can see here, calling GetFinalPathNameByHandle on a file on C:\ works as expected, while calling it on a file on R:\ (my RAM disk) returns error 1.
I'd be happy if this could be addressed.
EDIT: I installed the RAM disk several months ago, and I wasn't able to figure out which version it is (because I get all kinds of version numbers from the EXE files, e.g. config.exe is 184.108.40.206, RAMDiskUI.exe is 220.127.116.11, ...), but I see that there was an update in November, so it's possible I don't have the latest version. However I cannot reboot my computer right now so I cannot say if an update will fix it - in case this is already known and fixed, please excuse my useless post then.
Edited by Cherry, 25 April 2019 - 10:23 AM.