I have seen this question before, but I can't seem to find any answers. Is it possible to get the drive serial number (for protection / verification of written routines) (vla-get-property drive 'serialnumber) --which does not work for me-- I have seen a lisp routine on http://www.menziengineering.ch/Downloads/Download.htm#22 but it requires additional installation of a scripting file named ScrRun.dll. I would like to avoid this and think this should be possible within visual lisp. any ideas? Robert Good.
An alternative method using native Autolisp; ; SERIAL.LSP - Routine to return the hard drive volume label. ; ========== ; suggested use ---> (setq SERIAL_NUM (SERIAL)) ; (defun SERIAL (/ OLDECHO FILE NUM ) (setq OLDECHO (getvar "CMDECHO")) (setvar "CMDECHO" 0) (command "_SHELL" "DIR C:\\ DIR > C:\\DIRLIST.TXT") (while (not (findfile "C:/DIRLIST.TXT"))) (setq FILE (open "C:/DIRLIST.TXT" "r")) (setq NUM (read-line FILE)) (setq NUM (read-line FILE)) (close FILE) (while (not NUM)) (command "_SHELL" "ERASE C:\\DIRLIST.TXT") (setvar "CMDECHO" OLDECHO) (princ NUM) )
The serial number can also be found in the registry somewhere. I am not sure where though. Thanks Chad Wanelss
I have been trying to do this myself, but so far have not had any luck. There is a Windows class that can be used from VB (and therefore ActiveX and then VLisp (maybe)), but it only works on Windows XP. I have been trying ot find out if it can be used on other OS's but so far no luck. I have found someone that says he can get it on any OS without using this class, but he has not gotten back to me yet. The class is Win32_PhysicalMedia just in case you want to try it.
Does this return the HardDrive serial number from the firmware, or just the volume serial number? The volume serial number can easily be changed by the user.
This gives you the volume serial number and not the actual hard drive serial number. The user can easily change the volume serial number.
That would be a good question for McNeel & Assoc's. I (think) it is just the volume serial number. But, this is good. If you 'start' your app, checking the Hard Drive SN, and the user decides to change it..your app would not fire. I think that's the point. Bob
With all due respect to Doslib, it's a wonderful utility. But beware that if you are using dos_serial number to get the hard drive serial number for copy protection, that your scheme might be easily cracked if someone knows at least one of the harddisk serial numbers that you application checks for. Say for example on a machine that is licensed to use your application, dos_serialno returns might return something like the following: (dos_serialno "C:") -> "3d575430" Know if someone knows a good hard disk serial number they could overwrite the dos_serialno function like this allow your application to run: (defun dos_serialno (x) (print "3d575430") (princ) ) One way to deal with this issue is reload DosLib just before running a check on the serial number. Regards, Steve Doman
Yes, but it is easily copied to another system, so it provides minimal copy protection. If I know an application used the volume serial number, I can copy the software to another system and set its volume serial number to be the same and the software will work fine. I have finally found out how to get the "true" serial number, but it is complex and in "C" only. I do not know enough about VB or VLisp to know if it can be translated to them, and kinda doubt it, since it relies on specific structures with specific byte alignment and has to do a lot of bit manipulation to get the serial number. I am also still testing it in all environments with limited permission users and such.
Even reloading doslib would not be a guarentee, since they could replace it with a different file named the same that loads the true doslib file and then redefines the function.
Randy, Good point. And alternative approach is to write your own function to get the hard disk serial number. I don't have any experience doing that, but I did read a tutorial by Stig Madsen at the link below, that tells how to use AutoLISP to access the Windows Script Host in order to get the hard disk serial number. I haven't tried this method yet, but it looks promising. http://www.afralisp.com/lisp/script1.htm Steve
Juerg, your routine requires the use of the ScrRun.dll. Im guessing this is the windows scripting extension. How can you tell thru visual lisp that this program is running. also, if it is not running / installed can you do it thru lisp?
Hi Robert Windows Script Components are part of the OS since Win2k/XP. If you're using WinNT4/Win9x you've to download Windows Script Runtime from: http://msdn.microsoft.com/scripting To check the availability of the components by Vlisp use following code: (defun VxCheckWsc ( / FilSys) (if (vl-catch-all-error-p (vl-catch-all-apply (function (lambda () (setq FilSys (vlax-create-object "Scripting.FileSystemObject")) ) ) ) ) (alert "Windows Script Components not installed.") (or (vlax-release-object FilSys) T) ) ) Returns T if installed, else nil (and an error message) Installation can be done by the components setup wizard. Cheers
I ran a quick test and I am not sure what this is getting, but it is not the drive serial number. It is some variation of the volume serial number. If I run it with "c:" or "d:" I get different numbers, even though both those drives are partitions on the same physical drive. If it is some variation of the volume serial number it can be duplicated on another machine.