找回密码
 立即注册
搜索
查看: 352|回复: 2

ms序列号查看器,VB源代码.

[复制链接]

498

主题

5866

回帖

8541

积分

网站编辑

LMSung

积分
8541
发表于 2005-5-20 22:11:00 | 显示全部楼层 |阅读模式
国外1网站看到的.
有能力的朋友,写一段替换序列号的,代码.





  1. Option Explicit
  2. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
  3. Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  4. Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long ' Note that If you declare the lpData parameter as String, you must pass it By Value.
  5.     Private Const REG_BINARY = 3
  6.     Private Const HKEY_LOCAL_MACHINE = &H80000002
  7.     Private Const ERROR_SUCCESS = 0&



  8. Public Function sGetXPCDKey() As String
  9.     Dim bDigitalProductID() As Byte
  10.     Dim bProductKey() As Byte
  11.     Dim ilByte As Long
  12.     Dim lDataLen As Long
  13.     Dim hKey As Long
  14.     If RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\MICROSOFT\Windows NT\CurrentVersion", hKey) = ERROR_SUCCESS Then
  15.         lDataLen = 164
  16.         ReDim Preserve bDigitalProductID(lDataLen)
  17.         If RegQueryValueEx(hKey, "DigitalProductId", 0&, REG_BINARY, bDigitalProductID(0), lDataLen) = ERROR_SUCCESS Then
  18.             ReDim Preserve bProductKey(14)
  19.             For ilByte = 52 To 66
  20.                 bProductKey(ilByte - 52) = bDigitalProductID(ilByte)
  21.             Next ilByte

  22.         Else
  23.             sGetXPCDKey = ""
  24.             Exit Function
  25.         End If

  26.     Else
  27.         sGetXPCDKey = ""
  28.         Exit Function
  29.     End If
  30.     Dim bKeyChars(0 To 24) As Byte
  31.     bKeyChars(0) = Asc("B")
  32.     bKeyChars(1) = Asc("C")
  33.     bKeyChars(2) = Asc("D")
  34.     bKeyChars(3) = Asc("F")
  35.     bKeyChars(4) = Asc("G")
  36.     bKeyChars(5) = Asc("H")
  37.     bKeyChars(6) = Asc("J")
  38.     bKeyChars(7) = Asc("K")
  39.     bKeyChars(8) = Asc("M")
  40.     bKeyChars(9) = Asc("P")
  41.     bKeyChars(10) = Asc("Q")
  42.     bKeyChars(11) = Asc("R")
  43.     bKeyChars(12) = Asc("T")
  44.     bKeyChars(13) = Asc("V")
  45.     bKeyChars(14) = Asc("W")
  46.     bKeyChars(15) = Asc("X")
  47.     bKeyChars(16) = Asc("Y")
  48.     bKeyChars(17) = Asc("2")
  49.     bKeyChars(18) = Asc("3")
  50.     bKeyChars(19) = Asc("4")
  51.     bKeyChars(20) = Asc("6")
  52.     bKeyChars(21) = Asc("7")
  53.     bKeyChars(22) = Asc("8")
  54.     bKeyChars(23) = Asc("9")
  55.     Dim nCur As Integer
  56.     Dim sCDKey As String
  57.     Dim ilKeyByte As Long
  58.     Dim ilBit As Long
  59.     For ilByte = 24 To 0 Step -1
  60.         nCur = 0
  61.         For ilKeyByte = 14 To 0 Step -1
  62.             nCur = nCur * 256 Xor bProductKey(ilKeyByte)
  63.             bProductKey(ilKeyByte) = Int(nCur / 24)
  64.             nCur = nCur Mod 24
  65.         Next ilKeyByte
  66.         sCDKey = Chr(bKeyChars(nCur)) & sCDKey
  67.         If ilByte Mod 5 =  0  And  ilByte   <  >  0  Then  sCDKey  =   "-"   &   sCDKey
  68.     Next ilByte
  69.     sGetXPCDKey = sCDKey
  70. End Function
复制代码


HKEY_LOCAL_MACHINE, "SOFTWARE\MICROSOFT\Office\11.0\Registration\{90110804-6000-11D3-8CFE-0150048383C9}

这个位置是,Office 2003的序列号位置

12

主题

443

回帖

626

积分

高级会员

积分
626
发表于 2005-6-7 10:27:09 | 显示全部楼层
哦,看看
回复

使用道具 举报

0

主题

16

回帖

22

积分

新手上路

积分
22
发表于 2005-6-9 19:45:43 | 显示全部楼层
这个是好东西。。
只可惜本人不精于VB。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|海浩社区

GMT+8, 2025-9-18 06:54 , Processed in 0.079374 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表