bootstrap
[reactos.git] / ntoskrnl / ps / thread.c
index c4da6f3..a4b53c7 100644 (file)
@@ -43,16 +43,20 @@ KSPIN_LOCK PiThreadListLock;
 /*
  * PURPOSE: List of threads associated with each priority level
  */
-LIST_ENTRY PiThreadListHead;
 static LIST_ENTRY PriorityListHead[MAXIMUM_PRIORITY];
 static BOOLEAN DoneInitYet = FALSE;
+LIST_ENTRY PiThreadListHead;
+#ifndef LIBCAPTIVE
 static PETHREAD IdleThreads[MAXIMUM_PROCESSORS];
+#endif /* LIBCAPTIVE */
 ULONG PiNrThreads = 0;
+#ifndef LIBCAPTIVE
 ULONG PiNrReadyThreads = 0;
 static HANDLE PiReaperThreadHandle;
 static KEVENT PiReaperThreadEvent;
 static BOOL PiReaperThreadShouldTerminate = FALSE;
 ULONG PiNrThreadsAwaitingReaping = 0;
+#endif /* LIBCAPTIVE */
 
 static GENERIC_MAPPING PiThreadMapping = {THREAD_READ,
                                          THREAD_WRITE,
@@ -61,17 +65,23 @@ static GENERIC_MAPPING PiThreadMapping = {THREAD_READ,
 
 /* FUNCTIONS ***************************************************************/
 
+#ifndef LIBCAPTIVE
+
 PKTHREAD STDCALL KeGetCurrentThread(VOID)
 {
    return(KeGetCurrentKPCR()->CurrentThread);
 }
 
+#endif /* LIBCAPTIVE */
+
 PETHREAD STDCALL PsGetCurrentThread(VOID)
 {
   PKTHREAD CurrentThread = KeGetCurrentKPCR()->CurrentThread;
   return(CONTAINING_RECORD(CurrentThread, ETHREAD, Tcb));
 }
 
+#ifndef LIBCAPTIVE
+
 HANDLE STDCALL PsGetCurrentThreadId(VOID)
 {
    return(PsGetCurrentThread()->Cid.UniqueThread);
@@ -393,6 +403,8 @@ PsPrepareForApplicationProcessorInit(ULONG Id)
           Id, IdleThread->Cid.UniqueThread);
 }
 
+#endif /* LIBCAPTIVE */
+
 VOID 
 PsInitThreadManagment(VOID)
 /*
@@ -402,7 +414,9 @@ PsInitThreadManagment(VOID)
    PETHREAD FirstThread;
    ULONG i;
    HANDLE FirstThreadHandle;
+#ifndef LIBCAPTIVE
    NTSTATUS Status;
+#endif /* LIBCAPTIVE */
    
    KeInitializeSpinLock(&PiThreadListLock);
    for (i=0; i < MAXIMUM_PRIORITY; i++)
@@ -414,7 +428,7 @@ PsInitThreadManagment(VOID)
    
    PsThreadType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
    
-   RtlInitUnicodeStringFromLiteral(&PsThreadType->TypeName, L"Thread");
+   RtlInitUnicodeStringFromLiteral(&PsThreadType->TypeName, REACTOS_UCS2(L"Thread"));
    
    PsThreadType->Tag = TAG('T', 'H', 'R', 'T');
    PsThreadType->TotalObjects = 0;
@@ -427,7 +441,11 @@ PsInitThreadManagment(VOID)
    PsThreadType->Dump = NULL;
    PsThreadType->Open = NULL;
    PsThreadType->Close = NULL;
+#ifndef LIBCAPTIVE
    PsThreadType->Delete = PiDeleteThread;
+#else /* !LIBCAPTIVE */
+   PsThreadType->Delete = NULL;
+#endif /* !LIBCAPTIVE */
    PsThreadType->Parse = NULL;
    PsThreadType->Security = NULL;
    PsThreadType->QueryName = NULL;
@@ -446,6 +464,7 @@ PsInitThreadManagment(VOID)
       
    DoneInitYet = TRUE;
 
+#ifndef LIBCAPTIVE
    /*
     * Create the reaper thread
     */
@@ -462,8 +481,11 @@ PsInitThreadManagment(VOID)
        DPRINT1("PS: Failed to create reaper thread.\n");
        KeBugCheck(0);
      }
+#endif /* LIBCAPTIVE */
 }
 
+#ifndef LIBCAPTIVE
+
 LONG STDCALL
 KeSetBasePriorityThread (PKTHREAD      Thread,
                         LONG           Increment)
@@ -647,4 +669,6 @@ PsLookupThreadByThreadId(IN PVOID ThreadId,
   return(STATUS_INVALID_PARAMETER);
 }
 
+#endif /* LIBCAPTIVE */
+
 /* EOF */