Jump to content


Decode Xp Digitalproductid To Cd Key


32 replies to this topic

#1 steven2004

    The Man That Can (usually)

  • Members
  • 3,882 posts

Posted 04 November 2005 - 10:19 PM

Quote

Actually, what is the manual way of reading the key? That's interesting, I missed that post.

Roxanne


:lol: ok you asked, but i havent got it translated to erm human language.

basially this delphi function can be called with the contents of this registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

DigitalProductId

and it will return a string that is the XP CD key :) , basically all its doing is shifting bytes here and there and what not, i aint time to decode the code into plain english now, but i might sometime. :lol:

You did ask!!!!! :lol: :lol:


function DecodeProductKey(const HexSrc: array of Byte): string;
const
  StartOffset: Integer = $34; { //Offset 34 = Array[52] }
  EndOffset: Integer   = $34 + 15; { //Offset 34 + 15(Bytes) = Array[64] }
  Digits: array[0..23] of CHAR = ('B', 'C', 'D', 'F', 'G', 'H', 'J',
    'K', 'M', 'P', 'Q', 'R', 'T', 'V', 'W', 'X', 'Y', '2', '3', '4', '6', '7', '8', '9');
  dLen: Integer = 29; { //Length of Decoded Product Key }
  sLen: Integer = 15;
  { //Length of Encoded Product Key in Bytes (An total of 30 in chars) }
var
  HexDigitalPID: array of CARDINAL;
  Des: array of CHAR;
  I, N: INTEGER;
  HN, Value: CARDINAL;
begin
  SetLength(HexDigitalPID, dLen);
  for I := StartOffset to EndOffset do
  begin
    HexDigitalPID[I - StartOffSet] := HexSrc[I];
  end;

  SetLength(Des, dLen + 1);

  for I := dLen - 1 downto 0 do
  begin
    if (((I + 1) mod 6) = 0) then
    begin
      Des[I] := '-';
    end
    else
    begin
      HN := 0;
      for N := sLen - 1 downto 0 do
      begin
        Value := (HN shl 8) or HexDigitalPID[N];
        HexDigitalPID[N] := Value div 24;
        HN    := Value mod 24;
      end;
      Des[I] := Digits[HN];
    end;
  end;
  Des[dLen] := Chr(0);

  for I := 0 to Length(Des) do
  begin
    Result := Result + Des[I];
  end;
end;

end.

If you want me to compensate for your lack of knowledge of XP/computers etc. Then do me a favour and compensate for my lack of knowledge when it comes to spelling, gramer grammer and "stuff"

corrected one spelling mistake on 19/12/07 there might be others ;-)
DONT FORGET TO POST BACK !!

Common Fact Banner

#2 Centauress

    The Centaur of Attention

  • Moderators
  • 7,281 posts
  • Gender:Not Telling
  • Location:California
  • Interests:Fantasy, science fiction books, as well as movies and television (especially if it’s British). Computers of course, particularly focusing on troubleshooting and maximizing performance. Horses, dogs, cats and centaurs.

Posted 05 November 2005 - 01:46 AM

Thanks Steven :lol: ; it will probably be a few days until I can take the time to experiment with it, though.

Roxanne
"You know the very powerful and the very stupid have one thing in common. They don't alter their views to fit the facts. They alter the facts to fit the views. Which can be uncomfortable if you happen to be one of the facts that needs altering."
The Doctor, "Dr. Who: The Face of Evil (1977)"

"Answers are easy; it's asking the right questions which is hard."
The Doctor, "Dr. Who: The Face of Evil (1977)"

"Probability computed at 0.00057, Mistress. There is a .567 error correction to that estimate. Error in error-correction estimate estimated at 0.375."
K9, "Dr. Who: Warrior's Gate (1981)"

"The trouble with computers of course is that they are very sophisticated idiots; they do exactly what you tell them at AMAZING speed even if you order them to kill you. So if you do happen to change your mind it's very difficult to stop them obeying the original order…but NOT impossible."
The Doctor, "Dr. Who: Robot (1974)"

#3 steven2004

    The Man That Can (usually)

  • Members
  • 3,882 posts

Posted 05 November 2005 - 07:02 PM

ah! the above one isnt a VB script it delphi ;) but for you i have converted it and made a VBS version. :)

paste into notepad and save as

Show_Me_My_XP_KEY.VBS
Rem lookup digital product id from registry
Set WshShell = WScript.CreateObject("WScript.Shell")
HexBuf = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId")
For l = lBound(HexBuf) to uBound(HexBuf)
tmp=tmp & " "& Hex (HexBuf(l))
next

WshShell.Popup  "Found Digital Product Id in registry:-" &  _
"                                                                                                                    " &  _
"                                                                                                                    " &  _
"                                                                                                                    " & tmp
StartOffset = 52
EndOffset =67
Dim Digits (24)

Digits (0) = "B" : Digits (1) = "C": Digits (2) = "D": Digits (3) = "F":
Digits (4) = "G": Digits (5) = "H": Digits (6) = "J": Digits (7) = "K":
Digits (8) = "M": Digits (9) = "P": Digits (10) = "Q": Digits (11) = "R":
Digits (12) = "T": Digits (13) = "V": Digits (14) = "W": Digits (15) = "X":
Digits (16) = "Y": Digits (17) = "2": Digits (18) = "3": Digits (19) = "4":
Digits (20) = "6" : Digits (21) = "7" : Digits (22) = "8": Digits (23) = "9"

dLen = 29
sLen = 15
Dim HexDigitalPID (15)
Dim Des (30)
For i = StartOffset to EndOffset
HexDigitalPID (i-StartOffset) = HexBuf(i)
tmp2=tmp2 & " "& Hex (HexDigitalPID(i-StartOffset))
next
WshShell.Popup  "Found Digital Product Id in registry:-" &  _
"                                                                                                                    " &  _
"                                                                                                                    " &  _
"                                                                                                                    " & tmp & _
"                                                                                                                  " & _
"                                                                                                                  " & _
"                                                                                                                  " & _
"                                        " & _
"Located the sequence in the digital product ID. Can you see it in the one above (Tip:- 2nd line, 8 in from the left) :- " & _
"                                                                                                                  " &  _
"                                                                                                                  " & tmp2
KEYSTRING =""
for i=dLen-1 to 0 step -1
if ((i + 1) mod 6) = 0 then
Des (i) = "-"
KEYSTRING =KEYSTRING & "-"
else
HN = 0
     For N = (sLen -1) to 0 step -1
       Value = ( (HN *2^8 ) Or HexDigitalPID (N))
        HexDigitalPID (N) = Value \ 24
        HN    = (Value mod 24)

     next

Des(i) = Digits(HN)
KEYSTRING =KEYSTRING & Digits(HN)
end if
next
KEYSTRING2 = StrReverse (KEYSTRING)
WScript.Echo "Having finished messing about performing mathmatical stuff" & _
" on your Product ID i have come to the conclusion your XP Key is:- " & _
"                                         " & KEYSTRING2



that how magic jely bean and others work, it works for MS office keys too, it just needs the correct registry location to get the digital product id from to decode. :)

