AM电脑吧 - Win10精简版系统_Win11精简版_Win7旗舰版

Yes
查看: 5439|回复: 1
收起左侧

[其它] Windows XP2003 序列号更换工具au3源码

[复制链接]
ampc81

签到天数: 679 天

[LV.9]九级电脑高手

id 发表于 2011-05-09 18:13:47



  1. #include <GUIConstants.au3>
  2. #include <Constants.au3>
  3. _wmiset()
  4. $strComputer = "."
  5. $objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
  6. ;Global $colComputers
  7. $colComputers = $objWMIService.ExecQuery("Select * from win32_WindowsProductActivation")
  8.             
  9. $hgui = GUICreate("Windows XP/2003 序列号更换工具", 260, 110)
  10. GuiSetIcon("shell32.dll",162, $hgui)

  11. Dim $Setkey = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DigitalProductID")
  12. GUICtrlCreateLabel("系统序列号:更换序号请按照以下格式输入", 20, 10, 300, 20)
  13. GUICtrlSetColor(-1,0xff0000)
  14.    $Key = GUICtrlCreateInput("",20, 30,230, 25)
  15.    GUICtrlSetData($key, DecodeProductKey($Setkey))
  16.    $readbutton = GUICtrlCreateButton("修改", 20, 80, 100, 25)
  17.    $exitbutton = GUICtrlCreateButton("退出", 150, 80, 100, 25)
  18.   
  19.   
  20.    GUISetState(@SW_SHOW)
  21. While 1
  22. $msg = GUIGetMsg()
  23.    Select
  24. Case $msg = $readbutton
  25. $readkey = GUICtrlRead($Key)
  26. If $readkey = "" then
  27.     MsgBox(16,"错误","你确定你输入的序列号没错吗?")
  28.     Else
  29. $Setkey=StringReplace($readkey,"-","")


  30. ;MsgBox(0,"sdlkfj",$Setkey)

  31. ;for $obj In $colComputers

  32.    
  33.     ;$Obj.SetProductKey ($Setkey)
  34.     if @error = 0 then
  35. MsgBox(64,"恭喜!!!","您的 Windows CD-KEY 修改成功。请检查系统属性。")
  36. Endif
  37. if @error <> 0 then

  38. MsgBox(16,"失败","修改失败!请检查输入的 CD-KEY 是否与当前 Windows 版本相匹配。")

  39. Endif
  40.    
  41.     ;Next
  42.     Endif
  43. Case $msg = $GUI_EVENT_CLOSE   Or $msg = $exitbutton
  44. Exit
  45.    EndSelect
  46. WEnd

  47. Func DecodeProductKey($BinaryDPID)
  48. Local $bKey[15]
  49. Local $sKey[29]
  50. Local $Digits[24]
  51. Local $Value = 0
  52. Local $hi = 0
  53. Local $n = 0
  54. Local $i = 0
  55. Local $dlen = 29
  56. Local $slen = 15
  57. Local $Result
  58. $Digits = StringSplit("BCDFGHJKMPQRTVWXY2346789", "")
  59. $BinaryDPID = StringMid($BinaryDPID, 105, 30)
  60. For $i = 1 To 29 Step 2
  61. $bKey[Int($i / 2) ] = Dec(StringMid($BinaryDPID, $i, 2))
  62. Next
  63. For $i = $dlen - 1 To 0 Step - 1
  64. If Mod(($i + 1), 6) = 0 Then
  65. $sKey[$i] = "-"
  66. Else
  67. $hi = 0
  68. For $n = $slen - 1 To 0 Step - 1
  69. $Value = BitOR(BitShift($hi, -8), $bKey[$n])
  70. $bKey[$n] = Int($Value / 24)
  71. $hi = Mod($Value, 24)
  72. Next
  73. $sKey[$i] = $Digits[$hi + 1]
  74. EndIf
  75. Next
  76. For $i = 0 To 28
  77. $Result = $Result & $sKey[$i]
  78. Next
  79. Return $Result
  80. EndFunc


  81. Func _wmiset()
  82. ;制作:叁恨居士
  83. ;功能:判断系统是否存在WMI服务,没有便退出。如果没有运行,便将WMI服务设置启动类型为自动并运行它。
  84. $foo = Run(@ComSpec & " /c sc query winmgmt", @SystemDir, @SW_HIDE, $STDOUT_CHILD)
  85. $lines = ""
  86. While 1
  87. $line = StdoutRead($foo)
  88. If @error Then ExitLoop
  89.     $lines &= $line
  90. Wend
  91. $lines = StringSplit($lines,@CRLF,1)
  92. For $x = 1 To $lines[0]
  93.        If StringInStr($lines[$x], "1060")   Then
  94.             MsgBox(32,"错误","本软件运行所需的服务不存在")
  95.             ExitLoop
  96.                Exit
  97. ElseIf StringInStr($lines[$x], "STOPPED") Then
  98.             RunWait(@ComSpec & ' /c sc config winmgmt start= auto', @SystemDir, @SW_HIDE)
  99.        RunWait(@ComSpec & ' /c sc start winmgmt', @SystemDir, @SW_HIDE)
  100.              ExitLoop
  101. EndIf
  102. Next
  103. EndFunc
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?验证注册

x

本文地址: https://www.ampc8.com/thread-492-1-1.html
上一篇:GHOST硬盘安装工具au3源码
下一篇:一段获取ADSL用户名密码的au3 Func
回复

举报

ampc822003

签到天数: 3 天

[LV.2]二兆带宽

id 影子天团 发表于 2014-05-17 22:28:20
这个可以有的
回复

举报

您需要登录后才可以回帖 登录 | 验证注册

Powered by AMpc8.Com (晋ICP备13003365号ghs 晋公网安备 14090202000112号 |GMT+8, 2025/5/1 08:53 | A
快速回复 返回顶部 返回列表