Corinna Vinschen wrote: > On Nov 4 10:34, Corinna Vinschen wrote: >> On Nov 3 18:54, Christian Franke wrote: >>> ... >>> Conclusion: The behavior of the current patch is compatible with Linux :-) >> Ok, but with the DUID we have a workaround which makes it work even >> better than on Linux, so it would begreat if we used it, unless we find >> out where the UUID in "\GLOBAL??\Disk{} comes from... >> >> Given the size of the STORAGE_DEVICE_UNIQUE_IDENTIFIER struct, we could >> even contemplate a 128 bit hash, just to be on the safe side. > Kind of like this > > - strcat (name, ioctl_buf + desc->SerialNumberOffset); > + /* Use SerialNumber in the first place, if available */ > + if (desc->SerialNumberOffset && desc_buf[desc->SerialNumberOffset]) > + strcat (name, desc_buf + desc->SerialNumberOffset); > + else /* Utilize the DUID as defined by MSDN to generate a hash */ > + { > + union { > + unsigned __int128 all; > + struct { > + unsigned long high; > + unsigned long low; > + }; > + } hash = { 0 }; > + > + for (ULONG i = 0; i < id->Size; ++i) > + hash.all = ioctl_buf[i] + (hash.all << 6) + (hash.all << 16) - hash.all; > + __small_sprintf (name + strlen (name), "%X%X", hash.high, hash.low); > + } > New patch attached. Only fhandler/dev_disk.cc changed, devices.cc again not included. Christian