Recent

Author Topic: Hard disk serial number and/or other hardware info - how?  (Read 1867 times)

Manlio

  • Full Member
  • ***
  • Posts: 162
  • Pascal dev
Hard disk serial number and/or other hardware info - how?
« on: July 06, 2020, 12:50:58 pm »
In order to implement a minimum of copy protection system, I'm looking for a way to identify a Mac machine by some unique information.

In Windows I did that by reading the hard disk serial number, with the GetVolumeInformation API, but even after a lot of searching I didn't find a way to do the same on macOS.

Another way to achieve the same result would be to read macOS's own Serial Number (which you see in apple menu > About This Mac). Or any other unique bit of information, such as a CPU ID, or a motherboard ID, etc. (Maybe not the MAC address, because it's changeable... even though that would be better than nothing, but I'm still hoping to find a better way than that)

I've found a few threads where this topic was discussed, but the only solutions and code show were for Windows.

Any advice, and especially any code sample for the mac, will be extremely appreciated!
manlio mazzon gmail

PascalDragon

  • Hero Member
  • *****
  • Posts: 5448
  • Compiler Developer
Re: Hard disk serial number and/or other hardware info - how?
« Reply #1 on: July 06, 2020, 01:20:27 pm »
I don't have a sample for macOS, but you should take a look at the SMBIOS data as that contains information about the mainboard and a unique ID.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Hard disk serial number and/or other hardware info - how?
« Reply #2 on: July 06, 2020, 02:17:13 pm »
This Wiki article might be helpful: Accessing macOS System Information

To retrieve the system serial number, you can use the ioreg command line utility:

Code: Bash  [Select][+][-]
  1. ioreg -l | grep IOPlatformSerialNumber

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Hard disk serial number and/or other hardware info - how?
« Reply #3 on: July 06, 2020, 04:13:52 pm »
In order to implement a minimum of copy protection system, I'm looking for a way to identify a Mac machine by some unique information.
...
I've found a few threads where this topic was discussed, but the only solutions and code show were for Windows.
This thread

Manlio

  • Full Member
  • ***
  • Posts: 162
  • Pascal dev
Re: Hard disk serial number and/or other hardware info - how?
« Reply #4 on: July 06, 2020, 06:15:39 pm »
This thread

Thank you, I copy-and-pasted the pascal example there, and it worked, I got what looks like a unique ID -- I'm not sure of what that ID represents, but it seems to be unique to each system, which is what I wanted.

BTW, I also tried to follow an earlier suggestion to look into SMBIOS, but I didn't find any reference to it at all in the codebase. Another suggestion was to call ioreg via command line, and I would have pursued that line if I hadn't found the above solution in pure pascal code.

Lastly, although I already got what I needed, I'd like to request that if someone else knows how to read HD serial numbers or other hardware identification codes, please do write about it in this thread, for the benefit of future visitors.
manlio mazzon gmail

 

TinyPortal © 2005-2018