Removed incorrect Create/DuplicationNotify callbacks and replaced by a more correct Open callback which is what a windows driver would get. This is needed because of some changes I'm trying to make to get Parse routines to work properly, so I had to add two hacks for now, they will be removed within 2-3 commits

svn path=/trunk/; revision=15293
This commit is contained in:
Alex Ionescu 2005-05-15 04:56:52 +00:00
parent 63d3f7d1a8
commit 036efb7e10
36 changed files with 195 additions and 332 deletions

View file

@ -71,11 +71,20 @@ typedef NTSTATUS STDCALL_FUNC
* Callbacks used for Win32 objects... this define won't be needed after the Object Manager * Callbacks used for Win32 objects... this define won't be needed after the Object Manager
* rewrite -- Alex * rewrite -- Alex
*/ */
/* TEMPORARY HACK */
typedef NTSTATUS STDCALL_FUNC typedef NTSTATUS STDCALL_FUNC
(*OBJECT_CREATE_ROUTINE)(PVOID ObjectBody, (*OBJECT_CREATE_ROUTINE)(PVOID ObjectBody,
PVOID Parent, PVOID Parent,
PWSTR RemainingPath, PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes); struct _OBJECT_ATTRIBUTES* ObjectAttributes);
typedef NTSTATUS STDCALL_FUNC
(*OBJECT_OPEN_ROUTINE)(ULONG Reason,
PVOID ObjectBody,
PEPROCESS Process,
ULONG HandleCount,
ACCESS_MASK GrantedAccess);
typedef NTSTATUS STDCALL_FUNC typedef NTSTATUS STDCALL_FUNC
(*OBJECT_PARSE_ROUTINE)(PVOID Object, (*OBJECT_PARSE_ROUTINE)(PVOID Object,
@ -93,7 +102,7 @@ typedef PVOID STDCALL_FUNC
ULONG Attributes); ULONG Attributes);
typedef struct _W32_OBJECT_CALLBACK { typedef struct _W32_OBJECT_CALLBACK {
OBJECT_CREATE_ROUTINE WinStaCreate; OBJECT_OPEN_ROUTINE WinStaCreate;
OBJECT_PARSE_ROUTINE WinStaParse; OBJECT_PARSE_ROUTINE WinStaParse;
OBJECT_DELETE_ROUTINE WinStaDelete; OBJECT_DELETE_ROUTINE WinStaDelete;
OBJECT_FIND_ROUTINE WinStaFind; OBJECT_FIND_ROUTINE WinStaFind;

View file

@ -489,12 +489,6 @@ CmiObjectParse(IN PVOID ParsedObject,
IN OUT PWSTR *Path, IN OUT PWSTR *Path,
IN ULONG Attribute); IN ULONG Attribute);
NTSTATUS STDCALL
CmiObjectCreate(PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes);
VOID STDCALL VOID STDCALL
CmiObjectDelete(PVOID DeletedObject); CmiObjectDelete(PVOID DeletedObject);

View file

@ -225,13 +225,13 @@ NtCreateKey(OUT PHANDLE KeyHandle,
if (Disposition) if (Disposition)
*Disposition = REG_OPENED_EXISTING_KEY; *Disposition = REG_OPENED_EXISTING_KEY;
Status = ObCreateHandle(PsGetCurrentProcess(), Status = ObpCreateHandle(PsGetCurrentProcess(),
Object, Object,
DesiredAccess, DesiredAccess,
TRUE, TRUE,
KeyHandle); KeyHandle);
DPRINT("ObCreateHandle failed Status 0x%x\n", Status); DPRINT("ObpCreateHandle failed Status 0x%x\n", Status);
ObDereferenceObject(Object); ObDereferenceObject(Object);
RtlFreeUnicodeString(&RemainingPath); RtlFreeUnicodeString(&RemainingPath);
return Status; return Status;
@ -1182,7 +1182,7 @@ NtOpenKey(OUT PHANDLE KeyHandle,
goto openkey_cleanup; goto openkey_cleanup;
} }
Status = ObCreateHandle(PsGetCurrentProcess(), Status = ObpCreateHandle(PsGetCurrentProcess(),
Object, Object,
DesiredAccess, DesiredAccess,
TRUE, TRUE,

View file

@ -366,8 +366,6 @@ CmInitializeRegistry(VOID)
CmiKeyType->Security = CmiObjectSecurity; CmiKeyType->Security = CmiObjectSecurity;
CmiKeyType->QueryName = CmiObjectQueryName; CmiKeyType->QueryName = CmiObjectQueryName;
CmiKeyType->OkayToClose = NULL; CmiKeyType->OkayToClose = NULL;
CmiKeyType->Create = CmiObjectCreate;
CmiKeyType->DuplicationNotify = NULL;
RtlInitUnicodeString(&CmiKeyType->TypeName, L"Key"); RtlInitUnicodeString(&CmiKeyType->TypeName, L"Key");
ObpCreateTypeObject (CmiKeyType); ObpCreateTypeObject (CmiKeyType);

View file

@ -263,35 +263,6 @@ CmiObjectParse(PVOID ParsedObject,
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
NTSTATUS STDCALL
CmiObjectCreate(PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
PKEY_OBJECT KeyObject = ObjectBody;
PWSTR Start;
KeyObject->ParentKey = Parent;
if (RemainingPath)
{
Start = RemainingPath;
if(*Start == L'\\')
Start++;
RtlpCreateUnicodeString(&KeyObject->Name,
Start, NonPagedPool);
}
else
{
RtlInitUnicodeString(&KeyObject->Name,
NULL);
}
return STATUS_SUCCESS;
}
VOID STDCALL VOID STDCALL
CmiObjectDelete(PVOID DeletedObject) CmiObjectDelete(PVOID DeletedObject)
{ {

View file

@ -65,9 +65,7 @@ ExpInitializeCallbacks(VOID)
ExCallbackObjectType->Parse = NULL; ExCallbackObjectType->Parse = NULL;
ExCallbackObjectType->Security = NULL; ExCallbackObjectType->Security = NULL;
ExCallbackObjectType->QueryName = NULL; ExCallbackObjectType->QueryName = NULL;
ExCallbackObjectType->DuplicationNotify = NULL;
ExCallbackObjectType->OkayToClose = NULL; ExCallbackObjectType->OkayToClose = NULL;
ExCallbackObjectType->Create = NULL;
ExCallbackObjectType->Mapping = &ExpCallbackMapping; ExCallbackObjectType->Mapping = &ExpCallbackMapping;
ExCallbackObjectType->NonpagedPoolCharge = sizeof(_INT_CALLBACK_OBJECT); ExCallbackObjectType->NonpagedPoolCharge = sizeof(_INT_CALLBACK_OBJECT);
Status = ObpCreateTypeObject(ExCallbackObjectType); Status = ObpCreateTypeObject(ExCallbackObjectType);

View file

@ -55,8 +55,6 @@ ExpInitializeEventImplementation(VOID)
ExEventObjectType->Security = NULL; ExEventObjectType->Security = NULL;
ExEventObjectType->QueryName = NULL; ExEventObjectType->QueryName = NULL;
ExEventObjectType->OkayToClose = NULL; ExEventObjectType->OkayToClose = NULL;
ExEventObjectType->Create = NULL;
ExEventObjectType->DuplicationNotify = NULL;
ObpCreateTypeObject(ExEventObjectType); ObpCreateTypeObject(ExEventObjectType);
} }

View file

@ -52,8 +52,6 @@ ExpInitializeEventPairImplementation(VOID)
ExEventPairObjectType->Security = NULL; ExEventPairObjectType->Security = NULL;
ExEventPairObjectType->QueryName = NULL; ExEventPairObjectType->QueryName = NULL;
ExEventPairObjectType->OkayToClose = NULL; ExEventPairObjectType->OkayToClose = NULL;
ExEventPairObjectType->Create = NULL;
ExEventPairObjectType->DuplicationNotify = NULL;
ObpCreateTypeObject(ExEventPairObjectType); ObpCreateTypeObject(ExEventPairObjectType);
} }

View file

@ -68,11 +68,10 @@ ExpInitializeMutantImplementation(VOID)
ExMutantObjectType->Close = NULL; ExMutantObjectType->Close = NULL;
ExMutantObjectType->Delete = ExpDeleteMutant; ExMutantObjectType->Delete = ExpDeleteMutant;
ExMutantObjectType->Parse = NULL; ExMutantObjectType->Parse = NULL;
ExMutantObjectType->Open = NULL;
ExMutantObjectType->Security = NULL; ExMutantObjectType->Security = NULL;
ExMutantObjectType->QueryName = NULL; ExMutantObjectType->QueryName = NULL;
ExMutantObjectType->OkayToClose = NULL; ExMutantObjectType->OkayToClose = NULL;
ExMutantObjectType->Create = NULL;
ExMutantObjectType->DuplicationNotify = NULL;
ObpCreateTypeObject(ExMutantObjectType); ObpCreateTypeObject(ExMutantObjectType);
} }

