Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Down

KillSelf Find similar branches


T2   (2001-12-14 03:22) [0]

How to make a program commit suicide? The current is not at reboot, but in real time!



KilkennyCat   (2001-12-14 04:12) [1]

Suicide - meaning removing from the screw?
She just has to live in the memory, from where she calmly erase herself from the screw, and then says to herself: close.



T2   (2001-12-14 04:32) [2]

Yes, removal from the screw. But he doesn’t want to delete herself — the grit file is locked (obviously, it’s not all in his memory, but it loads and keeps it open) :(



KilkennyCat   (2001-12-14 04:37) [3]

Well, of course! If not urgently, then I will write as (now busy), until I just remember the scraps of dosovsky options from the “battle in memory”.



T2   (2001-12-14 05:32) [4]

Ok, there will be time, throw at gu-gu-gu2@mtu-net.ru or write here.



Milz   (2001-12-14 09:31) [5]

I do not remember where I dug out, completes the program and removes it from the screw.
Tell me how it works, specifically I am interested in how api calls occur, software showed that it’s not just a transition to a function address, but some perversions in kernel32, and then api itself is called, and so on with each one. What is it and how are the parameters transmitted?

uses
windows;

procedure DeleteSelf;
var hModule: THandle;
szModuleName: array [0..MAX_PATH] of char;
hKrnl32: THandle;
pExitProcess, pDeleteFile, pFreeLibrary, pUnmapViewOfFile: pointer;
ExitCode: UINT;
begin
hModule: = GetModuleHandle (nil);
GetModuleFileName (hModule, szModuleName, sizeof (szModuleName));
hKrnl32: = GetModuleHandle ("kernel32");
pExitProcess: = GetProcAddress (hKrnl32, "ExitProcess");
pDeleteFile: = GetProcAddress (hKrnl32, "DeleteFileA");
pFreeLibrary: = GetProcAddress (hKrnl32, "FreeLibrary");
pUnmapViewOfFile: = GetProcAddress (hKrnl32, "UnmapViewOfFile");
ExitCode: = system.ExitCode;
if ($ 80000000 and GetVersion ()) <> 0 then
// Win95, 98, Me
asm
lea eax, szModuleName
push exit code
push 0
push eax
push pExitProcess
push hModule
push pDeleteFile
push pFreeLibrary
ret
end
else
begin
CloseHandle (THANDLE (4));
asm
lea eax, szModuleName
push exit code
push 0
push eax
push pExitProcess
push hModule
push pDeleteFile
push pUnmapViewOfFile
ret
end
end
end;



Andrey   (2001-12-14 10:34) [6]

Gentlemen, Why so many tricks, :) contact the FAQ at http://delphi.mastak.ru/cgi-bin/faq.pl?look=1&id=988621694&n=15



paul_shmakov   (2001-12-15 01:14) [7]

2 Andrey:
FAQ is not right. Milz gave the right decision. here in the WinApi forum, we have considered this decision in detail.



А вот   (2001-12-15 01:41) [8]

about the "correctness" - need to consult with Digitman. In my opinion, he became interested in this and dug deeper. If IMHO he wants to share. What I personally doubt, because the topic is "slippery".



paul_shmakov   (2001-12-16 02:13) [9]

2 And ​​here:
:) Well, if Digitman does not want to share, then I will share.

http://delphi.mastak.ru/cgi-bin/forum.pl?look=1&id=1004956210&n=5

see link, well, very detailed for winnt / 2k



Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Top









Memory: 0.84 MB
Time: 0.18 c
1-22142
Beginner
2001-12-20 10:42
2002.01.08
ReplaceDialog


1-22144
shornik
2001-12-20 11:36
2002.01.08
Masters !!!! Please help with the problem!


14-22361
Nikolay
2001-11-08 00:17
2002.01.08
Yes...............................


14-22386
Dense
2001-11-08 21:13
2002.01.08
Interesting? How much?


3-21974
Dup
2001-12-06 10:30
2002.01.08
TQRExpr





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Español swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish