<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 程序運(yùn)行之后把自己刪除的方法

          程序運(yùn)行之后把自己刪除的方法

          作者: 時(shí)間:2010-09-13 來源:網(wǎng)絡(luò) 收藏

            近日看到網(wǎng)友詢問如何實(shí)現(xiàn),不知大家對木馬甚么的興趣實(shí)在太濃,還是想要這樣的效果:用戶只要一,可執(zhí)行文件就沒有了,可是還是在跑,膽小的只怕要喊鬼呀!,老婆,快出來看上帝甚么的

          本文引用地址:http://www.ex-cimer.com/article/151557.htm

            。其實(shí)最典型的用法是寫反安裝程序. 閑來無事,Bear掰到一種還算巧妙的“”的

            大家都知道,一般的程序的時(shí)候,可執(zhí)行文件本身是被操作系統(tǒng)保護(hù)的,不能用改寫的方式訪問,更別提在本身還在運(yùn)行的時(shí)侯了。在Lu0的主頁上看到一種UNDOCUMENT的,通過改變系統(tǒng)底層的文件訪問模式實(shí)現(xiàn)刪除自己,那是實(shí)在功夫。我看了很是佩服。但是有沒有一種用在MSDN上就能查到的函數(shù)實(shí)現(xiàn)呢?有!Jeffrey Richter給我們做了一個(gè)范例:

            DeleteMe.CPP

            Module name: DeleteMe.cpp

            Written by: Jeffrey Richter

            Description: Allows an EXEcutable file to delete itself

            **************************************************/

            #include

            #include

            #include

            /////////////////////////////////////////////////

            int WINAPI WinMain(HINSTANCE h, HINSTANCE b, LPSTR psz, int n) {

            // Is this the Original EXE or the clone EXE?

            // If the command-line 1 argument, this is the Original EXE

            // If the command-line >1 argument, this is the clone EXE

            if (__argc == 1) {

            // Original EXE: Spawn clone EXE to delete this EXE

            // Copy this EXEcutable image into the user's temp directory

            TCHAR szPathOrig[_MAX_PATH], szPathClone[_MAX_PATH];

            GetModuleFileName(NULL, szPathOrig, _MAX_PATH);

            GetTempPath(_MAX_PATH, szPathClone);

            GetTempFileName(szPathClone, __TEXT(Del), 0, szPathClone);

            CopyFile(szPathOrig, szPathClone, FALSE);

            //***注意了***:

            // Open the clone EXE using FILE_FLAG_DELETE_ON_CLOSE

            HANDLE hfile = CreateFile(szPathClone, 0, FILE_SHARE_READ, NULL, OPEN_EXISTI

            NG, FILE_FLAG_DELETE_ON_CLOSE, NULL);

            // Spawn the clone EXE passing it our EXE's process handle

            // and the full path name to the Original EXE file.

            TCHAR szCmdLine[512];

            HANDLE hProcessOrig = OpenProcess(SYNCHRONIZE, TRUE, GetCurrentProcessId());


          上一頁 1 2 下一頁

          評論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();