您的位置:首页 > 其它

[ 转载 ] kernel32.BaseThreadInitThunk

2015-08-23 16:21 2181 查看
Edited by wap2k, 20 October 2014 - 07:52 PM.

This function is called to start a Win32 thread. Its purpose is to call the thread start address.
If the thread returns it will terminate the thread and delete it's stack.

Arguments:

DWORD LdrReserved - Should always be 0 for user threads

LPTHREAD_START_ROUTINE lpStartAddress - Supplies the starting address of the new thread. The address is a function that never returns and that accepts a single DWORD pointer argument.

LPVOID lpParameter - Supplies a single parameter value passed to the thread.

Return value is nothing.

Before Vista:

VOID BaseThreadInitThunk(IN DWORD LdrReserved, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter)]VOID
BaseThreadStart(
IN LPTHREAD_START_ROUTINE lpStartAddress,
IN LPVOID lpParameter
){
try {

//
// test for fiber start or new thread
//

if ( NtCurrentTeb()->NtTib.Version == OS2_VERSION ) {
if ( !BaseRunningInServerProcess ) {
CsrNewThread();
}
}
ExitThread((lpStartAddress)(lpParameter));
}
except(UnhandledExceptionFilter( GetExceptionInformation() )) {
if ( !BaseRunningInServerProcess ) {
ExitProcess(GetExceptionCode());
}
else {
ExitThread(GetExceptionCode());
}
}
}

After Vista similar to this:

VOID BaseThreadInitThunk(DWORD LdrReserved, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter)
{
int tUserThread;

if ( !LdrReserved )
{
tUserThread = (lpStartAddress)(lpParameter);
RtlExitUserThread(tUserThread);
}
if(Flag_v7FFE02D0 & 0x10) BasepInitializeTermsrvFpns();
}
[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: