设为首页收藏本站

SKY外语、计算机论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1958|回复: 0

定电脑,只运行许可的Windows应用程

[复制链接]

60

主题

8

好友

1161

积分

金牌会员

Rank: 6Rank: 6

生肖
星座
处女座
性别

最佳新人 活跃会员 灌水之王 论坛元老

发表于 2012-5-18 22:30:12 |显示全部楼层
本帖最后由 sky_yx 于 2015-12-30 14:21 编辑
  1. 此程序功能是把电脑中的应用都锁住不让运行,只让运行杀毒软件、注册表、explorer和本程序。
  2. 友情提示:此程序具有一定的危险性,请新手不要擅自模仿。如果为此而造成损失,本
  3. 作者将不承担任何责任。
  4. 在窗体中:
  5. '**************************************************************************
  6. '**模 块 名:限制程序运行 - Form1
  7. '**说    明:魔灵圣域 版权所有2008 - 2009(C)
  8. '**创 建 人:郭卫(魔灵)
  9. '**日    期:2008-04-30 00:33:12
  10. '**修 改 人:郭卫
  11. '**日    期:
  12. '**描    述:郭卫制作
  13. '*************************************************************************
  14. Option Explicit
  15. Private Const HKEY_CURRENT_USER = &H80000001
  16. Private Const REG_SZ = 1                    '    -->字符串
  17. Private Const REG_DWORD = 4                ' -->长整数
  18. Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  19. Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  20. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long         ' Note that if you declare the lpData parameter as String, you must pass it By Value.
  21. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
  22. Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
  23. Private hKey As Long
  24. Private Sub Command1_Click()
  25.     '建立禁止运行任何程序
  26.     RegOpenKey HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", hKey
  27.     RegSetValueEx hKey, "RestrictRun", 0, REG_DWORD, 1&, 4
  28.     RegCreateKey HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\RestrictRun", hKey
  29.    
  30.     '建立充许运行的的程序,以下三个键值极为重要,它是为自己留的后门,否则你就重装系统吧
  31.     RegSetValueEx hKey, "Onlyme", 0, REG_SZ, ByVal "Onlyme.exe", LenB(StrConv("Onlyme.exe", vbFromUnicode)) + 1
  32.     RegSetValueEx hKey, "注册表", 0, REG_SZ, ByVal "regedit.exe", LenB(StrConv("regedit.exe", vbFromUnicode)) + 1
  33.     RegSetValueEx hKey, "Explorer", 0, REG_SZ, ByVal "Explorer.exe", LenB(StrConv("Explorer.exe", vbFromUnicode)) + 1
  34.     RegCloseKey hKey
  35.     RebootExplorer
  36. End Sub
  37. Private Sub Command2_Click()
  38.     '建立充许运行任何程序
  39.     RegOpenKey HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", hKey
  40.     RegSetValueEx hKey, "RestrictRun", 0, REG_DWORD, 0&, 4
  41.     RegDeleteKey HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\RestrictRun"
  42.     RebootExplorer
  43. End Sub
复制代码


你老婆要生了。我要当爹了
您需要登录后才可以回帖 登录 | 立即注册


手机版|SKY外语计算机学习 ( 粤ICP备12031577 )    

GMT+8, 2023-2-2 09:18 , Processed in 0.130324 second(s), 30 queries .

回顶部