- 注册时间
- 2005-4-15
- 最后登录
- 2008-6-21
⑦老手
暗夜下可怜人
- 积分
- 6150
|

楼主 |
发表于 2007-2-25 16:34:46
|
显示全部楼层
这样写就不算恶意代码,应算人性化的程序
- CP_ACP = 0
- CP_UTF8 = 65001
- m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
- w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
- a = "想要关机吗?"
- b = "华丽的警告!!!!!!!"
- c = Array.new
- for i in [a,b]
- len = m2w.call(CP_UTF8, 0, i, -1, nil, 0)
- buf = "\\0" * (len*2)
- m2w.call(CP_UTF8, 0, i, -1, buf, buf.size/2)
- len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil)
- c.push "\\0" * len
- w2m.call(CP_ACP, 0, buf, -1, c.last, c.last.size, nil, nil)
- end
- msgbox = Win32API.new('user32', 'MessageBox', %w(p p p i), 'i')
- s = msgbox.call(0, c[0], c[1], 1)
- s == 1 ? (`Shutdown.exe -s -t 10`) : (p '哈,偶就知道你选这个,关机啦' ; p '骗你的啦' )
复制代码 |
|