Author: fireball
Date: Sat Jul 18 11:34:22 2009
New Revision: 42030

URL: http://svn.reactos.org/svn/reactos?rev=42030&view=rev
Log:
- Add basic Win32k infrastructure: W32PROCESS and W32THREAD, global user heap.

Added:
    branches/arwinss/reactos/subsystems/win32/win32k/gre/err.c   (with props)
    branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c   (with 
props)
    branches/arwinss/reactos/subsystems/win32/win32k/include/error.h   (with 
props)
    branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h   (with 
props)
    branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h   (with 
props)
    branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h   (with 
props)
    branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c   (with 
props)
Modified:
    branches/arwinss/reactos/subsystems/win32/win32k/gre/init.c
    branches/arwinss/reactos/subsystems/win32/win32k/include/win32k.h
    branches/arwinss/reactos/subsystems/win32/win32k/include/win32kp.h
    branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild

Added: branches/arwinss/reactos/subsystems/win32/win32k/gre/err.c
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/gre/err.c?rev=42030&view=auto
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/err.c (added)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/err.c [iso-8859-1] Sat 
Jul 18 11:34:22 2009
@@ -1,0 +1,82 @@
+/*
+ *  ReactOS W32 Subsystem
+ *  Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  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.
+ */
+/* $Id: err.c 37752 2008-11-29 22:48:58Z sginsberg $
+ *
+ * COPYRIGHT:        See COPYING in the top level directory
+ * PROJECT:          ReactOS kernel
+ * PURPOSE:          Errors
+ * FILE:             subsys/win32k/misc/error.c
+ * PROGRAMER:        Casper S. Hornstrup ([email protected])
+ * REVISION HISTORY:
+ *       06-06-2001  CSH  Created
+ */
+
+#include <win32k.h>
+
+#define NDEBUG
+#include <debug.h>
+
+VOID FASTCALL
+SetLastNtError(NTSTATUS Status)
+{
+  SetLastWin32Error(RtlNtStatusToDosError(Status));
+}
+
+VOID FASTCALL
+SetLastWin32Error(DWORD Status)
+{
+  PTEB Teb = PsGetCurrentThread()->Tcb.Teb;
+
+  if (NULL != Teb)
+    {
+      Teb->LastErrorValue = Status;
+    }
+}
+
+NTSTATUS FASTCALL
+GetLastNtError()
+{
+  PTEB Teb = PsGetCurrentThread()->Tcb.Teb;
+
+  if ( NULL != Teb )
+    {
+      return Teb->LastStatusValue;
+    }
+  return 0;
+}
+
+VOID
+APIENTRY
+W32kRaiseStatus(NTSTATUS Status)
+{
+    EXCEPTION_RECORD ExceptionRecord;
+
+    /* Create an exception record */
+    ExceptionRecord.ExceptionCode  = Status;
+    ExceptionRecord.ExceptionRecord = NULL;
+    ExceptionRecord.NumberParameters = 0;
+    ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
+
+    RtlRaiseException(&ExceptionRecord);
+
+    /* If we returned, raise a status */
+    W32kRaiseStatus(Status);
+}
+
+/* EOF */

Propchange: branches/arwinss/reactos/subsystems/win32/win32k/gre/err.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/init.c
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/gre/init.c?rev=42030&r1=42029&r2=42030&view=diff
==============================================================================
--- 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:34:22 2009
@@ -13,8 +13,13 @@
 /* System service call table */
 #include <include/napi.h>
 
-#define NDEBUG
+//#define NDEBUG
 #include <debug.h>
+
+/* GLOBALS *******************************************************************/
+
+HANDLE GlobalUserHeap = NULL;
+PSECTION_OBJECT GlobalUserHeapSection = NULL;
 
 /* PRIVATE FUNCTIONS *********************************************************/
 
