For a requirement to generate per-PC license keys, I need some code which will return a stable and (near) unique key on any PC. It doesn\'t have to be guaranteed un
One idea I had a while back for this is to use CryptProtectData as a way to identify a machine. Behind-the-scenes in that API, Microsoft has done what you're looking for. I never tested it though and I'm curious if it's actually viable.
Basically you would encode a constant magic value with CryptProtectData
with CRYPTPROTECT_LOCAL_MACHINE
, and the result is your machine ID.