Edited by steven2004, 05 November 2005 - 07:05 PM.

If you want me to compensate for your lack of knowledge of XP/computers etc. Then do me a favour and compensate for my lack of knowledge when it comes to spelling, gramer grammer and "stuff"

corrected one spelling mistake on 19/12/07 there might be others ;-)
DONT FORGET TO POST BACK !!

#4 daruleg

    Junior TEG Forum Member

  • Members
  • 2 posts

Posted 15 February 2007 - 04:29 PM

On the Windows OS stickers that are affixed to cases -

You have the product key in the 25-character format, then you have 2 barcodes: one's presumably the product number (i.e. windows <version>/office/etc), and then the other a barcode presumably representing the key.

Is there any way to convert between those two numbers (or the second one) and the 25-char key?

Would make it heaps easier to scan the barcodes and put the numbers through a macro to get the 25-char rather than typing the CD-Key manually when 50+ PCs arrive at the office.

The kids rip off the stickers so we need to keep them handy.

There are programs to scan the domain and get CD-Keys, but these guys image the PCs with a standard (illegal or malpractice?) CD key across all the PCs.

Ta,

daruleg

#5 managed

    Resident Scouser

  • Members
  • 8,144 posts
  • Gender:Male
  • Location:Liverpool, England
  • Interests:Computers, Football, Science Fiction.

Posted 15 February 2007 - 07:03 PM

Is this the 'other' thread :-
http://www.theeldergeek.com/forum/index.ph...7&hl=xp+key

The keyfinder program that is part of the BartPE plugin mentioned near the end of that thread will convert the DigitalID to the product key when used alone.
Neat when it's on a BartPE disk though, you can read the product key of any installed XP, even on another PC on a network.

#6 daruleg

    Junior TEG Forum Member

  • Members
  • 2 posts

Posted 15 February 2007 - 09:10 PM

Those programs / scritps That will process the digitalID which is stored in the registry.

The barcoded number thing on the sticker is in a different format; eg 00012-345-678-910

#7 YLStang

    Chief Redneck'n'Charge

  • Members
  • 9,401 posts
  • Gender:Male
  • Location:Sweet Home Alabama (U.S.A.) Heart of Dixie
  • Interests:Family
    Computers
    Old Fords and Mustangs (Chevys too)

Posted 15 February 2007 - 09:13 PM

steven2004 I'll thank you also I tried it and it worked excellent ;) :rolleyes:
Butch
YLStang (say Wild)
I.B.RedNeck
Gun Toting, Beer Drinking, Bible Carrying Christian. Everything is Beautiful
A Day Without a Buzz is a Day that Never Wuzz

Links Avast Home*SuperAntiSpyware*CCleaner*ATF Cleaner*Malwarebytes*

#8 ricktendo64

    TEG Forum Member

  • Members
  • 438 posts
  • Location:Honduras

Posted 15 February 2007 - 09:19 PM

WOW this is cool and funny

#9 xfilz

    TEG Forum Member

  • Members
  • 12 posts

Posted 09 October 2008 - 05:30 PM

Is it possible to make this script output a .txt file looking like this with the below undecoded REG_ values filled in?

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"=""
"RegisteredOrganization"=""
"RegisteredOwner"=""
"ProductId"=""
"DigitalProductId"=hex:
"LicenseInfo"=hex:
[HKEY_LOCAL_MACHINE\SYSTEM\Setup\Pid]
"Pid"=""

thanx
:rolleyes:

Edited by xfilz, 14 October 2008 - 05:12 AM.


#10 VA(s)T

    Senior TEG Forum Member

  • Members
  • 3,101 posts
  • Location:The Netherlands
  • Interests:Huh?

Posted 09 October 2008 - 06:23 PM

This??