View file

@ -94,10 +94,10 @@ ExpInitializeProfileImplementation(VOID)
ExProfileObjectType->Close = NULL; ExProfileObjectType->Close = NULL;
ExProfileObjectType->Delete = ExpDeleteProfile; ExProfileObjectType->Delete = ExpDeleteProfile;
ExProfileObjectType->Parse = NULL; ExProfileObjectType->Parse = NULL;
ExProfileObjectType->Open = NULL;
ExProfileObjectType->Security = NULL; ExProfileObjectType->Security = NULL;
ExProfileObjectType->QueryName = NULL; ExProfileObjectType->QueryName = NULL;
ExProfileObjectType->OkayToClose = NULL; ExProfileObjectType->OkayToClose = NULL;
ExProfileObjectType->Create = NULL;
ObpCreateTypeObject(ExProfileObjectType); ObpCreateTypeObject(ExProfileObjectType);
} }

View file

@ -54,8 +54,6 @@ ExpInitializeSemaphoreImplementation(VOID)
ExSemaphoreObjectType->Security = NULL; ExSemaphoreObjectType->Security = NULL;
ExSemaphoreObjectType->QueryName = NULL; ExSemaphoreObjectType->QueryName = NULL;
ExSemaphoreObjectType->OkayToClose = NULL; ExSemaphoreObjectType->OkayToClose = NULL;
ExSemaphoreObjectType->Create = NULL;
ExSemaphoreObjectType->DuplicationNotify = NULL;
ObpCreateTypeObject(ExSemaphoreObjectType); ObpCreateTypeObject(ExSemaphoreObjectType);
} }

View file

@ -244,10 +244,9 @@ ExpInitializeTimerImplementation(VOID)
ExTimerType->Delete = ExpDeleteTimer; ExTimerType->Delete = ExpDeleteTimer;
ExTimerType->Parse = NULL; ExTimerType->Parse = NULL;
ExTimerType->Security = NULL; ExTimerType->Security = NULL;
ExTimerType->Open = NULL;
ExTimerType->QueryName = NULL; ExTimerType->QueryName = NULL;
ExTimerType->OkayToClose = NULL; ExTimerType->OkayToClose = NULL;
ExTimerType->Create = NULL;
ExTimerType->DuplicationNotify = NULL;
ObpCreateTypeObject(ExTimerType); ObpCreateTypeObject(ExTimerType);
/* Initialize the Wait List and Lock */ /* Initialize the Wait List and Lock */

View file

