Author: fireball
Date: Sat Jul 18 11:35:40 2009
New Revision: 42031
URL:
http://svn.reactos.org/svn/reactos?rev=42031&view=rev
Log:
- Add win32 thread infrastructure.
- Cleanup win32 process/thread info structures.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/gre/init.c
branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c
branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h
branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/init.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/init.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/init.c [iso-8859-1] Sat Jul 18
11:35:40 2009
@@ -28,7 +28,7 @@
Win32kProcessCallout(PEPROCESS Process,
BOOLEAN Create)
{
- PW32PROCESS Win32Process;
+ PPROCESSINFO Win32Process;
DPRINT("Enter Win32kProcessCallback\n");
@@ -82,23 +82,6 @@
Win32Process->HeapMappings.KernelMapping = (PVOID)GlobalUserHeap;
Win32Process->HeapMappings.UserMapping = UserBase;
Win32Process->HeapMappings.Count = 1;
-
- InitializeListHead(&Win32Process->ClassList);
- InitializeListHead(&Win32Process->MenuListHead);
- InitializeListHead(&Win32Process->PrivateFontListHead);
- ExInitializeFastMutex(&Win32Process->PrivateFontListLock);
- InitializeListHead(&Win32Process->DriverObjListHead);
- ExInitializeFastMutex(&Win32Process->DriverObjListLock);
-
- if(Process->Peb != NULL)
- {
- /* map the gdi handle table to user land */
- //Process->Peb->GdiSharedHandleTable =
GDI_MapHandleTable(GdiTableSection, Process);
- //Process->Peb->GdiDCAttributeList = GDI_BATCH_LIMIT;
- }
-
- /* setup process flags */
- Win32Process->W32PF_flags = 0;
}
else
{
@@ -114,7 +97,61 @@
Win32kThreadCallout(PETHREAD Thread,
PSW32THREADCALLOUTTYPE Type)
{
- UNIMPLEMENTED;
+ struct _EPROCESS *Process;
+ PTHREADINFO Win32Thread;
+
+ DPRINT("Enter Win32kThreadCallback\n");
+
+ Process = Thread->ThreadsProcess;
+
+ /* Get the Win32 Thread */
+ Win32Thread = PsGetThreadWin32Thread(Thread);
+
+ /* Allocate one if needed */
+ if (!Win32Thread)
+ {
+ /* FIXME - lock the process */
+ Win32Thread = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(THREADINFO),
+ TAG('W', '3', '2',
't'));
+
+ if (!Win32Thread)
+ return STATUS_NO_MEMORY;
+
+ RtlZeroMemory(Win32Thread, sizeof(THREADINFO));
+
+ PsSetThreadWin32Thread(Thread, Win32Thread);
+ /* FIXME - unlock the process */
+ }
+ if (Type == PsW32ThreadCalloutInitialize)
+ {
+ //PTEB pTeb;
+
+ DPRINT("Creating W32 thread TID:%d at IRQ level: %lu\n",
Thread->Cid.UniqueThread, KeGetCurrentIrql());
+
+ Win32Thread->ppi = PsGetCurrentProcessWin32Process();
+ /*pTeb = NtCurrentTeb();
+ if (pTeb)
+ {
+ Win32Thread->pClientInfo = (PCLIENTINFO)pTeb->Win32ClientInfo;
+ Win32Thread->pClientInfo->pClientThreadInfo = NULL;
+ }*/
+ }
+ else
+ {
+ DPRINT("Destroying W32 thread TID:%d at IRQ level: %lu\n",
Thread->Cid.UniqueThread, KeGetCurrentIrql());
+
+ /*if (Win32Thread->ThreadInfo != NULL)
+ {
+ UserHeapFree(Win32Thread->ThreadInfo);
+ Win32Thread->ThreadInfo = NULL;
+ }*/
+
+ PsSetThreadWin32Thread(Thread, NULL);
+ }
+
+ DPRINT("Leave Win32kThreadCallback\n");
+
return STATUS_SUCCESS;
}
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c [iso-8859-1] Sat Jul 18
11:35:40 2009
@@ -28,13 +28,13 @@
IN OUT PVOID *CommitAddress,
IN OUT PSIZE_T CommitSize)
{
- PW32PROCESS W32Process;
+ PPROCESSINFO W32Process;
PW32HEAP_USER_MAPPING Mapping;
PVOID UserBase = NULL;
NTSTATUS Status;
SIZE_T Delta = (SIZE_T)((ULONG_PTR)(*CommitAddress) - (ULONG_PTR)Base);
- W32Process = PsGetCurrentProcessWin32Process();
+ W32Process = (PPROCESSINFO)PsGetCurrentProcessWin32Process();
if (W32Process != NULL)
{
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h [iso-8859-1] Sat Jul
18 11:35:40 2009
@@ -77,7 +77,7 @@
static __inline PVOID
UserHeapAddressToUser(PVOID lpMem)
{
- PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
+ PPROCESSINFO W32Process = (PPROCESSINFO)PsGetCurrentProcessWin32Process();
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
(ULONG_PTR)W32Process->HeapMappings.UserMapping);
}
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] Sat Jul
18 11:35:40 2009
@@ -4,54 +4,15 @@
typedef struct _WIN32HEAP WIN32HEAP, *PWIN32HEAP;
#include <pshpack1.h>
-// FIXME! Move to ntuser.h
-typedef struct _TL
-{
- struct _TL* next;
- PVOID pobj;
- PVOID pfnFree;
-} TL, *PTL;
-
typedef struct _W32THREAD
{
PETHREAD pEThread;
- ULONG RefCount;
- PTL ptlW32;
- PVOID pgdiDcattr;
- PVOID pgdiBrushAttr;
- PVOID pUMPDObjs;
- PVOID pUMPDHeap;
- DWORD dwEngAcquireCount;
- PVOID pSemTable;
- PVOID pUMPDObj;
} W32THREAD, *PW32THREAD;
typedef struct _THREADINFO
{
W32THREAD W32Thread;
- PTL ptl;
PVOID ppi; // FIXME: use PPROCESSINFO
- struct _USER_MESSAGE_QUEUE* MessageQueue;
- struct _KBL* KeyboardLayout;
- PCLIENTTHREADINFO pcti;
- struct _DESKTOP* Desktop;
- //PDESKTOPINFO pDeskInfo;
- //PCLIENTINFO pClientInfo;
- FLONG TIF_flags;
- LONG timeLast;
- HANDLE hDesktop;
- UINT cPaintsReady; /* Count of paints pending. */
- UINT cTimersReady; /* Count of timers pending. */
- ULONG fsHooks;
- LIST_ENTRY PtiLink;
-
- CLIENTTHREADINFO cti; // Used only when no Desktop or pcti NULL.
-
- LIST_ENTRY WindowListHead;
- LIST_ENTRY W32CallbackListHead;
- BOOLEAN IsExiting;
- SINGLE_LIST_ENTRY ReferencesList;
- PW32THREADINFO ThreadInfo;
} THREADINFO, *PTHREADINFO;
#include <poppack.h>
@@ -65,45 +26,10 @@
ULONG Count;
} W32HEAP_USER_MAPPING, *PW32HEAP_USER_MAPPING;
-typedef struct _W32PROCESS
+typedef struct _PROCESSINFO
{
PEPROCESS peProcess;
- DWORD RefCount;
- ULONG W32PF_flags;
- PKEVENT InputIdleEvent;
- DWORD StartCursorHideTime;
- DWORD NextStart;
- PVOID pDCAttrList;
- PVOID pBrushAttrList;
- DWORD W32Pid;
- LONG GDIHandleCount;
- LONG UserHandleCount;
- DWORD cSimpleLock; /* Locking Process during access to structure. */
- RTL_AVL_TABLE rtlAvlTable; /* Process AVL Table. */
- LIST_ENTRY leDCAttrList;
- LIST_ENTRY leObjAttrList;
-/* ReactOS */
- LIST_ENTRY ClassList;
- LIST_ENTRY MenuListHead;
- FAST_MUTEX PrivateFontListLock;
- LIST_ENTRY PrivateFontListHead;
- FAST_MUTEX DriverObjListLock;
- LIST_ENTRY DriverObjListHead;
- struct _KBL* KeyboardLayout;
W32HEAP_USER_MAPPING HeapMappings;
-} W32PROCESS, *PW32PROCESS;
-
-typedef struct _PROCESSINFO
-{
- W32PROCESS XzyxW32Process; /* Place holder. */
- /* ReactOS */
- HINSTANCE hModUser;
- PWINDOWCLASS LocalClassList;
- PWINDOWCLASS GlobalClassList;
- PWINDOWCLASS SystemClassList;
-
- UINT RegisteredSysClasses : 1;
-
-} PROCESSINFO;
+} PROCESSINFO, *PPROCESSINFO;
#endif /* __INCLUDE_NAPI_WIN32_H */