现在位置: 首页 > 原创作品 > 正文
A+

win7 OEM设置工具

8个月前 原创作品 769 11

闲得蛋疼,写了这个工具,是因为我这两天把电脑的系统装回了win7,偶尔看到了个文章介绍怎么改登录画面的,就顺手写了一个小工具。

先介绍一下Autoit吧,这是一个脚本语言,类似于vbs,在WIN平台写一些小工具还是很方便的,上手很快,有非常丰富的帮助文档可以查看使用,不过官方下载的都是英文,国内有中文翻译的现成资料,如果想学的话可以去看看相关资料,再说一遍真的很好上手,我当初才看了一点基本语法就开始写代码了。

如果要下载推荐下载官网的版本,因为是最新的,而且没有被国内的某些人修改过。

https://www.autoitscript.com/

中文版的也不是不可以下载,只是被修改过编译器,添加了各种防破解机制,360会报毒,官方的不会。

中文版的可以去IT天空下载,还有一个中文论坛,不过这两天我试过打不开了,没有备案。

说回这个工具吧,就两个功能,改OEM信息跟修改登录画面,这次我就不上exe可执行文件了,我直接上代码。

先来一张图片

 

这是AU3官方的下载地址,最新的版本是3.3.15.1:

这是IT天空中文版的下载地址:

