* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/* $Id$
- *
+/*
* Entry Point for win32k.sys
*/
-#include <w32k.h>
+#include <win32k.h>
#include <include/napi.h>
#define NDEBUG
#include <debug.h>
+HANDLE hModuleWin;
+
PGDI_HANDLE_TABLE INTERNAL_CALL GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject);
BOOL INTERNAL_CALL GDI_CleanupForProcess (struct _EPROCESS *Process);
/* FIXME */
PGDI_HANDLE_TABLE GdiHandleTable = NULL;
PSECTION_OBJECT GdiTableSection = NULL;
-LIST_ENTRY GlobalDriverListHead;
-
HANDLE GlobalUserHeap = NULL;
PSECTION_OBJECT GlobalUserHeapSection = NULL;
Win32kProcessCallback(struct _EPROCESS *Process,
BOOLEAN Create)
{
- PW32PROCESS Win32Process;
+ PPROCESSINFO Win32Process;
DECLARE_RETURN(NTSTATUS);
DPRINT("Enter Win32kProcessCallback\n");
/* FIXME - lock the process */
Win32Process = ExAllocatePoolWithTag(NonPagedPool,
sizeof(PROCESSINFO),
- TAG('W', '3', '2', 'p'));
+ 'p23W');
if (Win32Process == NULL) RETURN( STATUS_NO_MEMORY);
InitializeListHead(&Win32Process->MenuListHead);
+ InitializeListHead(&Win32Process->GDIBrushAttrFreeList);
+ InitializeListHead(&Win32Process->GDIDcAttrFreeList);
+
InitializeListHead(&Win32Process->PrivateFontListHead);
ExInitializeFastMutex(&Win32Process->PrivateFontListLock);
Process->Peb->GdiDCAttributeList = GDI_BATCH_LIMIT;
}
+ Win32Process->peProcess = Process;
/* setup process flags */
Win32Process->W32PF_flags = 0;
}
{
struct _EPROCESS *Process;
PTHREADINFO Win32Thread;
+ int i;
DECLARE_RETURN(NTSTATUS);
DPRINT("Enter Win32kThreadCallback\n");
/* FIXME - lock the process */
Win32Thread = ExAllocatePoolWithTag(NonPagedPool,
sizeof(THREADINFO),
- TAG('W', '3', '2', 't'));
+ 't23W');
if (Win32Thread == NULL) RETURN( STATUS_NO_MEMORY);
InitializeListHead(&Win32Thread->WindowListHead);
InitializeListHead(&Win32Thread->W32CallbackListHead);
InitializeListHead(&Win32Thread->PtiLink);
+ for (i = 0; i < NB_HOOKS; i++)
+ {
+ InitializeListHead(&Win32Thread->aphkStart[i]);
+ }
/*
* inherit the thread desktop and process window station (if not yet inherited) from the process startup
if (hDesk != NULL)
{
PDESKTOP DesktopObject;
- Win32Thread->Desktop = NULL;
+ Win32Thread->rpdesk = NULL;
Status = ObReferenceObjectByHandle(hDesk,
0,
ExDesktopObjectType,
}
}
}
- Win32Thread->IsExiting = FALSE;
+ Win32Thread->TIF_flags &= ~TIF_INCLEANUP;
co_IntDestroyCaret(Win32Thread);
Win32Thread->ppi = PsGetCurrentProcessWin32Process();
pTeb = NtCurrentTeb();
}
Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread);
Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout();
+ Win32Thread->pEThread = Thread;
}
else
{
DPRINT("Destroying W32 thread TID:%d at IRQ level: %lu\n", Thread->Cid.UniqueThread, KeGetCurrentIrql());
- Win32Thread->IsExiting = TRUE;
+ Win32Thread->TIF_flags |= TIF_INCLEANUP;
+ DceFreeThreadDCE(Win32Thread);
HOOK_DestroyThreadHooks(Thread);
+ EVENT_DestroyThreadEvents(Thread);
+ /* Cleanup timers */
+ DestroyTimersForThread(Win32Thread);
+ KeSetEvent(Win32Thread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
UnregisterThreadHotKeys(Thread);
/* what if this co_ func crash in umode? what will clean us up then? */
co_DestroyThreadWindows(Thread);
IntSetThreadDesktop(NULL,
TRUE);
- if (Win32Thread->ThreadInfo != NULL)
- {
- UserHeapFree(Win32Thread->ThreadInfo);
- Win32Thread->ThreadInfo = NULL;
- }
-
PsSetThreadWin32Thread(Thread, NULL);
}
if (Process->Win32Process == NULL)
{
/* FIXME - lock the process */
- Process->Win32Process = ExAllocatePool(NonPagedPool, sizeof(PROCESSINFO));
+ Process->Win32Process = ExAllocatePoolWithTag(NonPagedPool, sizeof(PROCESSINFO), USERTAG_PROCESSINFO);
if (Process->Win32Process == NULL)
return STATUS_NO_MEMORY;
if (Thread->Tcb.Win32Thread == NULL)
{
- Thread->Tcb.Win32Thread = ExAllocatePool (NonPagedPool, sizeof(THREADINFO));
+ Thread->Tcb.Win32Thread = ExAllocatePoolWithTag(NonPagedPool, sizeof(THREADINFO), USERTAG_THREADINFO);
if (Thread->Tcb.Win32Thread == NULL)
return STATUS_NO_MEMORY;
return(STATUS_SUCCESS);
}
+C_ASSERT(sizeof(SERVERINFO) <= PAGE_SIZE);
/*
* This definition doesn't work
return STATUS_UNSUCCESSFUL;
}
+ hModuleWin = MmPageEntireDriver(DriverEntry);
+ DPRINT("Win32k hInstance 0x%x!\n",hModuleWin);
/*
* Register Object Manager Callbacks
*/
return STATUS_UNSUCCESSFUL;
}
- /* Initialize a list of loaded drivers in Win32 subsystem */
- InitializeListHead(&GlobalDriverListHead);
+ if (!gpsi)
+ {
+ gpsi = UserHeapAlloc(sizeof(SERVERINFO));
+ if (gpsi)
+ {
+ RtlZeroMemory(gpsi, sizeof(SERVERINFO));
+ DPRINT("Global Server Data -> %x\n", gpsi);
+ }
+ else
+ {
+ ASSERT(FALSE);
+ }
+ }
if(!hsemDriverMgmt) hsemDriverMgmt = EngCreateSemaphore();
return STATUS_UNSUCCESSFUL;
}
+ /* Initialize default palettes */
+ PALETTE_Init();
+
+ /* Create stock objects, ie. precreated objects commonly
+ used by win32 applications */
+ CreateStockObjects();
+ CreateSysColorObjects();
+
+ InitXlateImpl();
+ InitPDEVImpl();
+ InitLDEVImpl();
+ InitDeviceImpl();
+
+ Status = InitDcImpl();
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to initialize Device context implementation!\n");
+ return STATUS_UNSUCCESSFUL;
+ }
+
Status = InitUserImpl();
if (!NT_SUCCESS(Status))
{
return(Status);
}
- Status = InitDcImpl();
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to initialize Device context implementation!\n");
- return STATUS_UNSUCCESSFUL;
- }
-
/* Initialize FreeType library */
if (! InitFontSupport())
{
return STATUS_UNSUCCESSFUL;
}
- /* Create stock objects, ie. precreated objects commonly
- used by win32 applications */
- CreateStockObjects();
- CreateSysColorObjects();
-
gusLanguageID = IntGdiGetLanguageID();
return STATUS_SUCCESS;