move object.c and ssec.c into ntuser where they belong
Modified: trunk/reactos/subsys/win32k/include/userfuncs.h
Deleted: trunk/reactos/subsys/win32k/misc/object.c
Deleted: trunk/reactos/subsys/win32k/misc/ssec.c
Added: trunk/reactos/subsys/win32k/ntuser/object.c
Added: trunk/reactos/subsys/win32k/ntuser/ssec.c
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
Modified: trunk/reactos/subsys/win32k/win32k.xml
_____
Modified: trunk/reactos/subsys/win32k/include/userfuncs.h
--- trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-06
07:58:43 UTC (rev 17692)
+++ trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-06
09:35:39 UTC (rev 17693)
@@ -74,6 +74,8 @@
/*************** WINDOW.C ***************/
+PWINDOW_OBJECT FASTCALL UserGetWindowObjectNoRef(HWND hWnd);
+
VOID FASTCALL
co_DestroyThreadWindows(struct _ETHREAD *Thread);
_____
Deleted: trunk/reactos/subsys/win32k/misc/object.c
--- trunk/reactos/subsys/win32k/misc/object.c 2005-09-06 07:58:43 UTC
(rev 17692)
+++ trunk/reactos/subsys/win32k/misc/object.c 2005-09-06 09:35:39 UTC
(rev 17693)
@@ -1,507 +0,0 @@
-/*
- * 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$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * PURPOSE: User object manager
- * FILE: subsys/win32k/misc/object.c
- * PROGRAMMERS: David Welch (welch(a)cwcom.net)
- * Casper S. Hornstrup (chorns(a)users.sourceforge.net)
- * UPDATE HISTORY:
- * 06-06-2001 CSH Ported kernel object manager
- */
-/* INCLUDES
******************************************************************/
-
-#include <w32k.h>
-
-#define NDEBUG
-#include <debug.h>
-
-#define USER_HEADER_TO_BODY(ObjectHeader) \
- ((PVOID)(((PUSER_OBJECT_HEADER)ObjectHeader) + 1))
-
-#define USER_BODY_TO_HEADER(ObjectBody) \
- ((PUSER_OBJECT_HEADER)(((PUSER_OBJECT_HEADER)ObjectBody) - 1))
-
-/* FUNCTIONS
*****************************************************************/
-
-VOID FASTCALL
-ObmpPerformRetentionChecks(PUSER_OBJECT_HEADER ObjectHeader)
-{
- if (ObjectHeader->RefCount < 0)
- {
- DPRINT1("ObjectHeader 0x%X has invalid reference count (%d)\n",
- ObjectHeader, ObjectHeader->RefCount);
- }
-
- if (ObjectHeader->HandleCount < 0)
- {
- DPRINT1("Object 0x%X has invalid handle count (%d)\n",
- ObjectHeader, ObjectHeader->HandleCount);
- }
-
- if ((ObjectHeader->RefCount == 0) && (ObjectHeader->HandleCount ==
0))
- {
- ExFreePool(ObjectHeader);
- }
-}
-
-PUSER_HANDLE FASTCALL
-ObmpGetObjectByHandle(PUSER_HANDLE_TABLE HandleTable,
- HANDLE Handle)
-/*
- * FUNCTION: Get the data structure for a handle
- * ARGUMENTS:
- * HandleTable = Table to search
- * Handle = Handle to get data structure for
- * RETURNS:
- * Pointer to the data structure identified by the handle on success,
- * NULL on failure
- */
-{
- ULONG Index = (((ULONG)Handle) >> 2) - 1;
- ULONG Count = Index / HANDLE_BLOCK_ENTRIES;
- PUSER_HANDLE_BLOCK Block = NULL;
- PLIST_ENTRY Current;
- ULONG i;
-
- if (NULL == Handle)
- {
- return NULL;
- }
-
- Current = HandleTable->ListHead.Flink;
-
- for (i = 0; i < Count; i++)
- {
- Current = Current->Flink;
- if (Current == &(HandleTable->ListHead))
- {
- DPRINT1("Invalid handle 0x%x\n", Handle);
- return NULL;
- }
- }
-
- Block = CONTAINING_RECORD(Current, USER_HANDLE_BLOCK, ListEntry);
- return &(Block->Handles[Index % HANDLE_BLOCK_ENTRIES]);
-}
-
-VOID FASTCALL
-ObmpCloseAllHandles(PUSER_HANDLE_TABLE HandleTable)
-{
- PLIST_ENTRY CurrentEntry;
- PUSER_HANDLE_BLOCK Current;
- PVOID ObjectBody;
- ULONG i;
-
- CurrentEntry = HandleTable->ListHead.Flink;
-
- while (CurrentEntry != &HandleTable->ListHead)
- {
- Current = CONTAINING_RECORD(CurrentEntry, USER_HANDLE_BLOCK,
ListEntry);
-
- for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
- {
- ObjectBody = Current->Handles[i].ObjectBody;
-
- if (ObjectBody != NULL)
- {
- PUSER_OBJECT_HEADER ObjectHeader =
USER_BODY_TO_HEADER(ObjectBody);
-
- ObmReferenceObjectByPointer(ObjectBody, otUnknown);
- ObjectHeader->HandleCount--;
- Current->Handles[i].ObjectBody = NULL;
-
- ObmDereferenceObject(ObjectBody);
-
- CurrentEntry = &HandleTable->ListHead;
- break;
- }
- }
-
- CurrentEntry = CurrentEntry->Flink;
- }
-
-}
-
-VOID FASTCALL
-ObmpDeleteHandleTable(PUSER_HANDLE_TABLE HandleTable)
-{
- PUSER_HANDLE_BLOCK Current;
- PLIST_ENTRY CurrentEntry;
-
- ObmpCloseAllHandles(HandleTable);
-
- CurrentEntry = RemoveHeadList(&HandleTable->ListHead);
-
- while (CurrentEntry != &HandleTable->ListHead)
- {
- Current = CONTAINING_RECORD(CurrentEntry,
- USER_HANDLE_BLOCK,
- ListEntry);
-
- ExFreePool(Current);
-
- CurrentEntry = RemoveHeadList(&HandleTable->ListHead);
- }
-}
-
-PVOID FASTCALL
-ObmpDeleteHandle(PUSER_HANDLE_TABLE HandleTable,
- HANDLE Handle)
-{
- PUSER_OBJECT_HEADER ObjectHeader;
- PUSER_HANDLE Entry;
- PVOID ObjectBody;
-
- Entry = ObmpGetObjectByHandle(HandleTable, Handle);
- if (Entry == NULL)
- {
- DPRINT1("Invalid handle\n");
- return NULL;
- }
-
- ObjectBody = Entry->ObjectBody;
-
- if (ObjectBody != NULL)
- {
- ObjectHeader = USER_BODY_TO_HEADER(ObjectBody);
- ObjectHeader->HandleCount--;
- ObmReferenceObjectByPointer(ObjectBody, otUnknown);
- Entry->ObjectBody = NULL;
- }
-
- return ObjectBody;
-}
-
-NTSTATUS FASTCALL
-ObmpInitializeObject(PUSER_HANDLE_TABLE HandleTable,
- PUSER_OBJECT_HEADER ObjectHeader,
- PHANDLE Handle,
- USER_OBJECT_TYPE ObjectType,
- ULONG ObjectSize)
-{
- DWORD Status = STATUS_SUCCESS;
-
- ObjectHeader->Type = ObjectType;
- ObjectHeader->HandleCount = 0;
- ObjectHeader->RefCount = 1;
- ObjectHeader->Size = ObjectSize;
-
- if (Handle != NULL)
- {
- Status = ObmCreateHandle(HandleTable,
- USER_HEADER_TO_BODY(ObjectHeader),
- Handle);
- }
-
- return Status;
-}
-
-
-ULONG FASTCALL
-ObmGetReferenceCount(PVOID ObjectBody)
-{
- PUSER_OBJECT_HEADER ObjectHeader = USER_BODY_TO_HEADER(ObjectBody);
-
- return ObjectHeader->RefCount;
-}
-
-ULONG FASTCALL
-ObmGetHandleCount(PVOID ObjectBody)
-{
- PUSER_OBJECT_HEADER ObjectHeader = USER_BODY_TO_HEADER(ObjectBody);
-
- return ObjectHeader->HandleCount;
-}
-
-VOID FASTCALL
-ObmReferenceObject(PVOID ObjectBody)
-/*
- * FUNCTION: Increments a given object's reference count and performs
- * retention checks
- * ARGUMENTS:
- * ObjectBody = Body of the object
- */
-{
- PUSER_OBJECT_HEADER ObjectHeader;
-
- if (!ObjectBody)
- {
- DPRINT1("Cannot Reference NULL!\n");
- return;
- }
-
- ObjectHeader = USER_BODY_TO_HEADER(ObjectBody);
-
- ObjectHeader->RefCount++;
-
- ObmpPerformRetentionChecks(ObjectHeader);
-}
-
-VOID FASTCALL
-ObmDereferenceObject(PVOID ObjectBody)
-/*
- * FUNCTION: Decrements a given object's reference count and performs
- * retention checks
- * ARGUMENTS:
- * ObjectBody = Body of the object
- */
-{
- PUSER_OBJECT_HEADER ObjectHeader;
-
- if (!ObjectBody)
- {
- DPRINT1("Cannot Dereference NULL!\n");
- return;
- }
-
- ObjectHeader = USER_BODY_TO_HEADER(ObjectBody);
-
- ObjectHeader->RefCount--;
- ObmpPerformRetentionChecks(ObjectHeader);
-}
-
-NTSTATUS FASTCALL
-ObmReferenceObjectByPointer(PVOID ObjectBody,
- USER_OBJECT_TYPE ObjectType)
-/*
- * FUNCTION: Increments the pointer reference count for a given object
- * ARGUMENTS:
- * ObjectBody = Object's body
- * ObjectType = Object type
- * RETURNS: Status
- */
-{
- PUSER_OBJECT_HEADER ObjectHeader;
-
- ObjectHeader = USER_BODY_TO_HEADER(ObjectBody);
-
- if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
- {
- return STATUS_INVALID_PARAMETER;
- }
- ObjectHeader->RefCount++;
-
- return STATUS_SUCCESS;
-}
-
-PVOID FASTCALL
-ObmCreateObject(PUSER_HANDLE_TABLE HandleTable,
- PHANDLE Handle,
- USER_OBJECT_TYPE ObjectType,
- ULONG ObjectSize)
-{
- PUSER_OBJECT_HEADER ObjectHeader;
- PVOID ObjectBody;
- DWORD Status;
-
- ObjectHeader = (PUSER_OBJECT_HEADER)ExAllocatePool(PagedPool,
- ObjectSize +
sizeof(USER_OBJECT_HEADER));
- if (!ObjectHeader)
- {
- return NULL;
- }
-
- ObjectBody = USER_HEADER_TO_BODY(ObjectHeader);
-
- RtlZeroMemory(ObjectBody, ObjectSize);
-
- Status = ObmpInitializeObject(HandleTable,
- ObjectHeader,
- Handle,
- ObjectType,
- ObjectSize);
-
- if (!NT_SUCCESS(Status))
- {
- ExFreePool(ObjectHeader);
- return NULL;
- }
-
- return ObjectBody;
-}
-
-NTSTATUS FASTCALL
-ObmCreateHandle(PUSER_HANDLE_TABLE HandleTable,
- PVOID ObjectBody,
- PHANDLE HandleReturn)
-/*
- * FUNCTION: Add a handle referencing an object
- * ARGUMENTS:
- * HandleTable = Table to put handle in
- * ObjectBody = Object body that the handle should refer to
- * RETURNS: The created handle
- */
-{
- PUSER_HANDLE_BLOCK NewBlock;
- PLIST_ENTRY Current;
- ULONG Handle;
- ULONG i;
-
- if (ObjectBody != NULL)
- {
- USER_BODY_TO_HEADER(ObjectBody)->HandleCount++;
- }
-
- Handle = 1;
- Current = HandleTable->ListHead.Flink;
- /*
- * Scan through the currently allocated Handle blocks looking for a
free
- * slot
- */
- while (Current != &(HandleTable->ListHead))
- {
- PUSER_HANDLE_BLOCK Block =
- CONTAINING_RECORD(Current, USER_HANDLE_BLOCK, ListEntry);
-
- for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
- {
- if (!Block->Handles[i].ObjectBody)
- {
- Block->Handles[i].ObjectBody = ObjectBody;
- *HandleReturn = (HANDLE)((Handle + i) << 2);
- return STATUS_SUCCESS;
- }
- }
-
- Handle = Handle + HANDLE_BLOCK_ENTRIES;
- Current = Current->Flink;
- }
-
- /*
- * Add a new Handle block to the end of the list
- */
- NewBlock = (PUSER_HANDLE_BLOCK)ExAllocatePool(PagedPool,
-
sizeof(USER_HANDLE_BLOCK));
- if (!NewBlock)
- {
- DPRINT1("Unable to allocate new handle block\n");
- *HandleReturn = (PHANDLE)NULL;
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- RtlZeroMemory(NewBlock, sizeof(USER_HANDLE_BLOCK));
- NewBlock->Handles[0].ObjectBody = ObjectBody;
- InsertTailList(&HandleTable->ListHead, &NewBlock->ListEntry);
- *HandleReturn = (HANDLE)(Handle << 2);
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS FASTCALL
-ObmReferenceObjectByHandle(PUSER_HANDLE_TABLE HandleTable,
- HANDLE Handle,
- USER_OBJECT_TYPE ObjectType,
- PVOID* Object)
-/*
- * FUNCTION: Increments the reference count for an object and returns a
- * pointer to its body
- * ARGUMENTS:
- * HandleTable = Table to search
- * Handle = Handle for the object
- * ObjectType = Type of object
- * Object (OUT) = Points to the object body on return
- * RETURNS: Status
- */
-{
- PUSER_OBJECT_HEADER ObjectHeader;
- PUSER_HANDLE UserHandle;
- PVOID ObjectBody;
-
- UserHandle = ObmpGetObjectByHandle(HandleTable, Handle);
-
- if ((UserHandle == NULL) || (UserHandle->ObjectBody == NULL))
- {
- return STATUS_UNSUCCESSFUL;
- }
-
- ObjectBody = UserHandle->ObjectBody;
- ObmReferenceObjectByPointer(ObjectBody, ObjectType);
-
- ObjectHeader = USER_BODY_TO_HEADER(ObjectBody);
-
- if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
- {
- DPRINT1("Object type mismatch 0x%x 0x%x\n", ObjectType,
ObjectHeader->Type);
- ObmDereferenceObject(ObjectBody);
- return STATUS_UNSUCCESSFUL;
- }
-
- *Object = ObjectBody;
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS FASTCALL
-ObmCloseHandle(PUSER_HANDLE_TABLE HandleTable,
- HANDLE Handle)
-{
- PVOID ObjectBody;
-
- ObjectBody = ObmpDeleteHandle(HandleTable, Handle);
- if (ObjectBody == NULL)
- {
- return STATUS_UNSUCCESSFUL;
- }
-
- ObmDereferenceObject(ObjectBody);
-
- return STATUS_SUCCESS;
-}
-
-VOID FASTCALL
-ObmInitializeHandleTable(PUSER_HANDLE_TABLE HandleTable)
-{
- InitializeListHead(&HandleTable->ListHead);
-}
-
-VOID FASTCALL
-ObmFreeHandleTable(PUSER_HANDLE_TABLE HandleTable)
-{
- ObmpDeleteHandleTable(HandleTable);
-}
-
-PUSER_HANDLE_TABLE FASTCALL
-ObmCreateHandleTable(VOID)
-{
- PUSER_HANDLE_TABLE HandleTable;
-
- HandleTable = (PUSER_HANDLE_TABLE)ExAllocatePool(PagedPool,
-
sizeof(USER_HANDLE_TABLE));
- if (!HandleTable)
- {
- DPRINT1("Unable to create handle table\n");
- return NULL;
- }
-
- ObmInitializeHandleTable(HandleTable);
-
- return HandleTable;
-}
-
-VOID FASTCALL
-ObmDestroyHandleTable(PUSER_HANDLE_TABLE HandleTable)
-{
- ObmFreeHandleTable(HandleTable);
- ExFreePool(HandleTable);
-}
-
-/* EOF */
_____
Deleted: trunk/reactos/subsys/win32k/misc/ssec.c
--- trunk/reactos/subsys/win32k/misc/ssec.c 2005-09-06 07:58:43 UTC
(rev 17692)
+++ trunk/reactos/subsys/win32k/misc/ssec.c 2005-09-06 09:35:39 UTC
(rev 17693)
@@ -1,421 +0,0 @@
-/*
- * ReactOS W32 Subsystem
- * Copyright (C) 1998 - 2005 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.
- */
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * PURPOSE: shared sections support
- * FILE: subsys/win32k/misc/ssec.c
- * PROGRAMER: Thomas Weidenmueller <w3seek(a)reactos.com>
- */
-
-#include <w32k.h>
-
-#define NDEBUG
-#include <debug.h>
-
-/*
- * FIXME - instead of mapping the memory into system space using
- * MmMapViewInSystemSpace() we should rather use
- * MmMapViewInSessionSpace() to map it into session space!
- */
-
-NTSTATUS INTERNAL_CALL
-IntUserCreateSharedSectionPool(IN ULONG MaximumPoolSize,
- IN PSHARED_SECTION_POOL
*SharedSectionPool)
-{
- PSHARED_SECTION_POOL Pool;
- ULONG PoolStructSize;
-
- ASSERT(SharedSectionPool);
-
- PoolStructSize = ROUND_UP(sizeof(SHARED_SECTION_POOL), PAGE_SIZE);
- Pool = ExAllocatePoolWithTag(NonPagedPool,
- PoolStructSize,
- TAG_SSECTPOOL);
- if(Pool != NULL)
- {
- RtlZeroMemory(Pool, PoolStructSize);
-
- /* initialize the session heap */
- ExInitializeFastMutex(&Pool->Lock);
- Pool->PoolSize = ROUND_UP(MaximumPoolSize, PAGE_SIZE);
- Pool->PoolFree = Pool->PoolSize;
- Pool->SharedSectionCount = 0;
- Pool->SectionsArray.Next = NULL;
- Pool->SectionsArray.nEntries = ((PoolStructSize -
sizeof(SHARED_SECTION_POOL)) /
- sizeof(SHARED_SECTION)) - 1;
-
- ASSERT(Pool->SectionsArray.nEntries > 0);
-
- *SharedSectionPool = Pool;
-
- return STATUS_SUCCESS;
- }
-
- return STATUS_INSUFFICIENT_RESOURCES;
-}
-
-
-VOID INTERNAL_CALL
-IntUserFreeSharedSectionPool(IN PSHARED_SECTION_POOL SharedSectionPool)
-{
- PSHARED_SECTIONS_ARRAY Array, OldArray;
- PSHARED_SECTION SharedSection, LastSharedSection;
-
- ASSERT(SharedSectionPool);
-
- Array = &SharedSectionPool->SectionsArray;
-
- ExAcquireFastMutex(&SharedSectionPool->Lock);
- while(SharedSectionPool->SharedSectionCount > 0 && Array != NULL)
- {
- for(SharedSection = Array->SharedSection, LastSharedSection =
SharedSection + Array->nEntries;
- SharedSection != LastSharedSection &&
SharedSectionPool->SharedSectionCount > 0;
- SharedSection++)
- {
- if(SharedSection->SectionObject != NULL)
- {
- ASSERT(SharedSection->SystemMappedBase);
-
- /* FIXME - use MmUnmapViewInSessionSpace() once implemented! */
- MmUnmapViewInSystemSpace(SharedSection->SystemMappedBase);
- /* dereference the keep-alive reference so the section get's
deleted */
- ObDereferenceObject(SharedSection->SectionObject);
-
- SharedSectionPool->SharedSectionCount--;
- }
- }
-
- OldArray = Array;
- Array = Array->Next;
-
- /* all shared sections in this array were freed, link the following
array to
- the main session heap and free this array */
- SharedSectionPool->SectionsArray.Next = Array;
- ExFreePool(OldArray);
- }
-
- ASSERT(SharedSectionPool->SectionsArray.Next == NULL);
- ASSERT(SharedSectionPool->SharedSectionCount == 0);
-
- ExReleaseFastMutex(&SharedSectionPool->Lock);
-}
-
-
-NTSTATUS INTERNAL_CALL
-IntUserCreateSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool,
- IN OUT PVOID *SystemMappedBase,
- IN OUT ULONG *SharedSectionSize)
-{
- PSHARED_SECTIONS_ARRAY Array, LastArray;
- PSHARED_SECTION FreeSharedSection, SharedSection, LastSharedSection;
- LARGE_INTEGER SectionSize;
- ULONG Size;
- NTSTATUS Status;
-
- ASSERT(SharedSectionPool && SharedSectionSize && (*SharedSectionSize)
0 && SystemMappedBase);
-
- FreeSharedSection = NULL;
-
- Size = ROUND_UP(*SharedSectionSize, PAGE_SIZE);
-
- ExAcquireFastMutex(&SharedSectionPool->Lock);
-
- if(Size > SharedSectionPool->PoolFree)
- {
- ExReleaseFastMutex(&SharedSectionPool->Lock);
- DPRINT1("Shared Section Pool limit (0x%x KB) reached, attempted to
allocate a 0x%x KB shared section!\n",
- SharedSectionPool->PoolSize / 1024, (*SharedSectionSize) /
1024);
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- /* walk the array to find a free entry */
- for(Array = &SharedSectionPool->SectionsArray, LastArray = Array;
- Array != NULL && FreeSharedSection == NULL;
- Array = Array->Next)
- {
- LastArray = Array;
-
- for(SharedSection = Array->SharedSection, LastSharedSection =
SharedSection + Array->nEntries;
- SharedSection != LastSharedSection;
- SharedSection++)
- {
- if(SharedSection->SectionObject == NULL)
- {
- FreeSharedSection = SharedSection;
- break;
- }
- }
-
- if(Array->Next != NULL)
- {
- LastArray = Array;
- }
- }
-
- ASSERT(LastArray);
-
- if(FreeSharedSection == NULL)
- {
- ULONG nNewEntries;
- PSHARED_SECTIONS_ARRAY NewArray;
-
- ASSERT(LastArray->Next == NULL);
-
- /* couldn't find a free entry in the array, extend the array */
-
- nNewEntries = ((PAGE_SIZE - sizeof(SHARED_SECTIONS_ARRAY)) /
sizeof(SHARED_SECTION)) + 1;
- NewArray = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(SHARED_SECTIONS_ARRAY) +
((nNewEntries - 1) *
-
sizeof(SHARED_SECTION)),
- TAG_SSECTPOOL);
- if(NewArray == NULL)
- {
- ExReleaseFastMutex(&SharedSectionPool->Lock);
- DPRINT1("Failed to allocate new array for shared sections!\n");
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- NewArray->nEntries = nNewEntries;
- NewArray->Next = NULL;
- LastArray->Next = NewArray;
-
- Array = NewArray;
- FreeSharedSection = &Array->SharedSection[0];
- }
-
- ASSERT(FreeSharedSection);
-
- /* now allocate a real section */
-
- SectionSize.QuadPart = Size;
- Status = MmCreateSection(&FreeSharedSection->SectionObject,
- SECTION_ALL_ACCESS,
- NULL,
- &SectionSize,
- PAGE_EXECUTE_READWRITE,
- SEC_COMMIT,
- NULL,
- NULL);
- if(NT_SUCCESS(Status))
- {
- Status = MmMapViewInSystemSpace(FreeSharedSection->SectionObject,
-
&FreeSharedSection->SystemMappedBase,
- &FreeSharedSection->ViewSize);
- if(NT_SUCCESS(Status))
- {
- (*SharedSectionSize) -= Size;
- SharedSectionPool->SharedSectionCount++;
-
- *SystemMappedBase = FreeSharedSection->SystemMappedBase;
- *SharedSectionSize = FreeSharedSection->ViewSize;
- }
- else
- {
- ObDereferenceObject(FreeSharedSection->SectionObject);
- FreeSharedSection->SectionObject = NULL;
- DPRINT1("Failed to map the shared section into system space!
Status 0x%x\n", Status);
- }
- }
-
- ExReleaseFastMutex(&SharedSectionPool->Lock);
-
- return Status;
-}
-
-
-NTSTATUS INTERNAL_CALL
-InUserDeleteSharedSection(PSHARED_SECTION_POOL SharedSectionPool,
- PVOID SystemMappedBase)
-{
- PSHARED_SECTIONS_ARRAY Array;
- PSECTION_OBJECT SectionObject;
- PSHARED_SECTION SharedSection, LastSharedSection;
- NTSTATUS Status;
-
- ASSERT(SharedSectionPool && SystemMappedBase);
-
- SectionObject = NULL;
-
- ExAcquireFastMutex(&SharedSectionPool->Lock);
-
- for(Array = &SharedSectionPool->SectionsArray;
- Array != NULL && SectionObject == NULL;
- Array = Array->Next)
- {
- for(SharedSection = Array->SharedSection, LastSharedSection =
SharedSection + Array->nEntries;
- SharedSection != LastSharedSection;
- SharedSection++)
- {
- if(SharedSection->SystemMappedBase == SystemMappedBase)
- {
- SectionObject = SharedSection->SectionObject;
- SharedSection->SectionObject = NULL;
- SharedSection->SystemMappedBase = NULL;
-
- ASSERT(SharedSectionPool->SharedSectionCount > 0);
- SharedSectionPool->SharedSectionCount--;
- break;
- }
- }
- }
-
- ExReleaseFastMutex(&SharedSectionPool->Lock);
-
- if(SectionObject != NULL)
- {
- Status = MmUnmapViewInSystemSpace(SystemMappedBase);
- ObDereferenceObject(SectionObject);
- }
- else
- {
- DPRINT1("Couldn't find and delete a shared section with
SystemMappedBase=0x%x!\n", SystemMappedBase);
- Status = STATUS_UNSUCCESSFUL;
- }
-
- return Status;
-}
-
-
-NTSTATUS INTERNAL_CALL
-IntUserMapSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool,
- IN PEPROCESS Process,
- IN PVOID SystemMappedBase,
- IN PLARGE_INTEGER SectionOffset OPTIONAL,
- IN OUT PVOID *UserMappedBase,
- IN PULONG ViewSize OPTIONAL,
- IN BOOLEAN ReadOnly)
-{
- PSHARED_SECTIONS_ARRAY Array;
- PSECTION_OBJECT SectionObject;
- PSHARED_SECTION SharedSection, LastSharedSection;
- NTSTATUS Status;
-
- ASSERT(SharedSectionPool && Process && SystemMappedBase &&
UserMappedBase);
-
- SectionObject = NULL;
- SharedSection = NULL;
-
- ExAcquireFastMutex(&SharedSectionPool->Lock);
-
- for(Array = &SharedSectionPool->SectionsArray;
- Array != NULL && SectionObject == NULL;
- Array = Array->Next)
- {
- for(SharedSection = Array->SharedSection, LastSharedSection =
SharedSection + Array->nEntries;
- SharedSection != LastSharedSection;
- SharedSection++)
- {
- if(SharedSection->SystemMappedBase == SystemMappedBase)
- {
- SectionObject = SharedSection->SectionObject;
- break;
- }
- }
- }
-
- if(SectionObject != NULL)
- {
- ULONG RealViewSize = (ViewSize ? min(*ViewSize,
SharedSection->ViewSize) : SharedSection->ViewSize);
-
- ObReferenceObjectByPointer(SectionObject,
- (ReadOnly ? SECTION_MAP_READ :
SECTION_MAP_READ | SECTION_MAP_WRITE),
- NULL,
- KernelMode);
-
- Status = MmMapViewOfSection(SectionObject,
- Process,
- UserMappedBase,
- 0,
- 0,
- SectionOffset,
- &RealViewSize,
- ViewUnmap, /* not sure if we should
inherit it... */
- MEM_COMMIT,
- (ReadOnly ? PAGE_READONLY :
PAGE_READWRITE));
- if(!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to map shared section (readonly=%d) into user
memory! Status: 0x%x\n", ReadOnly, Status);
- }
- }
- else
- {
- DPRINT1("Couldn't find and map a shared section with
SystemMappedBase=0x%x!\n", SystemMappedBase);
- Status = STATUS_UNSUCCESSFUL;
- }
-
- ExReleaseFastMutex(&SharedSectionPool->Lock);
-
- return Status;
-}
-
-
-NTSTATUS INTERNAL_CALL
-IntUserUnMapSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool,
- IN PEPROCESS Process,
- IN PVOID SystemMappedBase,
- IN PVOID UserMappedBase)
-{
- PSHARED_SECTIONS_ARRAY Array;
- PSECTION_OBJECT SectionObject;
- PSHARED_SECTION SharedSection, LastSharedSection;
- NTSTATUS Status;
-
- ASSERT(SharedSectionPool && Process && SystemMappedBase &&
UserMappedBase);
-
- SectionObject = NULL;
-
- ExAcquireFastMutex(&SharedSectionPool->Lock);
-
- for(Array = &SharedSectionPool->SectionsArray;
- Array != NULL && SectionObject == NULL;
- Array = Array->Next)
- {
- for(SharedSection = Array->SharedSection, LastSharedSection =
SharedSection + Array->nEntries;
- SharedSection != LastSharedSection;
- SharedSection++)
- {
- if(SharedSection->SystemMappedBase == SystemMappedBase)
- {
- SectionObject = SharedSection->SectionObject;
- break;
- }
- }
- }
-
- ExReleaseFastMutex(&SharedSectionPool->Lock);
-
- if(SectionObject != NULL)
- {
- Status = MmUnmapViewOfSection(Process,
- UserMappedBase);
- ObDereferenceObject(SectionObject);
- if(!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to unmap shared section UserMappedBase=0x%x!
Status: 0x%x\n", UserMappedBase, Status);
- }
- }
- else
- {
- DPRINT1("Couldn't find and unmap a shared section with
SystemMappedBase=0x%x!\n", SystemMappedBase);
- Status = STATUS_UNSUCCESSFUL;
- }
-
- return Status;
-}
_____
Copied: trunk/reactos/subsys/win32k/ntuser/object.c (from rev 17685,
trunk/reactos/subsys/win32k/misc/object.c)
_____
Copied: trunk/reactos/subsys/win32k/ntuser/ssec.c (from rev 17668,
trunk/reactos/subsys/win32k/misc/ssec.c)
_____
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
--- trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-06 07:58:43 UTC
(rev 17692)
+++ trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-06 09:35:39 UTC
(rev 17693)
@@ -75,6 +75,18 @@
/* HELPER FUNCTIONS
***********************************************************/
+
+
+/* temp hack */
+PWINDOW_OBJECT FASTCALL UserGetWindowObjectNoRef(HWND hWnd)
+{
+
+ PWINDOW_OBJECT w = IntGetWindowObject(hWnd);
+ if (w) IntReleaseWindowObject(w);
+ return w;
+}
+
+
/*
* IntIsWindow
*
_____
Modified: trunk/reactos/subsys/win32k/win32k.xml
--- trunk/reactos/subsys/win32k/win32k.xml 2005-09-06 07:58:43 UTC
(rev 17692)
+++ trunk/reactos/subsys/win32k/win32k.xml 2005-09-06 09:35:39 UTC
(rev 17693)
@@ -58,8 +58,6 @@
<file>driver.c</file>
<file>error.c</file>
<file>math.c</file>
- <file>object.c</file>
- <file>ssec.c</file>
<file>copy.c</file>
</directory>
<directory name="ntddraw">
@@ -99,6 +97,8 @@
<file>window.c</file>
<file>winpos.c</file>
<file>winsta.c</file>
+ <file>object.c</file>
+ <file>ssec.c</file>
</directory>
<directory name="objects">
<file>bezier.c</file>