strComputer = "."
Set fso = CreateObject("Scripting.FileSystemObject")
Set TxtFile = fso.CreateTextFile("C:\SysInfo.log", True)
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:" _
	& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
	("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems

	Wscript.Echo "ProductName: " & objOperatingSystem.Caption
	TxtFile.WriteLine "ProductName: " & objOperatingSystem.Caption

	WScript.Echo "RegisteredOrganization: " & objOperatingSystem.Organization
	TxtFile.WriteLine "RegisteredOrganization: " & objOperatingSystem.Organization
	
	Wscript.Echo "RegisteredOwner: " & objOperatingSystem.RegisteredUser
	TxtFile.WriteLine "RegisteredOwner: " & objOperatingSystem.RegisteredUser
   
	Wscript.Echo "DigitalProductId: " & objOperatingSystem.SerialNumber
	TxtFile.WriteLine "DigitalProductId: " & objOperatingSystem.SerialNumber

Next

	WScript.Echo "Pid: " & WshShell.RegRead ("HKEY_LOCAL_MACHINE\SYSTEM\Setup\Pid\Pid") 
	TxtFile.WriteLine "Pid: " & WshShell.RegRead ("HKEY_LOCAL_MACHINE\SYSTEM\Setup\Pid\Pid") 


TxtFile.Close
WScript.Echo "C:\SysInfo.log is created"


Didn't catch the LicenseInfo yet :rolleyes: actualy what does it tell you??

How to Google?

--------------------------
Work smarter, not harder.

#11 xfilz

    TEG Forum Member

  • Members
  • 12 posts

Posted 10 October 2008 - 05:46 PM

I like to try this re-install method: http://www.pendec.dk/generalfaq.htm

thank you for trying, but for backup purposes/possible to change product key without a key tool this is very handy for me.
would be better if it could make a .txt file in same folder as the script with values exactly like below so it can be imported:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"RegisteredOrganization"="ADP"
"RegisteredOwner"="Julia"
"ProductId"="55274-OEM-0011903-00102"
"DigitalProductId"=hex:a4,00,00,00,03,00,00,00,35,35,32,37,34,2d,4f,45,4d,2d,\
30,30,31,31,39,30,33,2d,30,30,31,30,32,00,2d,00,00,00,41,32,32,2d,30,30,30,\
30,31,00,00,00,00,00,00,00,4c,98,2f,0e,d5,0c,91,cc,a1,4a,a1,e1,d2,eb,03,00,\
00,00,00,00,c0,3f,f6,3d,17,af,01,00,02,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,38,33,32,32,31,00,00,00,00,00,00,00,8c,03,\
00,00,c5,a0,44,4c,fe,00,00,00,68,08,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,72,79,c3,08
"LicenseInfo"=hex:33,8f,a0,d3,a4,7c,a6,de,5a,42,c0,6f,48,70,ea,45,9e,7c,fa,06,\
5a,e0,a8,88,2f,81,e6,6d,12,1a,9c,a9,02,1b,27,81,5d,3a,37,a2,f4,d0,cd,ea,93,\
09,82,f4,96,b5,b9,fa,55,cd,43,1b
[HKEY_LOCAL_MACHINE\SYSTEM\Setup\Pid]
"Pid"="55274OEM"

THANK YOU for the new Code
:P

Edited by xfilz, 14 October 2008 - 05:17 AM.


#12 VA(s)T

    Senior TEG Forum Member

  • Members
  • 3,101 posts
  • Location:The Netherlands
  • Interests:Huh?

Posted 10 October 2008 - 05:48 PM

Ah :P Ok..

See start run cmd

and type

REG EXPORT /?

:lol:

How to Google?

--------------------------
Work smarter, not harder.

#13 managed

    Resident Scouser

  • Members
  • 8,144 posts
  • Gender:Male
  • Location:Liverpool, England
  • Interests:Computers, Football, Science Fiction.

Posted 10 October 2008 - 06:05 PM

xfilz, I'm curious, why do want to do it ? There are several free programs that will output the XP key by reading the Registry, do you need all the extra data ?

#14 xfilz

    TEG Forum Member

  • Members
  • 12 posts

Posted 10 October 2008 - 06:50 PM

View Postmanaged, on Oct 11 2008, 01:05 AM, said:

xfilz, I'm curious, why do want to do it ? There are several free programs that will output the XP key by reading the Registry, do you need all the extra data ?

hehe, you are right, I dont need the extra data, but I like the extra data when it comes to activating my XP product...
I can backup the product key by through internet explorer, but all the fields in currentversion I get all or none output.

;)

#15 managed

    Resident Scouser

  • Members
  • 8,144 posts
  • Gender:Male
  • Location:Liverpool, England
  • Interests:Computers, Football, Science Fiction.

Posted 10 October 2008 - 07:17 PM

Fair enough.

Have you tried Belarc Advisor ? It gives a nice report, has Html format option which you can view in any browser, includes the OS key and Application serials, installed hotfixes, hardware details etc.

Not sure it has everything you listed above but a nice program, free too. ;)

#16 xfilz

    TEG Forum Member

  • Members
  • 12 posts

Posted 10 October 2008 - 07:28 PM

thank you for the tip, I tried Belarc Advisor before, but it does not do the job when it comes to re-importing the cd-key...
a problem is with exporting only the below subkeys. Someone has got to know how to make the output in .reg format...

;)

