mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Implemented dll detach on thread termination
svn path=/trunk/; revision=1333
This commit is contained in:
parent
19e205fb97
commit
fbac67d372
5 changed files with 110 additions and 17 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: dllmain.c,v 1.14 2000/09/05 10:59:27 ekohl Exp $
|
||||
/* $Id: dllmain.c,v 1.15 2000/09/05 13:52:04 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntdll/csr.h>
|
||||
#include <ntdll/ldr.h>
|
||||
#include <napi/shared_data.h>
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
|
@ -51,6 +52,9 @@ WINBOOL STDCALL DllMain(HANDLE hInst,
|
|||
(PKUSER_SHARED_DATA)USER_SHARED_DATA_BASE;
|
||||
|
||||
DPRINT("DLL_PROCESS_ATTACH\n");
|
||||
|
||||
LdrDisableThreadCalloutsForDll ((PVOID)hInst);
|
||||
|
||||
/*
|
||||
* Connect to the csrss server
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.21 2000/09/01 17:09:19 ekohl Exp $
|
||||
/* $Id: stubs.c,v 1.22 2000/09/05 13:52:04 ekohl Exp $
|
||||
*
|
||||
* KERNEL32.DLL stubs (unimplemented functions)
|
||||
* Remove from this file, if you implement them.
|
||||
|
@ -748,16 +748,6 @@ ExtendVirtualBuffer (
|
|||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
FatalExit (
|
||||
int ExitCode
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
||||
ATOM
|
||||
STDCALL
|
||||
FindAtomW (
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: proc.c,v 1.34 2000/09/05 11:00:07 ekohl Exp $
|
||||
/* $Id: proc.c,v 1.35 2000/09/05 13:52:30 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -509,6 +509,16 @@ FatalAppExitW (
|
|||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
FatalExit (
|
||||
int ExitCode
|
||||
)
|
||||
{
|
||||
ExitProcess(ExitCode);
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
GetPriorityClass (
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: thread.c,v 1.18 2000/09/01 17:09:50 ekohl Exp $
|
||||
/* $Id: thread.c,v 1.19 2000/09/05 13:52:44 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -170,6 +170,26 @@ DWORD STDCALL GetCurrentThreadId()
|
|||
VOID STDCALL ExitThread(UINT uExitCode)
|
||||
{
|
||||
NTSTATUS errCode;
|
||||
BOOLEAN LastThread;
|
||||
NTSTATUS Status;
|
||||
|
||||
/*
|
||||
* Terminate process if this is the last thread
|
||||
* of the current process
|
||||
*/
|
||||
Status = NtQueryInformationThread(NtCurrentThread(),
|
||||
ThreadAmILastThread,
|
||||
&LastThread,
|
||||
sizeof(BOOLEAN),
|
||||
NULL);
|
||||
if (NT_SUCCESS(Status) && LastThread == TRUE)
|
||||
{
|
||||
ExitProcess (uExitCode);
|
||||
}
|
||||
|
||||
/* FIXME: notify csrss of thread termination */
|
||||
|
||||
LdrShutdownThread();
|
||||
|
||||
errCode = NtTerminateThread(NtCurrentThread(),
|
||||
uExitCode);
|
||||
|
@ -282,7 +302,7 @@ TerminateThread (
|
|||
)
|
||||
{
|
||||
NTSTATUS errCode;
|
||||
|
||||
|
||||
errCode = NtTerminateThread(hThread,
|
||||
dwExitCode);
|
||||
if (!NT_SUCCESS(errCode))
|
||||
|
|
|
@ -92,7 +92,7 @@ NTSTATUS STDCALL NtSetInformationThread(HANDLE ThreadHandle,
|
|||
break;
|
||||
|
||||
case ThreadAmILastThread:
|
||||
break;
|
||||
break;
|
||||
|
||||
case ThreadPriorityBoost:
|
||||
break;
|
||||
|
@ -114,7 +114,76 @@ NtQueryInformationThread (
|
|||
IN ULONG ThreadInformationLength,
|
||||
OUT PULONG ReturnLength)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
PETHREAD Thread;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = ObReferenceObjectByHandle(ThreadHandle,
|
||||
THREAD_QUERY_INFORMATION,
|
||||
PsThreadType,
|
||||
UserMode,
|
||||
(PVOID*)&Thread,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
switch (ThreadInformationClass)
|
||||
{
|
||||
case ThreadBasicInformation:
|
||||
break;
|
||||
|
||||
case ThreadTimes:
|
||||
break;
|
||||
|
||||
case ThreadPriority:
|
||||
break;
|
||||
|
||||
case ThreadBasePriority:
|
||||
break;
|
||||
|
||||
case ThreadAffinityMask:
|
||||
break;
|
||||
|
||||
case ThreadImpersonationToken:
|
||||
break;
|
||||
|
||||
case ThreadDescriptorTableEntry:
|
||||
UNIMPLEMENTED;
|
||||
break;
|
||||
|
||||
case ThreadEventPair:
|
||||
UNIMPLEMENTED;
|
||||
break;
|
||||
|
||||
case ThreadQuerySetWin32StartAddress:
|
||||
break;
|
||||
|
||||
case ThreadZeroTlsCell:
|
||||
break;
|
||||
|
||||
case ThreadPerformanceCount:
|
||||
break;
|
||||
|
||||
case ThreadAmILastThread:
|
||||
{
|
||||
BOOLEAN *LastThread;
|
||||
PLIST_ENTRY Entry;
|
||||
|
||||
LastThread = (PBOOLEAN) ThreadInformation;
|
||||
Entry = &(Thread->ThreadsProcess->ThreadListHead);
|
||||
*LastThread = (Entry->Flink->Flink == Entry)?TRUE:FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case ThreadPriorityBoost:
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
ObDereferenceObject(Thread);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID KeSetPreviousMode(ULONG Mode)
|
||||
|
|
Loading…
Reference in a new issue