【代码】VB6.0实现软件自我删除,其他语言的也可以进来参考下
调用批处理Public Sub KillMe()Dim mPath As String
On Error GoTo InIDE
Debug.Print 1 / 0
If Right$(App.Path, 1) = "\" Then
mPath = App.Path
Else
mPath = App.Path & "\"
End If
Open mPath & "Demon.bat" For Output As #1
Print #1, ":Repeat" & vbCrLf & _
"del """ & mPath & App.EXEName & ".exe""" & vbCrLf & _
"if exist """ & mPath & App.EXEName & ".exe""" & " goto Repeat" & vbCrLf & _
"del %0"
Close #1
Shell mPath & "Demon.bat", vbHide
InIDE: '因为删除属于静默的,所以这里留空
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call KillMe
End Sub 你就是用的批处理而已,看我的:int main(int argc, char *argv[])
{
HMODULE module = GetModuleHandle(0);
CHAR buf;
GetModuleFileName(module, buf, sizeof buf);
CloseHandle(HANDLE(4));
__asm {
lea eax, buf
push 0
push 0
push eax
push ExitProcess
push module
push DeleteFile
push UnmapViewOfFile
ret
}
return 0;
}
这段代码在PROCESS没有结束前就将启动PROCESS的EXE文件删除了.
不过不是我写的,我没那能耐。代码由Gary Nebbett写就。 回复 2# yuyuhongss
完全看不懂,哈哈
页:
[1]