<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=985697</guid>
        <pubDate>Tue, 17 Jan 2006 09:49:35 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=985697</link>
        <description><![CDATA[VictN: а кто мне скажет, почему именно<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">CloseHandle((HANDLE)4);</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
??? :wall:  :wall: <br>
<br>
Почему именно 4?<br>
У меня на 2003 серваке этот закрытие дескриптора вызывает исключение. Типа неверный<br>
описатель&#33; :blink:  :unsure:]]></description>
        <author>VictN</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=764314</guid>
        <pubDate>Thu, 30 Jun 2005 21:47:05 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=764314</link>
        <description><![CDATA[vito: В bat-файле кодировка иная, поэтому русские буквы шелл не распознает.<br>
Выход:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp;//</div><div class="code_line">&nbsp;&nbsp; &nbsp;//BOOL CharToOem( &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp;// &nbsp;LPCTSTR lpszSrc,</div><div class="code_line">&nbsp;&nbsp; &nbsp;// &nbsp;LPSTR lpszDst</div><div class="code_line">&nbsp;&nbsp; &nbsp;//);</div><div class="code_line">&nbsp;&nbsp; &nbsp;//</div><div class="code_line">&nbsp;&nbsp; &nbsp;char m_word[14];</div><div class="code_line">&nbsp;&nbsp; &nbsp;CharToOem(&quot;Русские буквы&quot;, m_word);</div></ol></div></div></div></div>]]></description>
        <author>vito</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=605334</guid>
        <pubDate>Tue, 08 Feb 2005 12:38:21 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=605334</link>
        <description><![CDATA[cqwerty: мой вариант - удаление с использованием wsh. похож на метод с батом но не то :). недостатки: у пользователя может быть не установлен wsh. использовал js, можно переделать на vbs.<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">#ifndef _DEBUG</div><div class="code_line"># &nbsp; define section &quot;.cqwerty&quot;</div><div class="code_line"># &nbsp; pragma comment(linker, &quot;/section:&quot;section&quot;, ERW /IGNORE:4078&quot;)</div><div class="code_line"># &nbsp; pragma comment(linker, &quot;/merge:.rdata=&quot;section)</div><div class="code_line"># &nbsp; pragma comment(linker, &quot;/merge:.idata=&quot;section)</div><div class="code_line"># &nbsp; pragma comment(linker, &quot;/merge:.data=&quot;section)</div><div class="code_line"># &nbsp; pragma comment(linker, &quot;/merge:.text=&quot;section)</div><div class="code_line"># &nbsp; pragma comment(linker, &quot;/merge:.CRT=&quot;section)</div><div class="code_line"># &nbsp; pragma comment(linker, &quot;/FILEALIGN:0x200&quot;)</div><div class="code_line"># &nbsp; pragma comment(linker, &quot;/ENTRY:entrypoint&quot;)</div><div class="code_line"># &nbsp; pragma check_stack(off)</div><div class="code_line">#endif // _DEBUG</div><div class="code_line">&nbsp;</div><div class="code_line">#define INSTALL_SEH(seh_interrupt) &nbsp; &nbsp; &nbsp;\</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;__asm call install_seh &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;__asm mov esp, [esp+8] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;__asm jmp seh_interrupt &nbsp; &nbsp; &nbsp; &nbsp; \</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;__asm install_seh: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;__asm push dword ptr fs:[0] &nbsp; &nbsp; \</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;__asm mov dword ptr fs:[0], esp</div><div class="code_line">&nbsp;</div><div class="code_line">#define RESTORE_SEH(seh_interrupt) &nbsp; &nbsp; &nbsp;\</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;__asm seh_interrupt: nop; &nbsp; &nbsp; &nbsp; \</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ExitProcess((UINT)-1)</div><div class="code_line">&nbsp;</div><div class="code_line">#define fopen_new(fname) CreateFile(fname, GENERIC_READ|GENERIC_WRITE, &nbsp;\</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FILE_SHARE_READ|FILE_SHARE_WRITE, 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)</div><div class="code_line">&nbsp;</div><div class="code_line">#define strlen lstrlen</div><div class="code_line">#define strcat lstrcat</div><div class="code_line">&nbsp;</div><div class="code_line">#define WIN32_LEAN_AND_MEAN</div><div class="code_line">#include &#60;windows.h&#62;</div><div class="code_line">#include &#60;shellapi.h&#62;</div><div class="code_line">&nbsp;</div><div class="code_line">int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;char fname[MAX_PATH] = {0}, scriptname[MAX_PATH] = {0}, dir[MAX_PATH] = {0};</div><div class="code_line">&nbsp;&nbsp; &nbsp;const char script[] = </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;try {\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;var fso, f, script, fname = \&quot;%s\&quot;;\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;fso = new ActiveXObject(\&quot;Scripting.FileSystemObject\&quot;);\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;f = fso.GetFile(fname)\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;while (fso.FileExists(fname))\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;\tf.Delete();\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;script = fso.GetFile(\&quot;%s\&quot;);\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;script.Delete();\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;} finally {}\n&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp;char buf[8192] = {0};</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;GetModuleFileName(NULL, fname, MAX_PATH);</div><div class="code_line">&nbsp;&nbsp; &nbsp;for (int i=strlen(fname)-1; i&#62;0 &amp;&amp; fname[i]!=&#39;\&#39;; i--) ; i++;</div><div class="code_line">&nbsp;&nbsp; &nbsp;GetTempFileName(&quot;.&quot;, &quot;js&quot;, GetTickCount()^0x12345678, scriptname);</div><div class="code_line">&nbsp;&nbsp; &nbsp;strcat(scriptname, &quot;.js&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;wsprintf(buf, script, (char *)&amp;fname[i], (char *)&amp;scriptname[2]);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;HANDLE f = fopen_new(scriptname);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (f==INVALID_HANDLE_VALUE) return 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;DWORD write = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;WriteFile(f, (LPCVOID)&amp;buf[0], strlen(buf), &amp;write, NULL);</div><div class="code_line">&nbsp;&nbsp; &nbsp;CloseHandle(f);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);</div><div class="code_line">&nbsp;&nbsp; &nbsp;SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;GetCurrentDirectory(MAX_PATH, dir);</div><div class="code_line">&nbsp;&nbsp; &nbsp;ShellExecute(NULL, &quot;open&quot;, scriptname, NULL, dir, SW_HIDE);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return 0;</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">#ifndef _DEBUG</div><div class="code_line">VOID APIENTRY entrypoint(VOID)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;INSTALL_SEH(seh_int);</div><div class="code_line">&nbsp;&nbsp; &nbsp;ExitProcess((UINT)WinMain(GetModuleHandle(NULL), 0, GetCommandLine(), SW_SHOWDEFAULT));</div><div class="code_line">&nbsp;&nbsp; &nbsp;RESTORE_SEH(seh_int);</div><div class="code_line">}</div><div class="code_line">#endif // _DEBUG</div></ol></div></div></div></div>]]></description>
        <author>cqwerty</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=605324</guid>
        <pubDate>Tue, 08 Feb 2005 12:21:34 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=605324</link>
        <description><![CDATA[Frikadell0: А как удалить dll из самой себя? да еще и неизвестно, подгружена она или нет...]]></description>
        <author>Frikadell0</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=594832</guid>
        <pubDate>Sat, 29 Jan 2005 16:44:06 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=594832</link>
        <description><![CDATA[Mik: 2 p_kolya.<br>Срабатывало 100%, причем прога была коммерческая и её &quot;тестили&quot; под разную винду.<br><br>Кстати, этот вариант, описанный http://www.codeguru.com/Cpp/W-P/win32/article.php/c4533/<br>я встречал где-то, но под авторством Джеффри Рихтера. Ему я немного доверяю :-)]]></description>
        <author>Mik</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=593956</guid>
        <pubDate>Fri, 28 Jan 2005 15:23:50 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=593956</link>
        <description><![CDATA[p_kolya: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Срабатывало в 2000 / Xp очень стабильно. </div></div><br>
&quot;Очень стабильно&quot; - это как? Т.е. всегда срабатывало или срабатывало в 90% случаев?]]></description>
        <author>p_kolya</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=592561</guid>
        <pubDate>Thu, 27 Jan 2005 14:37:47 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=592561</link>
        <description><![CDATA[Mik: Я делал как описано в http://www.codeguru.com/Cpp/W-P/win32/article.php/c4533/<br>Срабатывало в 2000 / Xp очень стабильно.]]></description>
        <author>Mik</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=588663</guid>
        <pubDate>Mon, 24 Jan 2005 13:07:34 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=588663</link>
        <description><![CDATA[.alex: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=77111&view=findpost&p=588653'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>feliks &#064; <time class="tag-quote__quoted-time" datetime="2005-01-24T13:00:08+00:00">24.01.05, 13:00</time></span><div class='quote '>этот работает на 2000 великолепно </div></div><br>
А в XP Sp2 - нет... :whistle:]]></description>
        <author>.alex</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=588653</guid>
        <pubDate>Mon, 24 Jan 2005 13:00:08 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=588653</link>
        <description><![CDATA[feliks: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">int main(int argc, char *argv[])</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;char &nbsp; &nbsp;buf[MAX_PATH];</div><div class="code_line">&nbsp;&nbsp; &nbsp;HMODULE module;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;module = GetModuleHandle(0);</div><div class="code_line">&nbsp;&nbsp; &nbsp;GetModuleFileName(module, buf, MAX_PATH);</div><div class="code_line">&nbsp;&nbsp; &nbsp;CloseHandle((HANDLE)4);</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;__asm </div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;lea &nbsp; &nbsp; eax, buf</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;push &nbsp; &nbsp;0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;push &nbsp; &nbsp;0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;push &nbsp; &nbsp;eax</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;push &nbsp; &nbsp;ExitProcess</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;push &nbsp; &nbsp;module</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;push &nbsp; &nbsp;DeleteFile</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;push &nbsp; &nbsp;UnmapViewOfFile</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;ret</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp;return 0;</div><div class="code_line">}</div></ol></div></div></div></div><br>
этот работает на 2000 великолепно]]></description>
        <author>feliks</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=580555</guid>
        <pubDate>Mon, 17 Jan 2005 17:34:43 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=580555</link>
        <description><![CDATA[MOHAX: Ни один не работает =(]]></description>
        <author>MOHAX</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=579577</guid>
        <pubDate>Sun, 16 Jan 2005 23:13:16 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=579577</link>
        <description><![CDATA[SUnteXx: Люди, а это что:<br>http://www.sources.ru/cpp/faqs/96.htm<br>??]]></description>
        <author>SUnteXx</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=559825</guid>
        <pubDate>Wed, 29 Dec 2004 12:08:11 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=559825</link>
        <description><![CDATA[.alex: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=77111&view=findpost&p=557999'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>SimBiOd &#064; 27.12.04, 23:50</span><div class='quote '>...но у меня на ХР не работает... </div></div><br>
У меня тоже... :whistle:]]></description>
        <author>.alex</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=557999</guid>
        <pubDate>Mon, 27 Dec 2004 20:50:41 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=557999</link>
        <description><![CDATA[SimBiOd: Может я корявый, но у меня на ХР не работает...  :huh:]]></description>
        <author>SimBiOd</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=553352</guid>
        <pubDate>Thu, 23 Dec 2004 14:24:41 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=553352</link>
        <description><![CDATA[cqwerty: <strong class='tag-b'>Demo_S</strong>, дык один из этих вариантов (с асм-вставкой) есть на sources.ru =). а ты их проверял?]]></description>
        <author>cqwerty</author>
        <category>C/C++ FAQ</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=552487</guid>
        <pubDate>Wed, 22 Dec 2004 22:11:14 +0000</pubDate>
        <title>удаление ехе из самого себя</title>
        <link>https://forum.sources.ru/index.php?showtopic=77111&amp;view=findpost&amp;p=552487</link>
        <description><![CDATA[Demo_S: собсно на rsdn появился интерестный метод, без bat файла и варианта с перезагрузкой<br>http://rsdn.ru/article/baseserv/QnADelExe.xml]]></description>
        <author>Demo_S</author>
        <category>C/C++ FAQ</category>
      </item>
	
      </channel>
      </rss>
	