@@ -23,7 +28,84 @@
 Win32kProcessCallout(PEPROCESS Process,
                      BOOLEAN Create)
 {
-    UNIMPLEMENTED;
+    PW32PROCESS Win32Process;
+
+    DPRINT("Enter Win32kProcessCallback\n");
+
+    /* Get the Win32 Process */
+    Win32Process = PsGetProcessWin32Process(Process);
+
+    /* Allocate one if needed */
+    if (!Win32Process)
+    {
+        /* FIXME - lock the process */
+        Win32Process = ExAllocatePoolWithTag(NonPagedPool,
+            sizeof(PROCESSINFO),
+            TAG('W', '3', '2', 'p'));
+
+        if (!Win32Process)
+            return STATUS_NO_MEMORY;
+
+        RtlZeroMemory(Win32Process, sizeof(PROCESSINFO));
+
+        PsSetProcessWin32Process(Process, Win32Process);
+        /* FIXME - unlock the process */
+    }
+
+    if (Create)
+    {
+        SIZE_T ViewSize = 0;
+        LARGE_INTEGER Offset;
+        PVOID UserBase = NULL;
+        NTSTATUS Status;
+        extern PSECTION_OBJECT GlobalUserHeapSection;
+        DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", 
Process->UniqueProcessId, KeGetCurrentIrql());
+
+        /* map the global heap into the process */
+        Offset.QuadPart = 0;
+        Status = MmMapViewOfSection(GlobalUserHeapSection,
+                                    PsGetCurrentProcess(),
+                                    &UserBase,
+                                    0,
+                                    0,
+                                    &Offset,
+                                    &ViewSize,
+                                    ViewUnmap,
+                                    SEC_NO_CHANGE,
+                                    PAGE_EXECUTE_READ);
+        if (!NT_SUCCESS(Status))
+        {
+            DPRINT1("Failed to map the global heap! 0x%x\n", Status);
+            return Status;
+        }
+        Win32Process->HeapMappings.Next = NULL;
+        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
+    {
+        DPRINT("Destroying W32 process PID:%d at IRQ level: %lu\n", 
Process->UniqueProcessId, KeGetCurrentIrql());
+    }
+
+    DPRINT("Leave Win32kProcessCallback\n");
     return STATUS_SUCCESS;
 }
 
@@ -164,6 +246,7 @@
             PUNICODE_STRING RegistryPath)
 {
     WIN32_CALLOUTS_FPNS CalloutData;
+    PVOID GlobalUserHeapBase = NULL;
 
     DPRINT1("Win32k initialization: DO %p, RegPath %wZ\n", DriverObject,
         RegistryPath);
@@ -201,5 +284,15 @@
     /* Register them */
     PsEstablishWin32Callouts(&CalloutData);
 
-    return STATUS_SUCCESS;
-}
+    /* Create global heap */
+    GlobalUserHeap = UserCreateHeap(&GlobalUserHeapSection,
+                                    &GlobalUserHeapBase,
+                                    1 * 1024 * 1024); /* FIXME - 1 MB for 
now... */
+    if (GlobalUserHeap == NULL)
+    {
+        DPRINT1("Failed to initialize the global heap!\n");
+        return STATUS_UNSUCCESSFUL;
+    }
+
+    return STATUS_SUCCESS;
+}

Added: branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c?rev=42030&view=auto
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c (added)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c [iso-8859-1] 
Sat Jul 18 11:34:22 2009
@@ -1,0 +1,216 @@
+/*
+ *  ReactOS W32 Subsystem
+ *  Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  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.
+ */
+
+#include <win32k.h>
+
+#define NDEBUG
+#include <debug.h>
+
+
+static NTSTATUS APIENTRY
+IntUserHeapCommitRoutine(IN PVOID Base,
+                         IN OUT PVOID *CommitAddress,
+                         IN OUT PSIZE_T CommitSize)
+{
+    PW32PROCESS W32Process;
+    PW32HEAP_USER_MAPPING Mapping;
+    PVOID UserBase = NULL;
+    NTSTATUS Status;
+    SIZE_T Delta = (SIZE_T)((ULONG_PTR)(*CommitAddress) - (ULONG_PTR)Base);
+
+    W32Process = PsGetCurrentProcessWin32Process();
+
+    if (W32Process != NULL)
+    {
+        /* search for the mapping */
+        Mapping = &W32Process->HeapMappings;
+        while (Mapping != NULL)
+        {
+            if (Mapping->KernelMapping == Base)
+            {
+                UserBase = Mapping->UserMapping;
+                break;
+            }
+
+            Mapping = Mapping->Next;
+        }
+
+        ASSERT(UserBase != NULL);
+    }
+    else
+    {
+        SIZE_T ViewSize = 0;
+        LARGE_INTEGER Offset;
+        extern PSECTION_OBJECT GlobalUserHeapSection;
+
+        /* HACK: This needs to be handled during startup only... */
+        ASSERT(Base == (PVOID)GlobalUserHeap);
+
+        /* temporarily map it into user space */
+        Offset.QuadPart = 0;
+        Status = MmMapViewOfSection(GlobalUserHeapSection,
+                                    PsGetCurrentProcess(),
+                                    &UserBase,
+                                    0,
+                                    0,
+                                    &Offset,
+                                    &ViewSize,
+                                    ViewUnmap,
+                                    SEC_NO_CHANGE,
+                                    PAGE_EXECUTE_READ); /* would prefer 
PAGE_READONLY, but thanks to RTL heaps... */
+
+        if (!NT_SUCCESS(Status))
+            return Status;
+    }
+
+    /* commit! */
+    UserBase = (PVOID)((ULONG_PTR)UserBase + Delta);
+
+    Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
+                                     &UserBase,
+                                     0,
+                                     CommitSize,
+                                     MEM_COMMIT,
+                                     PAGE_EXECUTE_READ);
+    if (NT_SUCCESS(Status))
+    {
+        *CommitAddress = (PVOID)((ULONG_PTR)UserBase + Delta);
+    }
+
+    if (W32Process == NULL)
+    {
+        MmUnmapViewOfSection(PsGetCurrentProcess(),
+                             UserBase);
+    }
+
+    return Status;
+}
+
+static PWIN32HEAP
+IntUserHeapCreate(IN PSECTION_OBJECT SectionObject,
+                  IN PVOID *SystemMappedBase,
+                  IN ULONG HeapSize)
+{
+    PVOID MappedView = NULL;
+    LARGE_INTEGER Offset;
+    SIZE_T ViewSize = PAGE_SIZE;
+    RTL_HEAP_PARAMETERS Parameters = {0};
+    PVOID pHeap;
+    NTSTATUS Status;
+
+    Offset.QuadPart = 0;
+
+    /* Commit the first page before creating the heap! */
+    Status = MmMapViewOfSection(SectionObject,
+                                PsGetCurrentProcess(),
+                                &MappedView,
+                                0,
+                                0,
+                                &Offset,
+                                &ViewSize,
+                                ViewUnmap,
+                                SEC_NO_CHANGE,
+                                PAGE_EXECUTE_READ); /* would prefer 
PAGE_READONLY, but thanks to RTL heaps... */
+    if (!NT_SUCCESS(Status))
+        return NULL;
+
+    Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
+                                     &MappedView,
+                                     0,
+                                     &ViewSize,
+                                     MEM_COMMIT,
+                                     PAGE_EXECUTE_READ); /* would prefer 
PAGE_READONLY, but thanks to RTL heaps... */
+
+    MmUnmapViewOfSection(PsGetCurrentProcess(),
+                         MappedView);
+
+    if (!NT_SUCCESS(Status))
+        return NULL;
+
+    /* Create the heap, don't serialize in kmode! The caller is responsible
+       to synchronize the heap! */
+    Parameters.Length = sizeof(Parameters);
+    Parameters.InitialCommit = ViewSize;
+    Parameters.InitialReserve = (SIZE_T)HeapSize;
+    Parameters.CommitRoutine = IntUserHeapCommitRoutine;
+
+    pHeap = RtlCreateHeap(HEAP_ZERO_MEMORY | HEAP_NO_SERIALIZE,
+                          *SystemMappedBase,
+                          (SIZE_T)HeapSize,
+                          ViewSize,
+                          NULL,
+                          &Parameters);
+
+    return pHeap;
+}
+
+PWIN32HEAP
+UserCreateHeap(OUT PSECTION_OBJECT *SectionObject,
+               IN OUT PVOID *SystemBase,
+               IN SIZE_T HeapSize)
+{
+    LARGE_INTEGER SizeHeap;
+    PWIN32HEAP pHeap = NULL;
+    NTSTATUS Status;
+
+    SizeHeap.QuadPart = HeapSize;
+
+    /* create the section and map it into session space */
+    Status = MmCreateSection((PVOID*)SectionObject,
+                             SECTION_ALL_ACCESS,
+                             NULL,
+                             &SizeHeap,
+                             PAGE_EXECUTE_READWRITE, /* would prefer 
PAGE_READWRITE, but thanks to RTL heaps... */
+                             SEC_RESERVE,
+                             NULL,
+                             NULL);
+
+    if (!NT_SUCCESS(Status))
+    {
+        SetLastNtError(Status);
+        return FALSE;
+    }
+
+    Status = MmMapViewInSystemSpace(*SectionObject,
+                                    SystemBase,
+                                    &HeapSize);
+    if (!NT_SUCCESS(Status))
+    {
+        ObDereferenceObject(*SectionObject);
+        *SectionObject = NULL;
+
+        SetLastNtError(Status);
+        return FALSE;
+    }
+
+    /* create the heap */
+    pHeap = IntUserHeapCreate(*SectionObject,
+                              SystemBase,
+                              HeapSize);
+
+    if (pHeap == NULL)
+    {
+        ObDereferenceObject(*SectionObject);
+        *SectionObject = NULL;
+
+        SetLastNtError(STATUS_UNSUCCESSFUL);
+    }
+
+    return pHeap;
+}

