Advertisement
Lauda

getkey

Jul 14th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Set WshShell = CreateObject("WScript.Shell")
  2. MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
  3.  
  4. Function ConvertToKey(Key)
  5.     Const KeyOffset = 52
  6.     i = 28
  7.     Chars = "BCDFGHJKMPQRTVWXY2346789"
  8.    
  9.     Do
  10.         Cur = 0
  11.         x = 14
  12.         Do
  13.             Cur = Cur * 256
  14.             Cur = Key(x + KeyOffset) + Cur
  15.             Key(x + KeyOffset) = (Cur \ 24) And 255
  16.             Cur = Cur Mod 24
  17.             x = x -1
  18.         Loop While x >= 0
  19.        
  20.         i = i -1
  21.         KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
  22.        
  23.         If (((29 - i) Mod 6) = 0) And (i <> -1) Then
  24.             i = i -1
  25.             KeyOutput = "-" & KeyOutput
  26.             End If
  27.     Loop While i >= 0
  28.    
  29.     ConvertToKey = KeyOutput
  30. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement