Yeah. I was able to simply copy code over from the loader, modify it a bit and then I compiled it as a console application. It's a test application and I don't know if it will work with all Windows 8 serials, especially ones that start with the letter N.
@ Daz I was just going to post this Code: Set WshShell = CreateObject("WScript.Shell") MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId")) Function ConvertToKey(Key) Const KeyOffset = 52 Key(66) = Key(66) And 7 i = 28 Chars = "BCDFGHJKMPQRTVWXY2346789" Do Cur = 0 x = 14 Do Cur = Cur * 256 Cur = Key(x + KeyOffset) + Cur Key(x + KeyOffset) = (Cur \ 24) Cur = Cur Mod 24 x = x -1 Loop While x >= 0 i = i -1 KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput If (((29 - i) Mod 6) = 0) And (i <> -1) Then i = i -1 End If If (i < 0) Then Last = Cur End If Loop While i >= 0 keypart1 = Mid(KeyOutput, 2, Last) If (Last > 16) Then insert = "5" Else insert = "N" End If If (WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion") = "6.2") Then KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0) End If a = Mid(KeyOutput,1,5) b = Mid(KeyOutput,6,5) c = Mid(KeyOutput,11,5) d = Mid(KeyOutput,16,5) e = Mid(KeyOutput,21,5) ConvertToKey = a & "-" & b & "-" & c & "-" & d & "-" & e End Function
I'm not using the value assigned to the key output, I'm using the raw value from the calculation for the position of N or 5. added support for pre Win 8 and possibly for adding 5 to the last two blocks of the key (unsure about that tho) Code: Set WshShell = CreateObject("WScript.Shell") MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId")) Function ConvertToKey(Key) Const KeyOffset = 52 Key(66) = Key(66) And 7 i = 24 Chars = "BCDFGHJKMPQRTVWXY2346789" Do Cur = 0 x = 14 Do Cur = Cur * 256 Cur = Key(x + KeyOffset) + Cur Key(x + KeyOffset) = (Cur \ 24) Cur = Cur Mod 24 x = x -1 Loop While x >= 0 i = i -1 KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput If (i < 0) Then Last = Cur End If Loop While i >= 0 If (WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion") = "6.2") Then keypart1 = Mid(KeyOutput, 2, Last) If (Last > 15) Then insert = "5" Else insert = "N" End If KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0) End If a = Mid(KeyOutput,1,5) b = Mid(KeyOutput,6,5) c = Mid(KeyOutput,11,5) d = Mid(KeyOutput,16,5) e = Mid(KeyOutput,21,5) ConvertToKey = a & "-" & b & "-" & c & "-" & d & "-" & e End Function
Thanks! I'm not sure about the insert 5 thing it seemed natural to assume that if the insert position fell in the range of numbers in this line Code: Chars = "BCDFGHJKMPQRTVWXY2346789" that a number should be inserted, of course this could be totally wrong.
@ Daz: Where did you get that code from winsetup.dll from? I have a similar problem that could be easily solved by knowing the algorithm.
The code I got was from MGADiag. For winsetup.dll it was noticed that it contained "23456789BCDFGHJKMNPQRTVWXYbcdfghjkmnpqrtvwxy" from a hex editor. You should be able to drop the DLL into IDA Pro + Hex-Rays.
Ok but wouldn't give IDA me ASM instead of something readable? I'll search for a C decompiler, that's going to look a bit better I think?
@CODYQX4 Then you use the range 'BCDFGHJKMPQRTVWXY' instead of the range 'ABCDEFGHIJKLMNOPQRSTUVQXYZ'. The last one was what DAZ mentioned in his post. And you subtract 1 from the position? I already was thinking about that when I changed nononsence's code.