User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 401,951 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,341 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 1953 | Replies: 3
Reply
Join Date: Jun 2006
Location: UK (Bristol)
Posts: 225
Reputation: Mushy-pea is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
Mushy-pea's Avatar
Mushy-pea Mushy-pea is offline Offline
Posting Whiz in Training

Proper process termination

  #1  
Jan 12th, 2007
Hello everyone. I read a couple of tutorials on x86 assembly a while ago. It was made clear in these that certain instructions need to be included at the end of a program to make it close properly. However, there was some inconsistency about how a program should be terminated. Could anyone tell me how a process should be closed on a win32 system and is this proceedure OS specific? Thanks.

Steven.
Hello, you're through to Steven on the BT Business technical help desk. Could I take your broadband telephone number please?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,694
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 36
Solved Threads: 878
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Most Valuable Poster

Re: Proper process termination

  #2  
Jan 12th, 2007
see this thred for example. It is specific to 16-bit MS-DOS 6.X and earlier. Can't run it in 32-bit applications because int 21 instruction not allowed unless running in ring 0 as super user (os)

MOV AH,4CH ; return control to DOS
INT 21H
Last edited by Ancient Dragon : Jan 12th, 2007 at 11:44 am.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: Mar 2005
Posts: 90
Reputation: Evenbit is on a distinguished road 
Rep Power: 4
Solved Threads: 2
Evenbit's Avatar
Evenbit Evenbit is offline Offline
Junior Poster in Training

Re: Proper process termination

  #3  
Jan 13th, 2007
Originally Posted by Mushy-pea View Post
Hello everyone. I read a couple of tutorials on x86 assembly a while ago. It was made clear in these that certain instructions need to be included at the end of a program to make it close properly. However, there was some inconsistency about how a program should be terminated. Could anyone tell me how a process should be closed on a win32 system and is this proceedure OS specific? Thanks.

Steven.



There are three (3) different means of process termination on a Win32 system and all three are "proper" or valid.

The first (most common) method is: any thread in the process can make a call to the ExitProcess function.

The second (should be avoided) method is that another process (e.g. application, process explorer) makes a call to the Terminate Process function passing as a parameter the process handle for the application being terminated.

The third (rare) method is when all the threads in a process simply die on their own {e.g. they all call the ExitThread function} leaving the process with no reason to exist so the OS kills the process. NOTE: Since every process has at least one thread....if you do not indulge in any multithreading code {i.e. make calls to CreateThread}, then ExitThread is synonimous with ExitProcess.
while (CPU is present) {some assembly required}
Reply With Quote  
Join Date: Jan 2007
Posts: 49
Reputation: Purple Avenger is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Purple Avenger Purple Avenger is offline Offline
Light Poster

Re: Proper process termination

  #4  
Jan 13th, 2007
Originally Posted by Mushy-pea View Post
is this proceedure OS specific?


Always.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Assembly Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Assembly Forum

All times are GMT -4. The time now is 5:33 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC