Domanda

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

È stato utile?

Soluzione

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

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top