Propchange: branches/arwinss/reactos/subsystems/win32/win32k/gre/usrheap.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: branches/arwinss/reactos/subsystems/win32/win32k/include/error.h
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/include/error.h?rev=42030&view=auto
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/error.h (added)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/error.h 
[iso-8859-1] Sat Jul 18 11:34:22 2009
@@ -1,0 +1,17 @@
+#ifndef _WIN32K_ERROR_H
+#define _WIN32K_ERROR_H
+
+VOID FASTCALL
+SetLastNtError(
+  NTSTATUS Status);
+
+VOID FASTCALL
+SetLastWin32Error(
+  DWORD Status);
+
+NTSTATUS FASTCALL
+GetLastNtError();
+
+#endif /* _WIN32K_ERROR_H */
+
+/* EOF */

Propchange: branches/arwinss/reactos/subsystems/win32/win32k/include/error.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h?rev=42030&view=auto
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h (added)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h 
[iso-8859-1] Sat Jul 18 11:34:22 2009
@@ -1,0 +1,85 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Win32K
+ * FILE:            subsystems/win32/win32k/include/heap.h
+ * PURPOSE:         Global user heap
+ * PROGRAMMER:      Aleksey Bragin <[email protected]>
+ */
+
+#ifndef _INCLUDE_GLOBAL_HEAP_H
+#define _INCLUDE_GLOBAL_HEAP_H
+
+extern HANDLE GlobalUserHeap;
+
+PWIN32HEAP
+UserCreateHeap(OUT PSECTION_OBJECT *SectionObject,
+               IN OUT PVOID *SystemBase,
+               IN SIZE_T HeapSize);
+
+static __inline PVOID
+UserHeapAlloc(SIZE_T Bytes)
+{
+    return RtlAllocateHeap(GlobalUserHeap,
+                           HEAP_NO_SERIALIZE,
+                           Bytes);
+}
+
+static __inline BOOL
+UserHeapFree(PVOID lpMem)
+{
+    return RtlFreeHeap(GlobalUserHeap,
+                       HEAP_NO_SERIALIZE,
+                       lpMem);
+}
+
+static __inline PVOID
+UserHeapReAlloc(PVOID lpMem,
+                SIZE_T Bytes)
+{
+#if 0
+    /* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
+    return RtlReAllocateHeap(GlobalUserHeap,
+                             HEAP_NO_SERIALIZE,
+                             lpMem,
+                             Bytes);
+#else
+    SIZE_T PrevSize;
+    PVOID pNew;
+
+    PrevSize = RtlSizeHeap(GlobalUserHeap,
+                           HEAP_NO_SERIALIZE,
+                           lpMem);
+
+    if (PrevSize == Bytes)
+        return lpMem;
+
+    pNew = RtlAllocateHeap(GlobalUserHeap,
+                           HEAP_NO_SERIALIZE,
+                           Bytes);
+    if (pNew != NULL)
+    {
+        if (PrevSize < Bytes)
+            Bytes = PrevSize;
+
+        RtlCopyMemory(pNew,
+                      lpMem,
+                      Bytes);
+
+        RtlFreeHeap(GlobalUserHeap,
+                    HEAP_NO_SERIALIZE,
+                    lpMem);
+    }
+
+    return pNew;
+#endif
+}
+
+static __inline PVOID
+UserHeapAddressToUser(PVOID lpMem)
+{
+    PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
+    return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
+                   (ULONG_PTR)W32Process->HeapMappings.UserMapping);
+}
+
+#endif

Propchange: branches/arwinss/reactos/subsystems/win32/win32k/include/heap.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h?rev=42030&view=auto
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h (added)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h 
[iso-8859-1] Sat Jul 18 11:34:22 2009
@@ -1,0 +1,109 @@
+#ifndef __INCLUDE_NAPI_WIN32_H
+#define __INCLUDE_NAPI_WIN32_H
+
+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>
+
+typedef struct _W32HEAP_USER_MAPPING
+{
+    struct _W32HEAP_USER_MAPPING *Next;
+    PVOID KernelMapping;
+    PVOID UserMapping;
+    ULONG_PTR Limit;
+    ULONG Count;
+} W32HEAP_USER_MAPPING, *PW32HEAP_USER_MAPPING;
+
+typedef struct _W32PROCESS
+{
+  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;
+
+#endif /* __INCLUDE_NAPI_WIN32_H */

Propchange: branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/win32k.h
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/include/win32k.h?rev=42030&r1=42029&r2=42030&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/win32k.h 
[iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/win32k.h 
[iso-8859-1] Sat Jul 18 11:34:22 2009
@@ -11,9 +11,9 @@
 /* Version Data */
 #undef __MSVCRT__
 #include <psdk/ntverp.h>
-//#define _WIN32_WINNT _WIN32_WINNT_WS03
+#define _WIN32_WINNT _WIN32_WINNT_WS03
 #define NTDDI_VERSION NTDDI_WS03SP1
-//#define WINVER 0x600
+#define WINVER 0x600
 
 /* Initial DDK/IFS Headers */
 #ifdef _MSC_VER
@@ -54,21 +54,21 @@
 #include <ntndk.h>
 
 /* SEH Support with PSEH */
-#include <pseh/pseh2.h>
+#include <pseh/pseh.h>
 
 /* CSRSS Header */
 #include <csrss/csrss.h>
 
 /* Helper Header */
-//#include <reactos/helper.h>
+#include <reactos/helper.h>
 
 /* Probe and capture */
-//#include <reactos/probe.h>
+#include <reactos/probe.h>
 
 /* Public Win32K Headers */
 #include <win32k/callback.h>
 #include <win32k/ntusrtyp.h>
-//#include <win32k/ntuser.h>
+#include <win32k/ntuser.h>
 #include <win32k/ntgdityp.h>
 #include <win32k/ntgdihdl.h>
 #define LANGPACK

Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/win32kp.h
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/include/win32kp.h?rev=42030&r1=42029&r2=42030&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/win32kp.h 
[iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/win32kp.h 
[iso-8859-1] Sat Jul 18 11:34:22 2009
@@ -3,7 +3,7 @@
  * PROJECT:         ReactOS Win32K
  * FILE:            subsystems/win32/win32k/include/win32kp.h
  * PURPOSE:         Internal Win32K Header
- * PROGRAMMER:      Stefan Ginsberg ([email protected])
+ * PROGRAMMER:      Aleksey Bragin <[email protected]>
  */
 
 #ifndef _INCLUDE_INTERNAL_WIN32K_H
@@ -15,10 +15,12 @@
 W32KAPI UINT APIENTRY wine_server_call(void *req_ptr);
 
 /* Internal  Win32K Headers */
+#include <error.h>
 #include <wine/server_protocol.h>
-//#include <gdiobj.h>
-//#include <engobj.h>
-//#include <userobj.h>
+#include <win32.h>
+#include <heap.h>
+
+#include "winesup.h"
 
 /* client communication functions (from server.h) */
 struct __server_iovec
@@ -41,5 +43,4 @@
     struct __server_iovec data[__SERVER_MAX_DATA];  /* request variable size 
data */
 };
 
-
 #endif

Added: branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h?rev=42030&view=auto
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h (added)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h 
[iso-8859-1] Sat Jul 18 11:34:22 2009
@@ -1,0 +1,66 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Win32K
+ * FILE:            subsystems/win32/win32k/include/winesup.h
+ * PURPOSE:         Wine supporting functions
+ * PROGRAMMER:      Aleksey Bragin <[email protected]>
+ */
+
+#ifndef _INCLUDE_INTERNAL_WINESUP_H
+#define _INCLUDE_INTERNAL_WINESUP_H
+
+/* INCLUDES ******************************************************************/
+
+#define assert ASSERT
+#define tolowerW(n) towlower((n))
+#define strncmpiW(s1,s2,n) _wcsnicmp((const wchar_t *)(s1),(const wchar_t 
*)(s2),(n))
+
+void set_error( unsigned int err );
+static inline void clear_error(void)             { set_error(0); }
+
+/* gets the discretionary access control list from a security descriptor */
+static inline const ACL *sd_get_dacl( const struct security_descriptor *sd, 
int *present )
+{
+    *present = (sd->control & SE_DACL_PRESENT ? TRUE : FALSE);
+
+    if (sd->dacl_len)
+        return (const ACL *)((const char *)(sd + 1) +
+            sd->owner_len + sd->group_len + sd->sacl_len);
+    else
+        return NULL;
+}
+
+/* gets the system access control list from a security descriptor */
+static inline const ACL *sd_get_sacl( const struct security_descriptor *sd, 
int *present )
+{
+    *present = (sd->control & SE_SACL_PRESENT ? TRUE : FALSE);
+
+    if (sd->sacl_len)
+        return (const ACL *)((const char *)(sd + 1) +
+            sd->owner_len + sd->group_len);
+    else
+        return NULL;
+}
+
+/* gets the owner from a security descriptor */
+static inline const SID *sd_get_owner( const struct security_descriptor *sd )
+{
+    if (sd->owner_len)
+        return (const SID *)(sd + 1);
+    else
+        return NULL;
+}
+
+/* gets the primary group from a security descriptor */
+static inline const SID *sd_get_group( const struct security_descriptor *sd )
+{
+    if (sd->group_len)
+        return (const SID *)((const char *)(sd + 1) + sd->owner_len);
+    else
+        return NULL;
+}
+
+int dump_strW( const WCHAR *str, data_size_t len, FILE *f, const char 
escape[2] );
+const SID *token_get_user( void *token );
+
+#endif

Propchange: branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild?rev=42030&r1=42029&r2=42030&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] 
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] 
Sat Jul 18 11:34:22 2009
@@ -17,11 +17,16 @@
                <pch>win32k.h</pch>
        </directory>
        <directory name="gre">
+               <file>err.c</file>
                <file>init.c</file>
+               <file>usrheap.c</file>
        </directory>
        <directory name="wine">
+               <file>class.c</file>
                <file>main.c</file>
+               <file>object.c</file>
                <file>stubs.c</file>
+               <file>winesup.c</file>
        </directory>
        <file>win32k.rc</file>
 </module>

Added: branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c?rev=42030&view=auto
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c (added)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c 
[iso-8859-1] Sat Jul 18 11:34:22 2009
@@ -1,0 +1,27 @@
+/*
+ * PROJECT:         ReactOS Win32K
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * FILE:            subsystems/win32/win32k/wine/winesup.c
+ * PURPOSE:         Wine supporting functions
+ * PROGRAMMERS:     Aleksey Bragin ([email protected])
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <win32k.h>
+
+#define NDEBUG
+#include <debug.h>
+
+/* PRIVATE FUNCTIONS *********************************************************/
+
+void set_error( unsigned int err )
+{
+}
+
+const SID *token_get_user( void *token )
+{
+    return NULL;
+}
+
+/* EOF */

Propchange: branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c
------------------------------------------------------------------------------
    svn:eol-style = native

Reply via email to