Question:
Windows CD key verification?
Metallica_rulz
2008-05-18 15:40:59 UTC
How to find out what CD key was used to register windows. I lost my CD and key (it was a legal purchased copy) and now windows is asking to verify the key that was used.

I am pretty sure there is a way to go into the registration files in explorer and look them up.
Four answers:
Daniel O
2008-05-18 15:44:43 UTC
use magical jelly bean can find your windows key and key for other applications like office.



http://magicaljellybean.com/keyfinder/
Linds
2008-05-18 15:45:43 UTC
If you bought the CD, then you need to locat the box or case it came in which will have the key.



If it came with the computer, the key will be on a sticker on the computer somewhere.



Either way it would be wise to find the CD, as if your computer ever crashes, that will be your only way of getting your computer up and running.
Mcgoo
2008-05-18 15:48:15 UTC
You should have a COA sticker on your Computer somewhere. This will have the key on it.



Only other way is to download a Key Reader. This will decode the key used for programming the machine. The key is encrypted in windows so you can not just read it without a program to do so.
gibsonbaud
2008-05-18 16:21:01 UTC
Here is the VB code to calculate the key from the registry.



Option Explicit



Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long

Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long



Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long ' Note that If you declare the lpData parameter as String, you must pass it By Value.

Private Const REG_BINARY = 3

Private Const HKEY_LOCAL_MACHINE = &H80000002

Private Const ERROR_SUCCESS = 0&





Public Function sGetXPCDKey() As String

Dim bDigitalProductID() As Byte

Dim bProductKey() As Byte

Dim ilByte As Long

Dim lDataLen As Long

Dim hKey As Long



If RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\MICROSOFT\Windows NT\CurrentVersion", hKey) = ERROR_SUCCESS Then

lDataLen = 164

ReDim Preserve bDigitalProductID(lDataLen)

If RegQueryValueEx(hKey, "DigitalProductId", 0&, REG_BINARY, bDigitalProductID(0), lDataLen) = ERROR_SUCCESS Then

ReDim Preserve bProductKey(14)

For ilByte = 52 To 66

bProductKey(ilByte - 52) = bDigitalProductID(ilByte)

Next ilByte

Else

sGetXPCDKey = ""

Exit Function

End If

Else

sGetXPCDKey = ""

Exit Function

End If

Dim bKeyChars(0 To 24) As Byte

bKeyChars(0) = Asc("B")

bKeyChars(1) = Asc("C")

bKeyChars(2) = Asc("D")

bKeyChars(3) = Asc("F")

bKeyChars(4) = Asc("G")

bKeyChars(5) = Asc("H")

bKeyChars(6) = Asc("J")

bKeyChars(7) = Asc("K")

bKeyChars(8) = Asc("M")

bKeyChars(9) = Asc("P")

bKeyChars(10) = Asc("Q")

bKeyChars(11) = Asc("R")

bKeyChars(12) = Asc("T")

bKeyChars(13) = Asc("V")

bKeyChars(14) = Asc("W")

bKeyChars(15) = Asc("X")

bKeyChars(16) = Asc("Y")

bKeyChars(17) = Asc("2")

bKeyChars(18) = Asc("3")

bKeyChars(19) = Asc("4")

bKeyChars(20) = Asc("6")

bKeyChars(21) = Asc("7")

bKeyChars(22) = Asc("8")

bKeyChars(23) = Asc("9")

Dim nCur As Integer

Dim sCDKey As String

Dim ilKeyByte As Long

Dim ilBit As Long

For ilByte = 24 To 0 Step -1

nCur = 0

For ilKeyByte = 14 To 0 Step -1

nCur = nCur * 256 Xor bProductKey(ilKeyByte)

bProductKey(ilKeyByte) = Int(nCur / 24)

nCur = nCur Mod 24

Next ilKeyByte

sCDKey = Chr(bKeyChars(nCur)) & sCDKey

If ilByte Mod 5 = 0 And ilByte <> 0 Then sCDKey = "-" & sCDKey

Next ilByte

sGetXPCDKey = sCDKey

End Function


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...