Advertisement
pbjun

getwinkey

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