flat assembler
Message board for the users of flat assembler.

Index > Windows > who knows how to terminate the program?

Author
Thread Post new topic Reply to topic
andrr



Joined: 05 Jun 2010
Posts: 4
andrr
-------------------------------------
format PE GUI 4.0
include 'win32a.inc'
entry start
section '.data' data readable writeable

...........

push 0
call ExitProcess

end section

--------------------------------------------------

this code generate a mistake(
Post 05 Jun 2010, 11:35
View user's profile Send private message Send e-mail ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17474
Location: In your JS exploiting you and your system
revolution
Code:
call [ExitProcess]    
Post 05 Jun 2010, 11:37
View user's profile Send private message Visit poster's website Reply with quote
andrr



Joined: 05 Jun 2010
Posts: 4
andrr
Quote:

call [ExitProcess]

that does't work
Post 05 Jun 2010, 11:41
View user's profile Send private message Send e-mail ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17474
Location: In your JS exploiting you and your system
revolution
Show your whole code please. We can't guess what you have done with only partial code.
Post 05 Jun 2010, 11:50
View user's profile Send private message Visit poster's website Reply with quote
andrr



Joined: 05 Jun 2010
Posts: 4
andrr
i want to know how to terminate a program in general
is it any need to post a whole code?
Quote:

Show your whole code please. We can't guess what you have done with only partial code.
Post 05 Jun 2010, 11:54
View user's profile Send private message Send e-mail ICQ Number Reply with quote
ass0



Joined: 31 Dec 2008
Posts: 521
Location: ( . Y . )
ass0
In order to use ExitProcess you need its offset, whether imported static or dynamically from kernel32.dll

_________________
Image
Nombre: Aquiles Castro.
Location2: about:robots
Post 05 Jun 2010, 12:23
View user's profile Send private message Reply with quote
andrr



Joined: 05 Jun 2010
Posts: 4
andrr
will you write a code pls
Quote:

In order to use ExitProcess you need its offset, whether imported static or dynamically from kernel32.dll
Post 05 Jun 2010, 12:28
View user's profile Send private message Send e-mail ICQ Number Reply with quote
ass0



Joined: 31 Dec 2008
Posts: 521
Location: ( . Y . )
ass0
Anyway a quick solution:
replace
Code:
include 'win32a.inc'
    

by
Code:
include 'win32ax.inc'
    

and
Code:
push 0 
call ExitProcess
    

by
Code:
invoke ExitProcess,0
    

_________________
Image
Nombre: Aquiles Castro.
Location2: about:robots
Post 05 Jun 2010, 12:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17474
Location: In your JS exploiting you and your system
revolution
andrr: See the examples in the "examples" folder in the zip file.
Post 05 Jun 2010, 12:40
View user's profile Send private message Visit poster's website Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
Code:
ret    

_________________
This is a block of text that can be added to posts you make.
Post 05 Jun 2010, 16:17
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
adroit



Joined: 21 Feb 2010
Posts: 252
adroit
You could try:
Code:
format PE GUI 4.0 
include 'win32a.inc' 
entry start 


section '.data' data readable writeable 
;        ........... 

section '.code' code readable executable
         start:
;        ........... 
         push 0 
         call [ExitProcess]


section '.idata' import data readable writeable

library kernel,'KERNEL32.DLL'
import kernel, ExitProcess, 'ExitProcess' 
    

Or,
You could do as ass0 recommended:
use include "win32ax.inc", which makes things easier.
Code:
format PE GUI 4.0
include 'win32ax.inc'
entry start


.data
;        ...........

.code
         start:
;        ...........
         invoke ExitProcess,0
.end start

;There are no needs to import DLLs when using "include 'Win32ax.inc'"
    
Post 06 Jun 2010, 00:07
View user's profile Send private message Reply with quote
FrozenKnight



Joined: 24 Jun 2005
Posts: 128
FrozenKnight
i personally prefer the 'TerminateProcess' API for a fast dirty process kill.
Post 01 Jul 2010, 11:17
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
FrozenKnight wrote:
i personally prefer the 'TerminateProcess' API for a fast dirty process kill.
Despite race condition in Gold/SP1/2 implementations?

----8<----
MeshNix wrote:
…which makes things easier.
Some things easier, some things harder. What if you/he need/s some function outside of set declared in «API\*.INC»?
Post 01 Jul 2010, 17:14
View user's profile Send private message Reply with quote
FrozenKnight



Joined: 24 Jun 2005
Posts: 128
FrozenKnight
baldr wrote:
FrozenKnight wrote:
i personally prefer the 'TerminateProcess' API for a fast dirty process kill.
Despite race condition in Gold/SP1/2 implementations?


I fail to see how that applies, the only case where i could see something like that applying is if someone were to use the API to terminate a system process. But even then, i don't see any sources linking the race condition to this particular API. The only possible problem i have seen with this is that it doesn't give the process a chance to execute cleanup code. Which when i normally use it i want a hard shutdown of the intended process, not a proper cleanup, usually because the process has frozen or is one of those annoying programs that won't let you close it.
Post 02 Jul 2010, 11:31
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.