ExitProcess

Parameters

uExitCode

Specifies the exit code for the process, and for all threads that are terminated as a result of this call. Use the GetExitCodeProcess function to retrieve the process's exit value. Use the GetExitCodeThread function to retrieve a thread's exit value.
//函数调用准备进程或线程的返回结果。使用GetExitCodeProcess函数可以得到进程的结束值,用GetExitCodeThread函数可以得到线程的结束值。
 

Return Values

This function does not return a value.

Remarks

ExitProcess is the preferred method of ending a process. This function provides a clean process shutdown. This includes calling the entry-point function of all attached dynamic-link libraries (DLLs) with a value indicating that the process is detaching from the DLL. If a process terminates by calling TerminateProcess, the DLLs that the process is attached to are not notified of the process termination.
//ExitProcess 是结束进程最完美的方法。这个函数可以完全的结束进程,包括解除调用动态链接库的入口函数时的进程值dll的关系。如果进程通过EXITprocess结束掉,进程用到的dll不用再等待进程的结束。
After all attached DLLs have executed any process termination value, this function terminates the current process.

Terminating a process causes the following:
//结束一个进程会有如下结果:
1. All of the object handles opened by the process are closed.
//所有对象的句柄被已经关闭的进程打开
 2. All of the threads in the process terminate their execution.
//进程中的所有线程结束
 3. The state of the process object becomes signaled, satisfying any threads that had been waiting for the process to terminate.
//进程对象的状态作为一个信号传递给所有在等待结束的线程:结束吧。
 4. The states of all threads of the process become signaled, satisfying any threads that had been waiting for the threads to terminate.
//进程下的线程状态作为一个信号传递给所有在等待结束的子线程:结束吧。
 5. The termination status of the process changes from STILL_ACTIVE to the exit value of the process.
//进程的结束状态从still_active到退出。

 

Terminating a process does not cause child processes to be terminated.
//不会引起子进程结束
Terminating a process does not necessarily remove the process object from the operating system. A process object is deleted when the last handle to the process is closed.
//结束一个进程后进程对象不一定从操作系统中移除。一个进程对象只有在最后一个句柄关闭后才会被删除
The ExitProcess, ExitThread, CreateThread, CreateRemoteThread functions, and a process that is starting (as the result of a call by CreateProcess) are serialized between each other
//ExitProcess, ExitThread, CreateThread, CreateRemoteThread这些函数在进程的操作上是一系列的操作。
 within a process. Only one of these events can happen in an address space at a time. This means the following restrictions hold:

During process startup and DLL initialization routines, new threads can be created, but they do not begin execution until DLL initialization is done for the process.
Only one thread in a process can be in a DLL initialization or detach routine at a time.
ExitProcess does not return until no threads are in their DLL initialization or detach routines.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值