Author Topic: CPU serial number  (Read 4136 times)

0 Members and 1 Guest are viewing this topic.

myloveflyer

  • Newt
  • Posts: 152
CPU serial number
« on: July 30, 2010, 09:21:51 PM »
;;by lxx
;; (cpuid) -> "078BFBFF00000F7A"
(defun cpuid (/ str)
   (setq str
   "Set objSWbemObject = GetObject(\"winmgmts:Win32_Processor.DeviceID='cpu0'\")
   ret = objSWbemObject.ProcessorId
   'msgbox \"first CPU serial number:\" & ret" )
   (if (not *wsc)(setq *wsc (vlax-create-object "ScriptControl")))
   (vlax-put *wsc 'language "vbs")
   (vlax-invoke *wsc 'ExecuteStatement str)
   (vlax-invoke *wsc 'eval "ret")
)


Why is this CODE running so slow?The friend has faster access to the serial number of CPUID,Thanks!

Never give up !

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8822
  • AKA Daniel
Re: CPU serial number
« Reply #1 on: July 30, 2010, 09:30:55 PM »
is this any faster?

Code: [Select]
(defun wmiProcessorId (/ item meth1 meth2 s serx wmi)
  (vl-load-com)
  (setq WMI (vlax-create-object "WbemScripting.SWbemLocator")
meth1 (VLAX-INVOKE WMI 'ConnectServer nil nil nil nil nil nil nil nil)
meth2 (vlax-invoke meth1 'ExecQuery "select ProcessorId from Win32_Processor")
s (vlax-for item meth2 (setq serx (list (vlax-get item 'ProcessorId))))
  )
  (vlax-release-object meth1)
  (vlax-release-object meth2)
  (vlax-release-object wmi)
  (car s)
)

myloveflyer

  • Newt
  • Posts: 152
Re: CPU serial number
« Reply #2 on: July 30, 2010, 09:44:08 PM »
Nice Work,eAmbiguousOutput.
Thanks
Never give up !

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8822
  • AKA Daniel
Re: CPU serial number
« Reply #3 on: July 30, 2010, 10:11:49 PM »
My pleasure  :-)

sinc

  • Guest
Re: CPU serial number
« Reply #4 on: July 31, 2010, 11:27:48 PM »
Beware...  I don't think the CPU serial number returns anything meaningful unless you are running Pentium III chips.
« Last Edit: August 02, 2010, 11:38:29 AM by sinc »

myloveflyer

  • Newt
  • Posts: 152
Re: CPU serial number
« Reply #5 on: August 02, 2010, 04:37:42 AM »
I want to get the serial number of CPU to write a LISP encryption program, but the hardware update may change the CUP if the serial number, computer hardware now seems nothing is fixed.
Never give up !

sinc

  • Guest
Re: CPU serial number
« Reply #6 on: August 02, 2010, 11:37:15 AM »
Yes, it's a tricky problem.  Since a PC is nothing but a bunch of components, any one of which can be swapped out, how do you key something to a given computer?  What defines the computer?

Windows itself uses a set of 10 or so items that it looks at.  You can change some of those things, but once too much changes, you have to reactivate Windows.

Security is actually a big problem, not easily solved.  That's why there are companies that specialize in this arena and will license their solutions for use in your application.  And such stuff generally is not cheap (or rather, the cheap solutions tend to work poorly, and generally aren't worth the money).