下面是OEM工具的源码:

  1. #NoTrayIcon
  2. #include?<GUIConstantsEx.au3>
  3. #include?<GuiStatusBar.au3>
  4. #include?<StaticConstants.au3>
  5. #include?<WindowsConstants.au3>
  6. #include?<FileConstants.au3>
  7. #include?<MsgBoxConstants.au3>
  8. #include?<WinAPIFiles.au3>
  9. #include?<GDIPlus.au3>
  10. If?@OSVersion?<>?"WIN_7"?Then
  11. ????MsgBox(16+4096,"Error","此工具只能运行在WIN7的系统上")
  12. ????Exit
  13. EndIf
  14. oem()
  15. Func?oem()
  16. ????Local?$EkeyOEMINF?=?"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation"
  17. ????RegWrite($EkeyOEMINF)
  18. ????;制造商
  19. ????Local?$Manufacturer?=?RegRead($EkeyOEMINF,"Manufacturer")
  20. ????;型号
  21. ????Local?$model?=?RegRead($EkeyOEMINF,"model")
  22. ????;支持小时数
  23. ????Local?$supporthours?=?RegRead($EkeyOEMINF,"supporthours")
  24. ????;网站
  25. ????Local?$SupportURL?=?RegRead($EkeyOEMINF,"SupportURL")
  26. ????;logo
  27. ????Local?$logo?=?RegRead($EkeyOEMINF,"logo")
  28. ????;电话号码
  29. ????Local?$SupportPhone?=?RegRead($EkeyOEMINF,"SupportPhone")
  30. ????;创建注册表
  31. ????If?$Manufacturer?=?""?Then
  32. ????????RegWrite($EkeyOEMINF,"Manufacturer","REG_SZ","")
  33. ????ElseIf?$model?=?""?Then
  34. ????????RegWrite($EkeyOEMINF,"model","REG_SZ","")
  35. ????ElseIf?$supporthours?=?""?Then
  36. ????????RegWrite($EkeyOEMINF,"supporthours","REG_SZ","")
  37. ????ElseIf?$SupportURL?=?""?Then
  38. ????????RegWrite($EkeyOEMINF,"SupportURL","REG_SZ","")
  39. ????ElseIf?$logo?=?""?Then
  40. ????????RegWrite($EkeyOEMINF,"logo","REG_SZ","")
  41. ????ElseIf?$SupportPhone?=?""?Then
  42. ????????RegWrite($EkeyOEMINF,"SupportPhone","REG_SZ","")
  43. ????EndIf
  44. ????;创建目录
  45. ????Local?$sFilePath1?=?"C:\Windows\System32\oobe\info"
  46. ????Local?$sFilePath2?=?"C:\Windows\System32\oobe\info\backgrounds"
  47. ????Local?$a_1?=?_WinAPI_PathIsDirectory?(?$sFilePath1?)
  48. ????Local?$a_2?=?_WinAPI_PathIsDirectory?(?$sFilePath2?)
  49. ????If?$a_1?=?False?Then
  50. ????????_WinAPI_CreateDirectory($sFilePath1)
  51. ????EndIf
  52. ????If?$a_2?=?False?Then
  53. ????????_WinAPI_CreateDirectory($sFilePath2)
  54. ????EndIf
  55. ????;创建注册表
  56. ????Local?$RegBack?=?"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background"
  57. ????RegWrite($RegBack)
  58. ????For?$R_1?=?1?To?100
  59. ????????Local?$R_Var?=?RegEnumVal($RegBack,$R_1)
  60. ????????If?$R_Var?=?"OEMBackground"?Then
  61. ????????????ExitLoop
  62. ????????Else
  63. ????????????RegWrite($RegBack,?"OEMBackground",?"REG_DWORD",?"0")
  64. ????????????ExitLoop
  65. ????????EndIf
  66. ????Next
  67. ????;GUI?start
  68. ????Local?$Gui_W?=?GUICreate("WIN7?OEM设置工具",?484,?400,?-1,?-1)
  69. ????;LogoIMG
  70. ????Local?$BMP
  71. ????Local?$Logo_G?=?GUICtrlCreateGroup("?LOGO?",?8,?8,?137,?217)
  72. ????Local?$logo_S?=?GUICtrlCreatePic($logo,?16,?24,?120,?120)
  73. ????Local?$SelectIMG?=?GUICtrlCreateButton("选择图片",?16,?152,?123,?17)
  74. ????Local?$L_label01?=?GUICtrlCreateLabel("图片格式:BMP",?16,?176,?112,?17)
  75. ????Local?$L_label02?=?GUICtrlCreateLabel("图片大小:120?X?120",?16,?200,?121,?17)
  76. ????Local?$Systeminf?=?GUICtrlCreateGroup("?系统信息?",?152,?8,?321,?89)
  77. ????Local?$S_label01?=?GUICtrlCreateLabel("制造商:",?160,?32,?52,?17)
  78. ????Local?$S_label02?=?GUICtrlCreateLabel("型号:",?160,?64,?40,?17)
  79. ????Local?$S_inputMF?=?GUICtrlCreateInput($Manufacturer,?232,?28,?233,?21)
  80. ????Local?$S_inputMO?=?GUICtrlCreateInput($Model,?232,?60,?233,?21)
  81. ????Local?$Support?=?GUICtrlCreateGroup("支持信息",?152,?104,?321,?121)
  82. ????Local?$SU_label01?=?GUICtrlCreateLabel("电话号码:",?160,?128,?64,?17)
  83. ????Local?$SU_label03?=?GUICtrlCreateLabel("网站:",?160,?192,?40,?17)
  84. ????Local?$SU_label02?=?GUICtrlCreateLabel("支持小时:",?160,?160,?64,?17)
  85. ????Local?$SU_inputSP?=?GUICtrlCreateInput($SupportPhone,?232,?124,?233,?21)
  86. ????Local?$SU_inputST?=?GUICtrlCreateInput($supporthours,?232,?156,?233,?21)
  87. ????Local?$SU_inputSU?=?GUICtrlCreateInput($SupportURL,?232,?188,?233,?21)
  88. ????Local?$ButStart?=?GUICtrlCreateButton("确定修改?(&A)",?216,?232,?123,?25)
  89. ????;设置ButStart为默认按钮
  90. ????GUICtrlSetState($ButStart,$GUI_DEFBUTTON)
  91. ????Local?$ButDel?=?GUICtrlCreateButton("删除以上所有信息",?352,?232,?123,?25)
  92. ????Local?$Welcome_G?=?GUICtrlCreateGroup("?修改?WIN7?欢迎界面背景",?8,?264,?465,?97)
  93. ????Local?$W_label01?=?GUICtrlCreateLabel("选择要替换的背景图片,系统当前分辨率"?&?@DesktopWidth?&?"?X?"?&?@DesktopHeight?&?",图片格式需JPG格式。",?16,?288,?420,?17)
  94. ????Local?$W_PathInput?=?GUICtrlCreateInput("",?16,?320,?177,?21)
  95. ????Local?$W_jpg?=?""
  96. ????Local?$W_Browse?=?GUICtrlCreateButton("浏览",?200,?318,?51,?25)
  97. ????Local?$W_Confirm?=?GUICtrlCreateButton("确认替换?(&E)",?264,?318,?99,?25)
  98. ????Local?$W_Restore?=?GUICtrlCreateButton("还原默认",?368,?318,?99,?25)
  99. ????Local?$StatusBar?=?_GUICtrlStatusBar_Create($Gui_W)
  100. ????local?$StatusBar_PartsWidth[2]?=?[350,?-1]
  101. ????_GUICtrlStatusBar_SetParts($StatusBar,?$StatusBar_PartsWidth)
  102. ????_GUICtrlStatusBar_SetText($StatusBar,?"WIN7?OEM设置工具?V2.0",?0)
  103. ????_GUICtrlStatusBar_SetText($StatusBar,?"Fengsay.COM",?1)
  104. ????GUISetState(@SW_SHOW,?$Gui_W)
  105. ????While?1
  106. ????????Switch?GUIGetMsg()
  107. ????????????Case?$GUI_EVENT_CLOSE
  108. ????????????????ExitLoop
  109. ????????????Case?$SelectIMG
  110. ????????????????$BMP?=?FileOpenDialog("选择BMG图片",?@DesktopDir?&?"\",?"Images?(*.bmp)",?$FD_FILEMUSTEXIST?+??$FD_PATHMUSTEXIST)
  111. ????????????????If?@error?Then
  112. ????????????????????MsgBox($MB_ICONQUESTION?+?$MB_OK,?"提示",?"请选择一个可用的BMP文件!")
  113. ????????????????Else
  114. ????????????????????GUICtrlSetImage($logo_S,?$BMP)
  115. ????????????????EndIf
  116. ????????????Case?$ButStart
  117. ????????????????If?$BMP?<>?""?Then
  118. ????????????????????If?GUICtrlRead($S_inputMF)?<>?""?Or?GUICtrlRead($S_inputMO)?<>?""?Or?GUICtrlRead($SU_inputSP)?<>?""?Or?GUICtrlRead($SU_inputST)?<>?""?Or?GUICtrlRead($SU_inputSU)?<>?""?Then
  119. ????????????????????????functionIMG($BMP,@SystemDir?&?"\systemlogo.bmp",?120,?120)
  120. ????????????????????????RegWrite($EkeyOEMINF,?"Manufacturer","REG_SZ",?GUICtrlRead($S_inputMF))
  121. ????????????????????????RegWrite($EkeyOEMINF,?"model","REG_SZ",?GUICtrlRead($S_inputMO))
  122. ????????????????????????RegWrite($EkeyOEMINF,?"SupportPhone","REG_SZ",?GUICtrlRead($SU_inputSP))
  123. ????????????????????????RegWrite($EkeyOEMINF,?"supporthours","REG_SZ",?GUICtrlRead($SU_inputST))
  124. ????????????????????????RegWrite($EkeyOEMINF,?"SupportURL","REG_SZ",?GUICtrlRead($SU_inputSU))
  125. ????????????????????????RegWrite($EkeyOEMINF,?"logo","REG_SZ",?@SystemDir?&?"\systemlogo.bmp")
  126. ????????????????????????MsgBox($MB_ICONINFORMATION?+?$MB_OK,?"提示",?"设置完成!")
  127. ????????????????????Else
  128. ????????????????????????MsgBox($MB_OK?+?$MB_ICONQUESTION,?"提示",?"好像什么都没有填啊!")
  129. ????????????????????EndIf
  130. ????????????????Else
  131. ????????????????????If?GUICtrlRead($S_inputMF)?<>?""?Or?GUICtrlRead($S_inputMO)?<>?""?Or?GUICtrlRead($SU_inputSP)?<>?""?Or?GUICtrlRead($SU_inputST)?<>?""?Or?GUICtrlRead($SU_inputSU)?<>?""?Then
  132. ????????????????????????RegWrite($EkeyOEMINF,?"Manufacturer","REG_SZ",?GUICtrlRead($S_inputMF))
  133. ????????????????????????RegWrite($EkeyOEMINF,?"model","REG_SZ",?GUICtrlRead($S_inputMO))
  134. ????????????????????????RegWrite($EkeyOEMINF,?"SupportPhone","REG_SZ",?GUICtrlRead($SU_inputSP))
  135. ????????????????????????RegWrite($EkeyOEMINF,?"supporthours","REG_SZ",?GUICtrlRead($SU_inputST))
  136. ????????????????????????RegWrite($EkeyOEMINF,?"SupportURL","REG_SZ",?GUICtrlRead($SU_inputSU))
  137. ????????????????????????MsgBox($MB_ICONINFORMATION?+?$MB_OK,?"提示",?"设置完成!")
  138. ????????????????????Else
  139. ????????????????????????MsgBox($MB_OK?+?$MB_ICONQUESTION,?"提示",?"好像什么都没有填啊!")
  140. ????????????????????EndIf
  141. ????????????????EndIf
  142. ????????????????????
  143. ????????????Case?$ButDel
  144. ????????????????$BMG?=?""
  145. ????????????????GUICtrlSetImage($logo_S,"")
  146. ????????????????GUICtrlSetData($S_inputMF,"")
  147. ????????????????GUICtrlSetData($S_inputMO,"")
  148. ????????????????GUICtrlSetData($SU_inputSP,"")
  149. ????????????????GUICtrlSetData($SU_inputST,"")
  150. ????????????????GUICtrlSetData($SU_inputSU,"")
  151. ????????????????RegDelete($EkeyOEMINF,"Manufacturer")
  152. ????????????????RegDelete($EkeyOEMINF,"model")
  153. ????????????????RegDelete($EkeyOEMINF,"SupportPhone")
  154. ????????????????RegDelete($EkeyOEMINF,"supporthours")
  155. ????????????????RegDelete($EkeyOEMINF,"SupportURL")
  156. ????????????????RegDelete($EkeyOEMINF,"logo")
  157. ????????????????MsgBox($MB_ICONINFORMATION?+?$MB_OK,?"提示",?"设置完成!")
  158. ????????????Case?$W_Browse
  159. ????????????????Local?$W_jpg?=?FileOpenDialog("请选择一个背景图片",?@DesktopDir?&?"\",?"Images?(*.jpg)",?$FD_FILEMUSTEXIST?+??$FD_PATHMUSTEXIST)
  160. ????????????????If?@error?Then
  161. ????????????????????MsgBox($MB_ICONQUESTION?+?$MB_OK,?"提示",?"请选择一个可用的JPG文件!")
  162. ????????????????????GUICtrlSetData($W_PathInput,"")
  163. ????????????????????$W_jpg?=?""
  164. ????????????????Else
  165. ????????????????????GUICtrlSetData($W_PathInput,$W_jpg)
  166. ????????????????EndIf
  167. ????????????
  168. ????????????Case?$W_Confirm
  169. ????????????????If?GUICtrlRead($W_PathInput)?=?""?Then
  170. ????????????????????MsgBox($MB_ICONQUESTION?+?$MB_OK,?"提示",?'请至少选择一个图片,点击左侧的"浏览"按钮选择!')
  171. ????????????????Else
  172. ????????????????????$iFileExists?=?FileExists($sFilePath2?&?"\backgroundDefault.jpg")
  173. ????????????????????If?$iFileExists?=?1?Then
  174. ????????????????????????$W_IFE?=?MsgBox($MB_YESNO?+?$MB_ICONQUESTION,?"提示",?"检测到原本的登录画面,是否继续操作?"?&?@CRLF?&?"如果继续操作将覆盖原文件!")
  175. ????????????????????????If?$W_IFE?=?6?Then
  176. ????????????????????????????functionIMG(GUICtrlRead($W_PathInput),$sFilePath2?&?"\backgroundDefault.jpg",?1024,?768)
  177. ????????????????????????????RegWrite($RegBack,?"OEMBackground",?"REG_DWORD",?"1")
  178. ????????????????????????????$W_jpg?=?""
  179. ????????????????????????????GUICtrlSetData($W_PathInput,"")
  180. ????????????????????????????MsgBox($MB_ICONINFORMATION?+?$MB_OK,?"提示",?"设置完成!")
  181. ????????????????????????EndIf
  182. ????????????????????Else
  183. ????????????????????????functionIMG(GUICtrlRead($W_PathInput),$sFilePath2?&?"\backgroundDefault.jpg",?1024,?768)
  184. ????????????????????????RegWrite($RegBack,?"OEMBackground",?"REG_DWORD",?"1")
  185. ????????????????????????$W_jpg?=?""
  186. ????????????????????????GUICtrlSetData($W_PathInput,"")
  187. ????????????????????????MsgBox($MB_ICONINFORMATION?+?$MB_OK,?"提示",?"设置完成!")
  188. ????????????????????EndIf
  189. ????????????????EndIf
  190. ????????????Case?$W_Restore
  191. ????????????????RegWrite($RegBack,?"OEMBackground",?"REG_DWORD",?"0")
  192. ????????????????FileDelete($sFilePath2?&?"\backgroundDefault.jpg")
  193. ????????????????MsgBox($MB_ICONINFORMATION?+?$MB_OK,?"提示",?"设置完成!")
  194. ????????EndSwitch
  195. ????WEnd
  196. EndFunc
  197. ;自定义图片尺寸裁剪
  198. Func?functionIMG($h_BMP,?$path,?$W_X,?$W_y)
  199. ????_GDIPlus_Startup()
  200. ????Local?$hImage?=?_GDIPlus_ImageLoadFromFile($h_BMP)
  201. ????Local?$h_IRsize?=?_GDIPlus_ImageResize($hImage,?$W_X,?$W_y)
  202. ????_GDIPlus_ImageSaveToFile($h_IRsize,$path)
  203. ????_GDIPlus_ImageDispose?(?$h_IRsize?)
  204. ????_GDIPlus_ImageDispose?(?$hImage?)
  205. ????_GDIPlus_Shutdown()
  206. EndFunc
下一篇
已是最新一篇文章

发表评论

评论列表 ( 有 769 次浏览 和 11 条评论 其中 访客有 6 条 博主有 5 条 )
  • 4个月前

    博主的文章很好,支持一下,欢迎测试小站的最新评论排第一功能

  • 时默 谷歌浏览器 Windows 10
    5楼
    回复
    5个月前

    完全看不懂

    • 锋言锋语作者 谷歌浏览器 Windows 10
      1层
      回复
      4个月前

      回复@时默 对于一个java的程序员来说,看不懂一个脚本语言那不是扯淡吗?

  • 谷歌浏览器 Windows 10
    4楼
    回复
    6个月前

    好东西 感谢分享

    • 锋言锋语作者 谷歌浏览器 Windows 10
      1层
      回复
      6个月前

      回复@菊 拿走拿走别客气!

  • 灰狼 谷歌浏览器  Android 6.0.1 Redmi 4 Build/MMB29M
    地板
    回复
    7个月前

    只会用vb

    • 锋言锋语作者 QQ浏览器 Windows 10
      1层
      回复
      7个月前

      回复@灰狼 这个跟VB差不多!

  • 林三 谷歌浏览器 Windows 7
    板凳
    回复
    7个月前

    以前帮别人装机的时候,喜欢把信息改成我的,然后别人用电脑的时候可能会看到我留下的记号~

    • 锋言锋语作者 谷歌浏览器 Windows 7
      1层
      回复
      7个月前

      回复@林三 以前大家都是一起装逼的!

  • 7个月前

    看来博主也是个编程高手呀,

搜索