flat assembler
Message board for the users of flat assembler.

Index > Windows > why eax==-1?

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20517
Location: In your JS exploiting you and your system
revolution 13 Jan 2010, 18:57
From the external apps point of view, I think it is reasonable to expect a program to either ExitProcess or TerminateProcess to quit itself. Otherwise you have to enumerate and monitor all threads created and exited throughout the life of the program until you detect that the only threads left running are the ones that you injected.
Post 13 Jan 2010, 18:57
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 13 Jan 2010, 18:59
No, I don't think it is reasonable to expect that someone doesn't use something that is allowed. That exactly the case of bad programming.
Post 13 Jan 2010, 18:59
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20517
Location: In your JS exploiting you and your system
revolution 13 Jan 2010, 19:03
Allowed maybe, but certainly not preferred. Why risk having your app blamed for causing problems? For idealistic reasons?

And so easy to solve.
Post 13 Jan 2010, 19:03
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 13 Jan 2010, 19:12
revolution wrote:
For idealistic reasons?
My point, exactly. Smile

But don't be afraid, I won't use ExitThread for main thread in any standard fasm examples. "Preferred" still means something to me. Wink
Post 13 Jan 2010, 19:12
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20517
Location: In your JS exploiting you and your system
revolution 13 Jan 2010, 19:19
Tomasz Grysztar wrote:
"Preferred" still means something to me. Wink
Glad to hear it. Smile
Post 13 Jan 2010, 19:19
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 13 Jan 2010, 22:48
But who said a process with one thread is just the thread either? Maybe it has additional info that, if the system doesn't handle it when the last thread is closed, you should use ExitProcess for that too.

I agree that it is preferred to find out "buggy" threads created, because otherwise you're just using garbage collector without solving the problem, but expecting ExitThread to clean up the process, not just the thread, is also expecting garbage collector to do the job! Confused
Post 13 Jan 2010, 22:48
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 14 Jan 2010, 08:55
Borsuc wrote:
I agree that it is preferred to find out "buggy" threads created, because otherwise you're just using garbage collector without solving the problem, but expecting ExitThread to clean up the process, not just the thread, is also expecting garbage collector to do the job! Confused
You did not read the discussion carefully. Wink Expecting this is based on the WinAPI documentation, that says:
ExitThread wrote:
If the thread is the last thread in the process when this function is called, the thread's process is also terminated.
Post 14 Jan 2010, 08:55
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 14 Jan 2010, 15:32
Oops Embarassed

_________________
Previously known as The_Grey_Beast
Post 14 Jan 2010, 15:32
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.