多春鱼小屋

登录
记住密码
  1. 首页
  2. Self-Delete程序之Delphi版本
Self-Delete程序之Delphi版本
发布 | 2022-7-24 | 评论数:0 | 阅读数:3016 | 标签:Delphi
procedure DeleteSelf;    
var   
   module : HMODULE;    
   buf : array [ 0 .. MAX_PATH – 1 ] of char;    
   p : ULONG;    
   hKrnl32 : HMODULE;    
   pExitProcess, pDeleteFile, pFreeLibrary : pointer;    
begin   
  module := GetModuleHandle ( nil );    
  GetModuleFileName ( module, buf, sizeof ( buf ) );    
  CloseHandle ( THandle ( 4 ) );    
   
  p := ULONG ( module ) + 1; 
   
  hKrnl32 := GetModuleHandle ( “kernel32” );    
  pExitProcess := GetProcAddress ( hKrnl32, “ExitProcess” );    
  pDeleteFile := GetProcAddress  ( hKrnl32, “DeleteFileA” );    
  pFreeLibrary := GetProcAddress ( hKrnl32, “FreeLibrary” );    
   
  asm   
    lea eax, buf    
    push 0   
    push 0   
    push eax    
    push pExitProcess    
    push p    
    push pDeleteFile    
    push pFreeLibrary    
    ret    
  end;    
end;   

分享至:

本文已关闭评论

  • 评论0
  • 粉丝1
  • 文章33

    • 多春鱼
    • 广州
    • 1970年2月26日
    • 联系 :capelin@qq.com 微信:imcapelin
    • 查看更多 >
    热门文章
    标签
    Delphi Android PHP Tools