Use fileID from FILE_ID_BOTH_DIR_INFO for the stat ino field on Win32
Closed this issue · 4 comments
isaacs commented
piscisaureus commented
Agreed, with the following notes:
- FILE_ID_BOTH_DIR_INFO can only be read when enumerating a directory. We can also query this information with NtQueryInformationFile using the IndexNumber field (see http://msdn.microsoft.com/en-us/library/windows/hardware/ff540318(v=vs.85).aspx)
- A problem is that the file id is a 64-bit integer.
struct stat
on windows does not accommodate a 64-bit integer in thest_ino
field, so we'd have to define our ownstruct uv_stat
. - Javascript cannot represent 64-bit integers reliably, so for node additional creativity is needed.
isaacs commented
So, it's a bit hacky... but... is the st_dev
set to zero as well? Maybe the high 32 bits can be used for the st_dev, and the low 32 can be the inode? Of course, this will break programs that use the dev number to actually determine the device, but I wonder how many of those there are, actually. In reality, you can't rely on just st.st_ino anyway, you have to also consider the st_dev, since the same inode on two different devices is not the same file.
piscisaureus commented
st_dev is currently zero for the same reason.
piscisaureus commented
Fixed in 20a8e58