Andvar
29th October 2007 11:09 UTC
How to get Harddisk's physical serial number in nsis?
Hi all.
I add a register page in my installer script.
The problem is how to genarate a machine-only code.
fist i use the CPUdesc plug-in,but this plug give a rough
info about CPU, and the most important--the info isnot one and only. I and my roommate both use AMD CPU,but the the CPUdesc plug-in gives the same info. Then i think about MAC and harddisk physical serial number,but MAC can be modified,so the most suitable is harddisk physical serial number.But I donot know how to get it. I found a post about how to get Volume number,but if you format you disk,the number changes.
So only the harddisk physical serial number donot change. I think may be I can use the System plug-in to invoke some windows API to get the physical serial number,but I am not familar with windows API.Could someone do me a favor to help?Many thanks!
Afrow UK
29th October 2007 12:41 UTC
You can put this code into a C# executable and execute it at run time with nsExec::ExecToStack to capture its output.
http://www.codeproject.com/csharp/ha...k_serialno.asp
You'd also need to ensure the users have .NET.
Stu
pospec
29th October 2007 13:37 UTC
Maybe a .dll should be better. I've found one HERE but it is shareware.
thek
29th October 2007 13:43 UTC
Hi
you can use the followign command at the shell
dir | findstr /C:"Volume Serial Number"
(attention it only works on english system, for different languages you have to parse the text more "intelligent"
But bad news for you, the HDD Id can also be faked!
quite easily when using some "Image" Backup tool because they overwrite the HDD-ID .
We had the same Problem, the only "faileproof" version would be to use the low level CPU-ID from the Prozessor (Intel and AMD have one) but the can be deactivated, so you have to tell your user they "MUST" activated theire CPU-ID
Also this ID is only available with newer CPU Generation (I think Intel introduced it with their P4 Series, but I'm not sure)
We used a different approach:
We created a unique ID based on the MAC-Adresse(s), CPUInfo (not the ID, only family info and so on), HDD-ID, hostname and several more. This is not 100 % fail proof, but it makes it harder to reverse engineer it.
kichik
29th October 2007 19:47 UTC
Or search the wiki for serial and find:
http://nsis.sourceforge.net/Get_Disk..._Serial_Number
Andvar
30th October 2007 02:58 UTC
Thanks for all your replys.
To kichik:I've read that aticle,but Disk Volume Serial Number is different from harddisk's physical serial number,which is assigned by the disk vendor like MAC address.
As i mentioned in my previous post: if you format your disk
,your Disk Volume Serial Number changes.