Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. Set WshShell = CreateObject("WScript.Shell")
  2. regKey = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
  3. DigitalProductId = WshShell.RegRead(regKey & "DigitalProductId")
  4.  
  5. Win8ProductName = "Windows Product Name: " & WshShell.RegRead(regKey & "ProductName") & vbNewLine
  6. Win8ProductID = "Windows Product ID: " & WshShell.RegRead(regKey & "ProductID") & vbNewLine
  7. Win8ProductKey = ConvertToKey(DigitalProductId)
  8. strProductKey ="Windows 8 Key: " & Win8ProductKey
  9. Win8ProductID = Win8ProductName & Win8ProductID & strProductKey
  10.  
  11. MsgBox(Win8ProductKey)
  12. MsgBox(Win8ProductID)
  13.  
  14. Function ConvertToKey(regKey)
  15. Const KeyOffset = 52
  16. isWin8 = (regKey(66) \ 6) And 1
  17. regKey(66) = (regKey(66) And &HF7) Or ((isWin8 And 2) * 4)
  18. j = 24
  19. Chars = "BCDFGHJKMPQRTVWXY2346789"
  20. Do
  21. Cur = 0
  22. y = 14
  23. Do
  24. Cur = Cur * 256
  25. Cur = regKey(y + KeyOffset) + Cur
  26. regKey(y + KeyOffset) = (Cur \ 24)
  27. Cur = Cur Mod 24
  28. y = y -1
  29. Loop While y >= 0
  30. j = j -1
  31. winKeyOutput = Mid(Chars, Cur + 1, 1) & winKeyOutput
  32. Last = Cur
  33. Loop While j >= 0
  34. If (isWin8 = 1) Then
  35. keypart1 = Mid(winKeyOutput, 2, Last)
  36. insert = "N"
  37. winKeyOutput = Replace(winKeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
  38. If Last = 0 Then winKeyOutput = insert & winKeyOutput
  39. End If
  40. a = Mid(winKeyOutput, 1, 5)
  41. b = Mid(winKeyOutput, 6, 5)
  42. c = Mid(winKeyOutput, 11, 5)
  43. d = Mid(winKeyOutput, 16, 5)
  44. e = Mid(winKeyOutput, 21, 5)
  45. ConvertToKey = a & "-" & b & "-" & c & "-" & d & "-" & e
  46. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement