[RESOLVED] Read Windows Product Key (C#)
Hi guys!
I am writing a CSIT (Complete System Information Tool) as you may know from other threads I have made recently. I am trying to read the Windows serial key but unfortunately without much success.
I have found an example piece of code here (see the GetXPCDKey function) but it does not seem to work in Windows Vista or Windows 7 but works fine in Windows XP.
Does anyone know of an example code like the above that will work with Windows & and Vista?
This would be a nice addition to the tool if anyone has any ideas.
Cheers.
Re: Read Windows Product Key (C#)
Hmm.
Is this legal, even if you own the xp,win7 cd legally?
Check it out before you include the function.
Re: Read Windows Product Key (C#)
Yes. other software (quite expensive and popular software) has this feature. Tampering with the key probably isn't legal but that isn't what I am looking to do here.
Re: Read Windows Product Key (C#)
Actually. I figured this out anyway. The above code does work but you need to ensure that you read the correct key - I forgot that 64-bit Windows systems use a different registry structure - D'oh!
I solved this by using |RegistryKey.OpenBaseKey| set with the |RegistryView| based on the OS architecture type. It works great now.