VB病毒中复制自己代码
Option ExplicitPrivate Sub form_load()
Dim a() As Byte
Dim n As Long
Dim exefile As Long
Dim txtfile As Long
exefile = FreeFile
Reset
Open App.Path & "\" & App.EXEName & ".exe" For Binary Access Read As #exefile
txtfile = FreeFile
Open "d:\2.txt" For Binary Access Write As #txtfile
n = LOF(exefile)
ReDim a(n)
Get #exefile, 1, a
Put #txtfile, 1, a
Close #exefile
Close #txtfile
End Sub
这段代码本意是将程序自身的代码复制到D盘下2.txt文本中,但是运行后的结果很不尽人意,结果是2.txt中没有任何代码,为空文本,但是文本的大小变化了,程序运行前是0kb,运行后为1kb,what is wrong?