黑客的秘密武器 刘伟 2001年 42期 对于一些常见的黑客程序,比如“冰河”、“口令信差”等,它们的一些运行机理,相信大家都非常感兴趣。其实,对普通程序开发人员而言,其中有两个地方是比较有用的,那就是它们是如何实现开机自启动和屏蔽“Ctrl+Alt+Del”。下面就让我们一起来看看其实现方法。   #1开机自启动   先建一个按钮控件,命名为COMMAND1,代码如下:   Option Explicit '声明   '处理注册表的函数   Private Declare Function RegCreateKey& Lib “advapi32.dll” Alias “RegCreateKeyA”(ByVal hKey&,ByVal lpszSubKey$,lphKey&)   Private Declare Function RegSetValue Lib “advapi32.dll” Alias “RegSetValueA”(ByVal hKey As Long,ByVal lpSubKey As String,ByVal dwType As Long, ByVal lpData As String,ByVal cbData As Long)As Long   Const HKEY_LOCAL_MACHINE = &H80000002   Const REG_SZ = 1   '对HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run进行操作   Private Sub Command1_Click()   '声明变量   Dim sKeyName As String(sKeyValue As String,sKeyValueIcon As String   Dim Ret As Integer)lphKey As Long   sKeyName = “Software\Microsoft\Windows\CurrentVersion\Run”   sKeyValue = App.Path & IIf(Len(App.Path)> 3,“\” & “form1.exe”, “form1.exe”)   Ret = RegCreateKey&HKEY_LOCAL_MACHINE,sKeyName,lphKey;   Ret = RegSetValue&(lphKey&,“”,REG_SZ,sKeyValue,0&)   End Sub   #1屏蔽“Ctrl+Alt+Del”   建一个按钮控件,命名为屏蔽,代码如下:   Private Declare Function SystemParametersInfo Lib “user32” Alias “SystemParametersInfoA”(ByVal uAction As Long, ByVal uParam As Long,lpvParam As Any, ByVal fuWinIni As Long)As Long   Private Const SPI_SCREENSAVERRUNNING = 97   Private Sub Command1_Click   Dim ret As Integer   Dim pOld As Boolean   If Command1.Caption =“屏蔽” Then '使Ctrl+Alt+Del有效   ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING,True,pOld,0)   Command1.Caption = “有效”   Else '使Ctrl+Alt+Del无效   ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING,False,pOld,0)   Command1.Caption = “屏蔽”   End If   End Sub   Private Sub Form_Load   Command1.Caption =“屏蔽”   End Sub   Private Sub Form_Unload(Cancel As Integer)   Dim ret As Integer   Dim pOld As Boolean   '退出前使ALT+CTL+DEL有效   ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING,False,pOld,0)   End Sub   怎么样,收获不小吧?不过千万要注意,以上代码仅供编程参考用,不得用于非法用途!