James,
I tested the code and found that it does not work using UNC and it also has another quirk.
The quirk is if the drive is "C:" it does not work but if I use "C:\" it works. Using either "D:" or "D:\" or higher, both operations work. Why it does not work with the "C" drive may be because I am running the app also from the "C" drive.
I added code to the routine to see just what is happening as well as using the xHarbour function for reading the serial number as well. The comments on the right of the code shows the returned results; first using a UNC (which doesn't exist on my system) as well as a drive letter from my local system.
- Code: Select all Expand view
Bogus UNC Valid local drive
msginfo(cDrive) // \\compaq\C: -- C:\
msginfo(nSerialHD(cDrive)) // 4524474 -- 1479837593
cHex := L2HEX(nSerialHD(cDrive))
cHex := LEFT(cHex,4) + "-" + RIGHT(cHex,4)
MSGINFO(cHex) //0045-09BA -- 5834-8799
msginfo(VolSerial(cDrive)) // -1 -- 1479837593.000000
cHex := L2HEX(VolSerial(cDrive))
cHex := LEFT(cHex,4) + "-" + RIGHT(cHex,4)
msginfo(cHex) // FFFF-FFFF -- 5834-8799
I also tried using a valid UNC which gave the same result.
In case my understanding is wrong, let me say that I was trying to go from an XP Pro system through a Netgrear router to an XP Home system. I tried all possibilities. "\\Aopen\boot" (the vol name of that particular drive), "\\Aopen\C", "\\Aopen\C:", "\\Aopen\C:\" etc. Every time the same codes were returned. It seems that the FiveWin function returns a bogus value while the xHarbour function retruns -1 if it cannot read the serial number.
Since the VOL command cannot read the serial using UNC notation may be the reason why these 2 functions can't do it either.