Results 1 to 4 of 4

Thread: [RESOLVED] Read Windows Product Key (C#)

  1. #1

    Thread Starter
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Resolved [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.
    My Blog.

    Ryan Jones.

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    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.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    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.
    My Blog.

    Ryan Jones.

  4. #4

    Thread Starter
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    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.
    My Blog.

    Ryan Jones.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width