How to get CPU/Processor serial number or unique ID in perl for windows machine without using any modules, probably using syscalls or something?

有帮助吗?

解决方案

http://metacpan.org/pod/Win32::SystemInfo. Without modules you can learn source code of this module and use it. You will see that module imports function GetSystemInfo from kernel32.dll and than uses it, you can do it in the same way

其他提示

You can't get a CPU serial number. For a brief time, Intel issued a series of Pentium III processors where each chip had a unique serial number. It became a PR mess for them over privacy concerns and they discontinued that set of instructions in subsequent processor releases.

But if you are looking for a "unique id" for a Windows install that is mostly guaranteed to by unique, you can try any of the following:

  1. Generate a unique GUID (uuidgen, CoCreateGuid), save it out to the registry/disk, then read it back later.

  2. Get the Machine SID. http://www.perlmonks.org/?node_id=645077

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top