@ -39,7 +39,7 @@ static GENERIC_MAPPING ExpDesktopMapping = {
DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS
}; };
OBJECT_CREATE_ROUTINE ExpWindowStationObjectCreate = NULL; OBJECT_OPEN_ROUTINE ExpWindowStationObjectOpen = NULL;
OBJECT_PARSE_ROUTINE ExpWindowStationObjectParse = NULL; OBJECT_PARSE_ROUTINE ExpWindowStationObjectParse = NULL;
OBJECT_DELETE_ROUTINE ExpWindowStationObjectDelete = NULL; OBJECT_DELETE_ROUTINE ExpWindowStationObjectDelete = NULL;
OBJECT_FIND_ROUTINE ExpWindowStationObjectFind = NULL; OBJECT_FIND_ROUTINE ExpWindowStationObjectFind = NULL;
@ -50,16 +50,18 @@ OBJECT_DELETE_ROUTINE ExpDesktopObjectDelete = NULL;
NTSTATUS NTSTATUS
STDCALL STDCALL
ExpWinStaObjectCreate(PVOID ObjectBody, ExpWinStaObjectOpen(OB_OPEN_REASON Reason,
PVOID Parent, PVOID ObjectBody,
PWSTR RemainingPath, PEPROCESS Process,
struct _OBJECT_ATTRIBUTES* ObjectAttributes) ULONG HandleCount,
ACCESS_MASK GrantedAccess)
{ {
/* Call the Registered Callback */ /* Call the Registered Callback */
return ExpWindowStationObjectCreate(ObjectBody, return ExpWindowStationObjectOpen(Reason,
Parent, ObjectBody,
RemainingPath, Process,
ObjectAttributes); HandleCount,
GrantedAccess);
} }
VOID VOID
@ -101,9 +103,9 @@ ExpWinStaObjectParse(PVOID Object,
NTSTATUS NTSTATUS
STDCALL STDCALL
ExpDesktopCreate(PVOID ObjectBody, ExpDesktopCreate(PVOID ObjectBody,
PVOID Parent, PVOID Parent,
PWSTR RemainingPath, PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes) struct _OBJECT_ATTRIBUTES* ObjectAttributes)
{ {
/* Call the Registered Callback */ /* Call the Registered Callback */
return ExpDesktopObjectCreate(ObjectBody, return ExpDesktopObjectCreate(ObjectBody,
@ -135,15 +137,13 @@ ExpWin32kInit(VOID)
ExWindowStationObjectType->NonpagedPoolCharge = sizeof(WINSTATION_OBJECT); ExWindowStationObjectType->NonpagedPoolCharge = sizeof(WINSTATION_OBJECT);
ExWindowStationObjectType->Mapping = &ExpWindowStationMapping; ExWindowStationObjectType->Mapping = &ExpWindowStationMapping;
ExWindowStationObjectType->Dump = NULL; ExWindowStationObjectType->Dump = NULL;
ExWindowStationObjectType->Open = NULL; ExWindowStationObjectType->Open = ExpWinStaObjectOpen;
ExWindowStationObjectType->Close = NULL; ExWindowStationObjectType->Close = NULL;
ExWindowStationObjectType->Delete = ExpWinStaObjectDelete; ExWindowStationObjectType->Delete = ExpWinStaObjectDelete;
ExWindowStationObjectType->Parse = ExpWinStaObjectParse; ExWindowStationObjectType->Parse = ExpWinStaObjectParse;
ExWindowStationObjectType->Security = NULL; ExWindowStationObjectType->Security = NULL;
ExWindowStationObjectType->QueryName = NULL; ExWindowStationObjectType->QueryName = NULL;
ExWindowStationObjectType->OkayToClose = NULL; ExWindowStationObjectType->OkayToClose = NULL;
ExWindowStationObjectType->Create = ExpWinStaObjectCreate;
ExWindowStationObjectType->DuplicationNotify = NULL;
RtlInitUnicodeString(&ExWindowStationObjectType->TypeName, L"WindowStation"); RtlInitUnicodeString(&ExWindowStationObjectType->TypeName, L"WindowStation");
ObpCreateTypeObject(ExWindowStationObjectType); ObpCreateTypeObject(ExWindowStationObjectType);
@ -165,8 +165,7 @@ ExpWin32kInit(VOID)
ExDesktopObjectType->Security = NULL; ExDesktopObjectType->Security = NULL;
ExDesktopObjectType->QueryName = NULL; ExDesktopObjectType->QueryName = NULL;
ExDesktopObjectType->OkayToClose = NULL; ExDesktopObjectType->OkayToClose = NULL;
ExDesktopObjectType->Create = ExpDesktopCreate;
ExDesktopObjectType->DuplicationNotify = NULL;
RtlInitUnicodeString(&ExDesktopObjectType->TypeName, L"Desktop"); RtlInitUnicodeString(&ExDesktopObjectType->TypeName, L"Desktop");
ObpCreateTypeObject(ExDesktopObjectType); ObpCreateTypeObject(ExDesktopObjectType);
} }

View file

@ -16,6 +16,15 @@
struct _EPROCESS; struct _EPROCESS;
typedef enum _OB_OPEN_REASON
{
ObCreateHandle,
ObOpenHandle,
ObDuplicateHandle,
ObInheritHandle,
ObMaxOpenReason
} OB_OPEN_REASON;
typedef struct typedef struct
{ {
CSHORT Type; CSHORT Type;
@ -78,12 +87,6 @@ typedef struct _OBJECT_TYPE
*/ */
VOID STDCALL_FUNC (*Dump)(VOID); VOID STDCALL_FUNC (*Dump)(VOID);
/*
* PURPOSE: Opens the object
* NOTE: To be defined
*/
VOID STDCALL_FUNC (*Open)(VOID);
/* /*
* PURPOSE: Called to close an object if OkayToClose returns true * PURPOSE: Called to close an object if OkayToClose returns true
*/ */
@ -136,14 +139,11 @@ typedef struct _OBJECT_TYPE
*/ */
VOID STDCALL_FUNC (*OkayToClose)(VOID); VOID STDCALL_FUNC (*OkayToClose)(VOID);
NTSTATUS STDCALL_FUNC (*Create)(PVOID ObjectBody, NTSTATUS STDCALL_FUNC (*Open)(OB_OPEN_REASON Reason,
PVOID Parent, PVOID ObjectBody,
PWSTR RemainingPath, PEPROCESS Process,
struct _OBJECT_ATTRIBUTES* ObjectAttributes); ULONG HandleCount,
ACCESS_MASK GrantedAccess);
VOID STDCALL_FUNC (*DuplicationNotify)(PEPROCESS DuplicateTo,
PEPROCESS DuplicateFrom,
PVOID Object);
} OBJECT_TYPE; } OBJECT_TYPE;
@ -259,7 +259,7 @@ VOID
ObInitSymbolicLinkImplementation(VOID); ObInitSymbolicLinkImplementation(VOID);
NTSTATUS ObCreateHandle(struct _EPROCESS* Process, NTSTATUS ObpCreateHandle(struct _EPROCESS* Process,
PVOID ObjectBody, PVOID ObjectBody,
ACCESS_MASK GrantedAccess, ACCESS_MASK GrantedAccess,
BOOLEAN Inherit, BOOLEAN Inherit,

View file

@ -80,13 +80,6 @@ POBJECT_TYPE EXPORTED IoDriverObjectType = NULL;
/* DECLARATIONS ***************************************************************/ /* DECLARATIONS ***************************************************************/
NTSTATUS STDCALL
IopCreateDriver(
PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes);
VOID STDCALL VOID STDCALL
IopDeleteDriver(PVOID ObjectBody); IopDeleteDriver(PVOID ObjectBody);
@ -112,8 +105,6 @@ IopInitDriverImplementation(VOID)
IoDriverObjectType->Security = NULL; IoDriverObjectType->Security = NULL;
IoDriverObjectType->QueryName = NULL; IoDriverObjectType->QueryName = NULL;
IoDriverObjectType->OkayToClose = NULL; IoDriverObjectType->OkayToClose = NULL;
IoDriverObjectType->Create = IopCreateDriver;
IoDriverObjectType->DuplicationNotify = NULL;
RtlInitUnicodeString(&IoDriverObjectType->TypeName, L"Driver"); RtlInitUnicodeString(&IoDriverObjectType->TypeName, L"Driver");
ObpCreateTypeObject(IoDriverObjectType); ObpCreateTypeObject(IoDriverObjectType);
@ -138,46 +129,6 @@ IopInvalidDeviceRequest(
return STATUS_INVALID_DEVICE_REQUEST; return STATUS_INVALID_DEVICE_REQUEST;
} }
NTSTATUS STDCALL
IopCreateDriver(
PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
PDRIVER_OBJECT Object = ObjectBody;
ULONG i;
DPRINT("IopCreateDriver(ObjectBody %x, Parent %x, RemainingPath %S)\n",
ObjectBody, Parent, RemainingPath);
if (RemainingPath != NULL && wcschr(RemainingPath + 1, '\\') != NULL)
return STATUS_UNSUCCESSFUL;
/* Create driver extension */
Object->DriverExtension = (PDRIVER_EXTENSION)
ExAllocatePoolWithTag(
NonPagedPool,
sizeof(DRIVER_EXTENSION),
TAG_DRIVER_EXTENSION);
if (Object->DriverExtension == NULL)
{
return STATUS_NO_MEMORY;
}
RtlZeroMemory(Object->DriverExtension, sizeof(DRIVER_EXTENSION));
Object->Type = IO_TYPE_DRIVER;
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
Object->MajorFunction[i] = IopInvalidDeviceRequest;
Object->HardwareDatabase = &IopHardwareDatabaseKey;
return STATUS_SUCCESS;
}
VOID STDCALL VOID STDCALL
IopDeleteDriver(PVOID ObjectBody) IopDeleteDriver(PVOID ObjectBody)
{ {
@ -217,6 +168,7 @@ IopCreateDriverObject(
UNICODE_STRING DriverName; UNICODE_STRING DriverName;
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status; NTSTATUS Status;
ULONG i;
PWSTR Buffer = NULL; PWSTR Buffer = NULL;
DPRINT("IopCreateDriverObject(%p '%wZ' %x %p %x)\n", DPRINT("IopCreateDriverObject(%p '%wZ' %x %p %x)\n",
@ -269,6 +221,27 @@ IopCreateDriverObject(
{ {
return Status; return Status;
} }
/* Create driver extension */
Object->DriverExtension = (PDRIVER_EXTENSION)
ExAllocatePoolWithTag(
NonPagedPool,
sizeof(DRIVER_EXTENSION),
TAG_DRIVER_EXTENSION);
if (Object->DriverExtension == NULL)
{
return STATUS_NO_MEMORY;
}
RtlZeroMemory(Object->DriverExtension, sizeof(DRIVER_EXTENSION));
Object->Type = IO_TYPE_DRIVER;
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
Object->MajorFunction[i] = IopInvalidDeviceRequest;
Object->HardwareDatabase = &IopHardwareDatabaseKey;
Object->DriverStart = DriverImageStart; Object->DriverStart = DriverImageStart;
Object->DriverSize = DriverImageSize; Object->DriverSize = DriverImageSize;

View file

@ -222,8 +222,6 @@ IopInitIoCompletionImplementation(VOID)
ExIoCompletionType->Security = NULL; ExIoCompletionType->Security = NULL;
ExIoCompletionType->QueryName = NULL; ExIoCompletionType->QueryName = NULL;
ExIoCompletionType->OkayToClose = NULL; ExIoCompletionType->OkayToClose = NULL;
ExIoCompletionType->Create = NULL;
ExIoCompletionType->DuplicationNotify = NULL;
} }
NTSTATUS NTSTATUS

View file

@ -51,7 +51,7 @@ NPAGED_LOOKASIDE_LIST IoLargeIrpLookaside;
NPAGED_LOOKASIDE_LIST IoSmallIrpLookaside; NPAGED_LOOKASIDE_LIST IoSmallIrpLookaside;
/* INIT FUNCTIONS ************************************************************/ /* INIT FUNCTIONS ************************************************************/
VOID VOID
INIT_FUNCTION INIT_FUNCTION
IoInitCancelHandling(VOID) IoInitCancelHandling(VOID)
@ -217,8 +217,6 @@ IoInit (VOID)
IoDeviceObjectType->Security = NULL; IoDeviceObjectType->Security = NULL;
IoDeviceObjectType->QueryName = NULL; IoDeviceObjectType->QueryName = NULL;
IoDeviceObjectType->OkayToClose = NULL; IoDeviceObjectType->OkayToClose = NULL;
IoDeviceObjectType->Create = NULL;
IoDeviceObjectType->DuplicationNotify = NULL;
RtlInitUnicodeString(&IoDeviceObjectType->TypeName, L"Device"); RtlInitUnicodeString(&IoDeviceObjectType->TypeName, L"Device");
@ -246,8 +244,6 @@ IoInit (VOID)
IoFileObjectType->Security = IopSecurityFile; IoFileObjectType->Security = IopSecurityFile;
IoFileObjectType->QueryName = IopQueryNameFile; IoFileObjectType->QueryName = IopQueryNameFile;
IoFileObjectType->OkayToClose = NULL; IoFileObjectType->OkayToClose = NULL;
IoFileObjectType->Create = IopCreateFile;
IoFileObjectType->DuplicationNotify = NULL;
RtlInitUnicodeString(&IoFileObjectType->TypeName, L"File"); RtlInitUnicodeString(&IoFileObjectType->TypeName, L"File");

View file

@ -89,7 +89,7 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle,
L"\\SystemRoot\\system32\\smss.exe"); L"\\SystemRoot\\system32\\smss.exe");
Status = ObCreateHandle( Status = ObpCreateHandle(
PsGetCurrentProcess(), PsGetCurrentProcess(),
PsInitialSystemProcess, PsInitialSystemProcess,
PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION, PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION,

View file

@ -62,37 +62,6 @@ LpcpVerifyCreateParameters (IN PHANDLE PortHandle,
return (STATUS_SUCCESS); return (STATUS_SUCCESS);
} }
/**********************************************************************
* NAME
* NiCreatePort/4
*
* DESCRIPTION
*
* ARGUMENTS
*
* RETURN VALUE
*/
NTSTATUS STDCALL
NiCreatePort (PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
if (RemainingPath == NULL)
{
return (STATUS_SUCCESS);
}
if (wcschr(RemainingPath+1, '\\') != NULL)
{
return (STATUS_UNSUCCESSFUL);
}
return (STATUS_SUCCESS);
}
/********************************************************************** /**********************************************************************
* NAME EXPORTED * NAME EXPORTED
* NtCreatePort/5 * NtCreatePort/5

View file

@ -54,9 +54,8 @@ LpcpInitSystem (VOID)
LpcPortObjectType->Parse = NULL; LpcPortObjectType->Parse = NULL;
LpcPortObjectType->Security = NULL; LpcPortObjectType->Security = NULL;
LpcPortObjectType->QueryName = NULL; LpcPortObjectType->QueryName = NULL;
LpcPortObjectType->Open = NULL;
LpcPortObjectType->OkayToClose = NULL; LpcPortObjectType->OkayToClose = NULL;
LpcPortObjectType->Create = NiCreatePort;
LpcPortObjectType->DuplicationNotify = NULL;
ObpCreateTypeObject(LpcPortObjectType); ObpCreateTypeObject(LpcPortObjectType);

View file

@ -2068,27 +2068,6 @@ MmpCloseSection(PVOID ObjectBody,
ObjectBody, HandleCount, ObGetObjectPointerCount(ObjectBody)); ObjectBody, HandleCount, ObGetObjectPointerCount(ObjectBody));
} }
NTSTATUS STDCALL
MmpCreateSection(PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
DPRINT("MmpCreateSection(ObjectBody %x, Parent %x, RemainingPath %S)\n",
ObjectBody, Parent, RemainingPath);
if (RemainingPath == NULL)
{
return(STATUS_SUCCESS);
}
if (wcschr(RemainingPath+1, L'\\') != NULL)
{
return(STATUS_UNSUCCESSFUL);
}
return(STATUS_SUCCESS);
}
NTSTATUS INIT_FUNCTION NTSTATUS INIT_FUNCTION
MmCreatePhysicalMemorySection(VOID) MmCreatePhysicalMemorySection(VOID)
{ {
@ -2145,11 +2124,10 @@ MmInitSectionImplementation(VOID)
MmSectionObjectType->Close = MmpCloseSection; MmSectionObjectType->Close = MmpCloseSection;
MmSectionObjectType->Delete = MmpDeleteSection; MmSectionObjectType->Delete = MmpDeleteSection;
MmSectionObjectType->Parse = NULL; MmSectionObjectType->Parse = NULL;
MmSectionObjectType->Open = NULL;
MmSectionObjectType->Security = NULL; MmSectionObjectType->Security = NULL;
MmSectionObjectType->QueryName = NULL; MmSectionObjectType->QueryName = NULL;
MmSectionObjectType->OkayToClose = NULL; MmSectionObjectType->OkayToClose = NULL;
MmSectionObjectType->Create = MmpCreateSection;
MmSectionObjectType->DuplicationNotify = NULL;
/* /*
* NOTE: Do not register the section object type here because * NOTE: Do not register the section object type here because

View file

@ -475,6 +475,7 @@ NtCreateDirectoryObject (OUT PHANDLE DirectoryHandle,
0, 0,
0, 0,
(PVOID*)&Directory); (PVOID*)&Directory);
if(NT_SUCCESS(Status)) if(NT_SUCCESS(Status))
{ {
Status = ObInsertObject((PVOID)Directory, Status = ObInsertObject((PVOID)Directory,

View file

@ -459,11 +459,11 @@ NtDuplicateObject (IN HANDLE SourceProcessHandle,
ObjectType->Mapping); ObjectType->Mapping);
} }
} }
Status = ObCreateHandle(TargetProcess, Status = ObpCreateHandle(TargetProcess,
ObjectBody, ObjectBody,
DesiredAccess, DesiredAccess,
InheritHandle, InheritHandle,
&hTarget); &hTarget);
ObDereferenceObject(ObjectBody); ObDereferenceObject(ObjectBody);
@ -586,7 +586,7 @@ ObKillProcess(PEPROCESS Process)
NTSTATUS NTSTATUS
ObCreateHandle(PEPROCESS Process, ObpCreateHandle(PEPROCESS Process,
PVOID ObjectBody, PVOID ObjectBody,
ACCESS_MASK GrantedAccess, ACCESS_MASK GrantedAccess,
BOOLEAN Inherit, BOOLEAN Inherit,
@ -605,7 +605,7 @@ ObCreateHandle(PEPROCESS Process,
PAGED_CODE(); PAGED_CODE();
DPRINT("ObCreateHandle(Process %x, obj %x)\n",Process,ObjectBody); DPRINT("ObpCreateHandle(Process %x, obj %x)\n",Process,ObjectBody);
ASSERT(Process); ASSERT(Process);
ASSERT(ObjectBody); ASSERT(ObjectBody);
@ -941,7 +941,7 @@ ObInsertObject(IN PVOID Object,
Access = DesiredAccess; Access = DesiredAccess;
ObjectHeader = BODY_TO_HEADER(Object); ObjectHeader = BODY_TO_HEADER(Object);
return(ObCreateHandle(PsGetCurrentProcess(), return(ObpCreateHandle(PsGetCurrentProcess(),
Object, Object,
Access, Access,
ObjectHeader->Inherit, ObjectHeader->Inherit,

View file

@ -159,7 +159,7 @@ ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes,
return Status; return Status;
} }
Status = ObCreateHandle(PsGetCurrentProcess(), Status = ObpCreateHandle(PsGetCurrentProcess(),
Object, Object,
DesiredAccess, DesiredAccess,
FALSE, FALSE,
@ -238,6 +238,24 @@ ObpRemoveEntryDirectory(POBJECT_HEADER Header)
KeReleaseSpinLock(&(Header->Parent->Lock),oldlvl); KeReleaseSpinLock(&(Header->Parent->Lock),oldlvl);
} }
NTSTATUS
STDCALL
ObpCreateDirectory(OB_OPEN_REASON Reason,
PVOID ObjectBody,
PEPROCESS Process,
ULONG HandleCount,
ACCESS_MASK GrantedAccess)
{
PDIRECTORY_OBJECT Directory = ObjectBody;
if (Reason == ObCreateHandle)
{
InitializeListHead(&Directory->head);
KeInitializeSpinLock(&Directory->Lock);
}
return STATUS_SUCCESS;
}
PVOID PVOID
ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject, ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject,
@ -350,29 +368,6 @@ ObpParseDirectory(PVOID Object,
} }
NTSTATUS STDCALL
ObpCreateDirectory(PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
PDIRECTORY_OBJECT DirectoryObject = (PDIRECTORY_OBJECT)ObjectBody;
DPRINT("ObpCreateDirectory(ObjectBody %x, Parent %x, RemainingPath %S)\n",
ObjectBody, Parent, RemainingPath);
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
{
return(STATUS_UNSUCCESSFUL);
}
InitializeListHead(&DirectoryObject->head);
KeInitializeSpinLock(&DirectoryObject->Lock);
return(STATUS_SUCCESS);
}
VOID INIT_FUNCTION VOID INIT_FUNCTION
ObInit(VOID) ObInit(VOID)
/* /*
@ -405,8 +400,7 @@ ObInit(VOID)
ObDirectoryType->Security = NULL; ObDirectoryType->Security = NULL;
ObDirectoryType->QueryName = NULL; ObDirectoryType->QueryName = NULL;
ObDirectoryType->OkayToClose = NULL; ObDirectoryType->OkayToClose = NULL;
ObDirectoryType->Create = ObpCreateDirectory; ObDirectoryType->Open = ObpCreateDirectory;
ObDirectoryType->DuplicationNotify = NULL;
RtlInitUnicodeString(&ObDirectoryType->TypeName, RtlInitUnicodeString(&ObDirectoryType->TypeName,
L"Directory"); L"Directory");
@ -430,8 +424,6 @@ ObInit(VOID)
ObTypeObjectType->Security = NULL; ObTypeObjectType->Security = NULL;
ObTypeObjectType->QueryName = NULL; ObTypeObjectType->QueryName = NULL;
ObTypeObjectType->OkayToClose = NULL; ObTypeObjectType->OkayToClose = NULL;
ObTypeObjectType->Create = NULL;
ObTypeObjectType->DuplicationNotify = NULL;
RtlInitUnicodeString(&ObTypeObjectType->TypeName, RtlInitUnicodeString(&ObTypeObjectType->TypeName,
L"ObjectType"); L"ObjectType");

View file

@ -22,7 +22,13 @@ typedef struct _RETENTION_CHECK_PARAMS
POBJECT_HEADER ObjectHeader; POBJECT_HEADER ObjectHeader;
} RETENTION_CHECK_PARAMS, *PRETENTION_CHECK_PARAMS; } RETENTION_CHECK_PARAMS, *PRETENTION_CHECK_PARAMS;
/* TEMPORARY HACK. DO NOT REMOVE -- Alex */
NTSTATUS
STDCALL
ExpDesktopCreate(PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes);
/* FUNCTIONS ************************************************************/ /* FUNCTIONS ************************************************************/
NTSTATUS NTSTATUS
@ -733,6 +739,7 @@ ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL,
RtlInitUnicodeString(&RemainingPath, NULL); RtlInitUnicodeString(&RemainingPath, NULL);
} }
DPRINT("Allocating memory\n");
Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool, Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool,
OBJECT_ALLOC_SIZE(ObjectSize), OBJECT_ALLOC_SIZE(ObjectSize),
Type->Tag); Type->Tag);
@ -786,14 +793,39 @@ ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL,
ObjectAttached = TRUE; ObjectAttached = TRUE;
} }
DPRINT("About to call Create Routine\n"); if ((Header->ObjectType == IoFileObjectType) ||
if (Header->ObjectType->Create != NULL) (Header->ObjectType == ExDesktopObjectType) ||
{ (Header->ObjectType->Open != NULL))
DPRINT("Calling %x\n", Header->ObjectType->Create); {
Status = Header->ObjectType->Create(HEADER_TO_BODY(Header), DPRINT("About to call Open Routine\n");
Parent, if (Header->ObjectType == IoFileObjectType)
RemainingPath.Buffer, {
ObjectAttributes); /* TEMPORARY HACK. DO NOT TOUCH -- Alex */
DPRINT("Calling IopCreateFile\n");
Status = IopCreateFile(HEADER_TO_BODY(Header),
Parent,
RemainingPath.Buffer,
ObjectAttributes);
}
else if (Header->ObjectType == ExDesktopObjectType)
{
/* TEMPORARY HACK. DO NOT TOUCH -- Alex */
DPRINT("Calling ExpDesktopCreate\n");
Status = ExpDesktopCreate(HEADER_TO_BODY(Header),
Parent,
RemainingPath.Buffer,
ObjectAttributes);
}
else if (Header->ObjectType->Open != NULL)
{
DPRINT("Calling %x\n", Header->ObjectType->Open);
Status = Header->ObjectType->Open(ObCreateHandle,
HEADER_TO_BODY(Header),
NULL,
0,
0);
}
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
if (ObjectAttached == TRUE) if (ObjectAttached == TRUE)
@ -810,7 +842,8 @@ ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL,
DPRINT("Create Failed\n"); DPRINT("Create Failed\n");
return Status; return Status;
} }
} }
RtlFreeUnicodeString(&RemainingPath); RtlFreeUnicodeString(&RemainingPath);
SeCaptureSubjectContext(&SubjectContext); SeCaptureSubjectContext(&SubjectContext);
@ -960,7 +993,7 @@ ObOpenObjectByPointer(IN POBJECT Object,
return Status; return Status;
} }
Status = ObCreateHandle(PsGetCurrentProcess(), Status = ObpCreateHandle(PsGetCurrentProcess(),
Object, Object,
DesiredAccess, DesiredAccess,
(BOOLEAN)(HandleAttributes & OBJ_INHERIT), (BOOLEAN)(HandleAttributes & OBJ_INHERIT),

View file

@ -31,29 +31,6 @@ static GENERIC_MAPPING ObpSymbolicLinkMapping = {
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
/**********************************************************************
* NAME INTERNAL
* ObpCreateSymbolicLink
*
* DESCRIPTION
*
* ARGUMENTS
*
* RETURNN VALUE
* Status.
*
* REVISIONS
*/
NTSTATUS STDCALL
ObpCreateSymbolicLink(PVOID Object,
PVOID Parent,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
return(STATUS_SUCCESS);
}
/********************************************************************** /**********************************************************************
* NAME INTERNAL * NAME INTERNAL
* ObpDeleteSymbolicLink * ObpDeleteSymbolicLink
@ -175,10 +152,9 @@ ObInitSymbolicLinkImplementation (VOID)
ObSymbolicLinkType->Delete = ObpDeleteSymbolicLink; ObSymbolicLinkType->Delete = ObpDeleteSymbolicLink;
ObSymbolicLinkType->Parse = ObpParseSymbolicLink; ObSymbolicLinkType->Parse = ObpParseSymbolicLink;
ObSymbolicLinkType->Security = NULL; ObSymbolicLinkType->Security = NULL;
ObSymbolicLinkType->Open = NULL;
ObSymbolicLinkType->QueryName = NULL; ObSymbolicLinkType->QueryName = NULL;
ObSymbolicLinkType->OkayToClose = NULL; ObSymbolicLinkType->OkayToClose = NULL;
ObSymbolicLinkType->Create = ObpCreateSymbolicLink;
ObSymbolicLinkType->DuplicationNotify = NULL;
RtlInitUnicodeString(&ObSymbolicLinkType->TypeName, RtlInitUnicodeString(&ObSymbolicLinkType->TypeName,
L"SymbolicLink"); L"SymbolicLink");

View file

@ -78,8 +78,7 @@ PsInitJobManagment ( VOID )
PsJobType->Security = NULL; PsJobType->Security = NULL;
PsJobType->QueryName = NULL; PsJobType->QueryName = NULL;
PsJobType->OkayToClose = NULL; PsJobType->OkayToClose = NULL;
PsJobType->Create = NULL; PsJobType->Open = NULL;
PsJobType->DuplicationNotify = NULL;
RtlInitUnicodeString(&PsJobType->TypeName, L"Job"); RtlInitUnicodeString(&PsJobType->TypeName, L"Job");

View file

@ -97,8 +97,7 @@ PsInitThreadManagment(VOID)
PsThreadType->Security = NULL; PsThreadType->Security = NULL;
PsThreadType->QueryName = NULL; PsThreadType->QueryName = NULL;
PsThreadType->OkayToClose = NULL; PsThreadType->OkayToClose = NULL;
PsThreadType->Create = NULL; PsThreadType->Open = NULL;
PsThreadType->DuplicationNotify = NULL;
RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread"); RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread");
@ -149,8 +148,7 @@ PsInitProcessManagment(VOID)
PsProcessType->Security = NULL; PsProcessType->Security = NULL;
PsProcessType->QueryName = NULL; PsProcessType->QueryName = NULL;
PsProcessType->OkayToClose = NULL; PsProcessType->OkayToClose = NULL;
PsProcessType->Create = NULL; PsProcessType->Open = NULL;
PsProcessType->DuplicationNotify = NULL;
RtlInitUnicodeString(&PsProcessType->TypeName, L"Process"); RtlInitUnicodeString(&PsProcessType->TypeName, L"Process");

View file

@ -99,7 +99,7 @@ NtOpenProcessTokenEx(IN HANDLE ProcessHandle,
&Token); &Token);
if(NT_SUCCESS(Status)) if(NT_SUCCESS(Status))
{ {
Status = ObCreateHandle(PsGetCurrentProcess(), Status = ObpCreateHandle(PsGetCurrentProcess(),
Token, Token,
DesiredAccess, DesiredAccess,
FALSE, FALSE,

View file

@ -21,7 +21,7 @@ static PW32_THREAD_CALLBACK PspWin32ThreadCallback = NULL;
static ULONG PspWin32ProcessSize = 0; static ULONG PspWin32ProcessSize = 0;
static ULONG PspWin32ThreadSize = 0; static ULONG PspWin32ThreadSize = 0;
extern OBJECT_CREATE_ROUTINE ExpWindowStationObjectCreate; extern OBJECT_OPEN_ROUTINE ExpWindowStationObjectOpen;
extern OBJECT_PARSE_ROUTINE ExpWindowStationObjectParse; extern OBJECT_PARSE_ROUTINE ExpWindowStationObjectParse;
extern OBJECT_DELETE_ROUTINE ExpWindowStationObjectDelete; extern OBJECT_DELETE_ROUTINE ExpWindowStationObjectDelete;
extern OBJECT_FIND_ROUTINE ExpWindowStationObjectFind; extern OBJECT_FIND_ROUTINE ExpWindowStationObjectFind;
@ -92,7 +92,7 @@ PsEstablishWin32Callouts (PW32_PROCESS_CALLBACK W32ProcessCallback,
PspWin32ProcessSize = W32ProcessSize; PspWin32ProcessSize = W32ProcessSize;
PspWin32ThreadSize = W32ThreadSize; PspWin32ThreadSize = W32ThreadSize;
ExpWindowStationObjectCreate = W32ObjectCallback->WinStaCreate; ExpWindowStationObjectOpen = W32ObjectCallback->WinStaCreate;
ExpWindowStationObjectParse = W32ObjectCallback->WinStaParse; ExpWindowStationObjectParse = W32ObjectCallback->WinStaParse;
ExpWindowStationObjectDelete = W32ObjectCallback->WinStaDelete; ExpWindowStationObjectDelete = W32ObjectCallback->WinStaDelete;
ExpWindowStationObjectFind = W32ObjectCallback->WinStaFind; ExpWindowStationObjectFind = W32ObjectCallback->WinStaFind;

View file

@ -580,8 +580,7 @@ SepInitializeTokenImplementation(VOID)
SepTokenObjectType->Security = NULL; SepTokenObjectType->Security = NULL;
SepTokenObjectType->QueryName = NULL; SepTokenObjectType->QueryName = NULL;
SepTokenObjectType->OkayToClose = NULL; SepTokenObjectType->OkayToClose = NULL;
SepTokenObjectType->Create = NULL; SepTokenObjectType->Open = NULL;
SepTokenObjectType->DuplicationNotify = NULL;
RtlInitUnicodeString(&SepTokenObjectType->TypeName, L"Token"); RtlInitUnicodeString(&SepTokenObjectType->TypeName, L"Token");
ObpCreateTypeObject (SepTokenObjectType); ObpCreateTypeObject (SepTokenObjectType);

View file

@ -25,13 +25,12 @@ InitDesktopImpl(VOID);
NTSTATUS FASTCALL NTSTATUS FASTCALL
CleanupDesktopImpl(VOID); CleanupDesktopImpl(VOID);
NTSTATUS NTSTATUS STDCALL
STDCALL
IntDesktopObjectCreate(PVOID ObjectBody, IntDesktopObjectCreate(PVOID ObjectBody,
PVOID Parent, PVOID Parent,
PWSTR RemainingPath, PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes); struct _OBJECT_ATTRIBUTES* ObjectAttributes);
VOID STDCALL VOID STDCALL
IntDesktopObjectDelete(PVOID DeletedObject); IntDesktopObjectDelete(PVOID DeletedObject);

View file

@ -25,10 +25,11 @@ CleanupWindowStationImpl(VOID);
NTSTATUS NTSTATUS
STDCALL STDCALL
IntWinStaObjectCreate(PVOID ObjectBody, IntWinStaObjectOpen(ULONG Reason,
PVOID Parent, PVOID ObjectBody,
PWSTR RemainingPath, PEPROCESS Process,
struct _OBJECT_ATTRIBUTES* ObjectAttributes); ULONG HandleCount,
ACCESS_MASK GrantedAccess);
VOID STDCALL VOID STDCALL
IntWinStaObjectDelete(PVOID DeletedObject); IntWinStaObjectDelete(PVOID DeletedObject);

View file

@ -39,12 +39,21 @@ typedef NTSTATUS (STDCALL *PW32_THREAD_CALLBACK)(
* Callbacks used for Win32 objects... this define won't be needed after the Object Manager * Callbacks used for Win32 objects... this define won't be needed after the Object Manager
* rewrite -- Alex * rewrite -- Alex
*/ */
/* TEMPORARY HACK */
typedef NTSTATUS STDCALL_FUNC typedef NTSTATUS STDCALL_FUNC
(*OBJECT_CREATE_ROUTINE)(PVOID ObjectBody, (*OBJECT_CREATE_ROUTINE)(PVOID ObjectBody,
PVOID Parent, PVOID Parent,
PWSTR RemainingPath, PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes); struct _OBJECT_ATTRIBUTES* ObjectAttributes);
typedef NTSTATUS STDCALL_FUNC
(*OBJECT_OPEN_ROUTINE)(ULONG Reason,
PVOID ObjectBody,
PEPROCESS Process,
ULONG HandleCount,
ACCESS_MASK GrantedAccess);
typedef NTSTATUS STDCALL_FUNC typedef NTSTATUS STDCALL_FUNC
(*OBJECT_PARSE_ROUTINE)(PVOID Object, (*OBJECT_PARSE_ROUTINE)(PVOID Object,
PVOID *NextObject, PVOID *NextObject,
@ -61,7 +70,7 @@ typedef PVOID STDCALL_FUNC
ULONG Attributes); ULONG Attributes);
typedef struct _W32_OBJECT_CALLBACK { typedef struct _W32_OBJECT_CALLBACK {
OBJECT_CREATE_ROUTINE WinStaCreate; OBJECT_OPEN_ROUTINE WinStaCreate;
OBJECT_PARSE_ROUTINE WinStaParse; OBJECT_PARSE_ROUTINE WinStaParse;
OBJECT_DELETE_ROUTINE WinStaDelete; OBJECT_DELETE_ROUTINE WinStaDelete;
OBJECT_FIND_ROUTINE WinStaFind; OBJECT_FIND_ROUTINE WinStaFind;
@ -309,7 +318,7 @@ DllMain (
/* /*
* Register Object Manager Callbacks * Register Object Manager Callbacks
*/ */
Win32kObjectCallbacks.WinStaCreate = IntWinStaObjectCreate; Win32kObjectCallbacks.WinStaCreate = IntWinStaObjectOpen;
Win32kObjectCallbacks.WinStaParse = IntWinStaObjectParse; Win32kObjectCallbacks.WinStaParse = IntWinStaObjectParse;
Win32kObjectCallbacks.WinStaDelete = IntWinStaObjectDelete; Win32kObjectCallbacks.WinStaDelete = IntWinStaObjectDelete;
Win32kObjectCallbacks.WinStaFind = IntWinStaObjectFind; Win32kObjectCallbacks.WinStaFind = IntWinStaObjectFind;

View file

@ -77,6 +77,7 @@ IntDesktopObjectCreate(PVOID ObjectBody,
PDESKTOP_OBJECT Desktop = (PDESKTOP_OBJECT)ObjectBody; PDESKTOP_OBJECT Desktop = (PDESKTOP_OBJECT)ObjectBody;
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
DPRINT("Creating desktop (0x%X) Name (%S)\n", Desktop, RemainingPath);
if (RemainingPath == NULL) if (RemainingPath == NULL)
{ {
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -89,7 +90,7 @@ IntDesktopObjectCreate(PVOID ObjectBody,
RtlInitUnicodeString(&UnicodeString, (RemainingPath + 1)); RtlInitUnicodeString(&UnicodeString, (RemainingPath + 1));
DPRINT("Creating desktop (0x%X) Name (%wZ)\n", Desktop, &UnicodeString);
KeInitializeSpinLock(&Desktop->Lock); KeInitializeSpinLock(&Desktop->Lock);
InitializeListHead(&Desktop->ShellHookWindows); InitializeListHead(&Desktop->ShellHookWindows);

View file

@ -84,51 +84,31 @@ CleanupWindowStationImpl(VOID)
NTSTATUS NTSTATUS
STDCALL STDCALL
IntWinStaObjectCreate(PVOID ObjectBody, IntWinStaObjectOpen(ULONG Reason,
PVOID Parent, PVOID ObjectBody,
PWSTR RemainingPath, PEPROCESS Process,
struct _OBJECT_ATTRIBUTES* ObjectAttributes) ULONG HandleCount,
ACCESS_MASK GrantedAccess)
{ {
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)ObjectBody; PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)ObjectBody;
UNICODE_STRING UnicodeString;
NTSTATUS Status; NTSTATUS Status;
if (RemainingPath == NULL) if (Reason == ObCreateHandle)
{
return STATUS_SUCCESS;
}
if (wcschr((RemainingPath + 1), '\\') != NULL)
{
return STATUS_UNSUCCESSFUL;
}
RtlInitUnicodeString(&UnicodeString, (RemainingPath + 1));
DPRINT("Creating window station (0x%X) Name (%wZ)\n", WinSta, &UnicodeString);
Status = RtlCreateUnicodeString(&WinSta->Name, UnicodeString.Buffer);
if (!NT_SUCCESS(Status))
{ {
return Status; DPRINT("Creating window station (0x%X)\n", WinSta);
}
KeInitializeSpinLock(&WinSta->Lock); KeInitializeSpinLock(&WinSta->Lock);
InitializeListHead(&WinSta->DesktopListHead); InitializeListHead(&WinSta->DesktopListHead);
WinSta->AtomTable = NULL; WinSta->AtomTable = NULL;
Status = RtlCreateAtomTable(37, &WinSta->AtomTable); Status = RtlCreateAtomTable(37, &WinSta->AtomTable);
if (!NT_SUCCESS(Status))
{
RtlFreeUnicodeString(&WinSta->Name);
return Status;
}
WinSta->SystemMenuTemplate = (HANDLE)0; WinSta->SystemMenuTemplate = (HANDLE)0;
DPRINT("Window station successfully created. Name (%wZ)\n", &WinSta->Name); DPRINT("Window station successfully created.\n");
}
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -508,6 +488,8 @@ NtUserCreateWindowStation(
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
return 0; return 0;
} }
WindowStationObject->Name = *lpszWindowStationName;
Status = ObInsertObject( Status = ObInsertObject(
(PVOID)WindowStationObject, (PVOID)WindowStationObject,
@ -519,7 +501,7 @@ NtUserCreateWindowStation(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("Failed creating window station (%wZ)\n", &WindowStationName); DPRINT1("Failed creating window station (%wZ)\n", &WindowStationName);
ExFreePool(WindowStationName.Buffer); ExFreePool(WindowStationName.Buffer);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
ObDereferenceObject(WindowStationObject); ObDereferenceObject(WindowStationObject);
@ -575,9 +557,8 @@ NtUserCreateWindowStation(
/* FIXME: Complain more loudly? */ /* FIXME: Complain more loudly? */
} }
DPRINT("Window station successfully created (%wZ)\n", &WindowStationName); DPRINT("Window station successfully created (%wZ)\n", lpszWindowStationName);
ExFreePool(WindowStationName.Buffer); ExFreePool(WindowStationName.Buffer);
return WindowStation; return WindowStation;
} }