Edited by xfilz, 13 October 2008 - 04:38 PM.


#17 mph

    Senior TEG Forum Member

  • Members
  • 7,261 posts
  • Gender:Male
  • Location:Humdrum POP. 235

Posted 10 October 2008 - 08:27 PM

Julia is my favourite name ;)

something like this,in a batch file

if exist c:\regkey.txt del c:\regkey.txt

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v BuildLab >> C:\regkey.txt

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDVersion >> C:\regkey.txt

and so on

Edited by mph, 10 October 2008 - 08:28 PM.

Posted Image

#18 xfilz

    TEG Forum Member

  • Members
  • 12 posts

Posted 11 October 2008 - 06:55 PM

Thank you also, it is a good idea, but the cd-key still cant be imported with the output regkey.reg after XP is reinstalled...

Save as "regkey.bat"

if exist .\regkey.txt del .\regkey.txt
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName >> .\regkey.txt
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v RegisteredOrganization >> .\regkey.txt
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v RegisteredOwner >> .\regkey.txt
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductId >> .\regkey.txt
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v DigitalProductId >> .\regkey.txt
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v LicenseInfo >> .\regkey.txt
reg query "HKEY_LOCAL_MACHINE\SYSTEM\Setup\Pid" /v Pid >> .\regkey.txt


The output values comes out looking like this, but it still needs editing and wont do the whole process "unattended":

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
ProductName REG_SZ Microsoft Windows XP
! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegisteredOrganization REG_SZ ADP
! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegisteredOwner REG_SZ Julia
! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
ProductId REG_SZ 55274-OEM-0011903-00102
! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
DigitalProductId REG_BINARY A40000000300000035353237342D4F454D2D303031313930332
D3030313032002D0000004132322D3030303031000000000000004C982F0ED50C91CCA1
4AA1E1D2EB030000000000C03FF63D17AF01000200000000000000000000000000000000
000000000000003833323231000000000000008C030000C5A0444CFE0000006808000000
0000000000000000000000000000000000000000000000000000007279C308
! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
LicenseInfo REG_BINARY 338FA0D3A47CA6DE5A42C06F4870EA459E7CFA065AE0A8882F81E66D121A9CA9021B27815D3A37A2
F4D0CDEA930982F496B5B9FA55CD431B
! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINE\SYSTEM\Setup\Pid
Pid REG_SZ 55274OEM


:)

Edited by xfilz, 11 October 2008 - 07:08 PM.


#19 YLStang

    Chief Redneck'n'Charge

  • Members
  • 9,401 posts
  • Gender:Male
  • Location:Sweet Home Alabama (U.S.A.) Heart of Dixie
  • Interests:Family
    Computers
    Old Fords and Mustangs (Chevys too)

Posted 11 October 2008 - 07:46 PM

View Postxfilz, on Oct 10 2008, 05:46 PM, said:

thank you for trying, but for backup purposes/possible to change product key without a key tool this is very handy for me.
would be better if it could make a .txt file in same folder as the script with values exactly like below so it can be imported:


View Postxfilz, on Oct 10 2008, 06:50 PM, said:

hehe, you are right, I dont need the extra data, but I like the extra data when it comes to activating my XP product...
I can backup the product key by through internet explorer, but all the fields in currentversion I get all or none output.


View Postxfilz, on Oct 11 2008, 06:55 PM, said:

Thank you also, it is a good idea, but the cd-key still cant be imported with the output regkey.reg after XP is reinstalled...
On an install of a LEGIT System all this smells fishy to me :)
Butch
YLStang (say Wild)
I.B.RedNeck
Gun Toting, Beer Drinking, Bible Carrying Christian. Everything is Beautiful
A Day Without a Buzz is a Day that Never Wuzz

Links Avast Home*SuperAntiSpyware*CCleaner*ATF Cleaner*Malwarebytes*

#20 managed

    Resident Scouser

  • Members
  • 8,144 posts
  • Gender:Male
  • Location:Liverpool, England
  • Interests:Computers, Football, Science Fiction.

Posted 11 October 2008 - 08:56 PM

I'm beginning to think so too Butch.