mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
More user work
svn path=/trunk/; revision=2567
This commit is contained in:
parent
c4a09186d3
commit
8dff4a88dc
20 changed files with 874 additions and 890 deletions
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
/* $Id: rw.c,v 1.36 2002/01/15 21:54:51 hbirr Exp $
|
/* $Id: rw.c,v 1.37 2002/01/27 01:11:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -309,6 +309,7 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
ULONG TempLength;
|
ULONG TempLength;
|
||||||
LARGE_INTEGER FileOffset;
|
LARGE_INTEGER FileOffset;
|
||||||
IO_STATUS_BLOCK IoStatus;
|
IO_STATUS_BLOCK IoStatus;
|
||||||
|
ULONG BytesDone;
|
||||||
|
|
||||||
/* PRECONDITION */
|
/* PRECONDITION */
|
||||||
assert (DeviceExt != NULL);
|
assert (DeviceExt != NULL);
|
||||||
|
@ -317,90 +318,93 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
assert (FileObject->FsContext2 != NULL);
|
assert (FileObject->FsContext2 != NULL);
|
||||||
|
|
||||||
DPRINT("VfatReadFile(DeviceExt %x, FileObject %x, Buffer %x, "
|
DPRINT("VfatReadFile(DeviceExt %x, FileObject %x, Buffer %x, "
|
||||||
"Length %d, ReadOffset 0x%x)\n", DeviceExt, FileObject, Buffer,
|
"Length %d, ReadOffset 0x%x)\n", DeviceExt, FileObject, Buffer,
|
||||||
Length, ReadOffset);
|
Length, ReadOffset);
|
||||||
|
|
||||||
*LengthRead = 0;
|
*LengthRead = 0;
|
||||||
|
|
||||||
Ccb = (PVFATCCB)FileObject->FsContext2;
|
Ccb = (PVFATCCB)FileObject->FsContext2;
|
||||||
Fcb = Ccb->pFcb;
|
Fcb = Ccb->pFcb;
|
||||||
|
|
||||||
// Is this a read of the FAT ?
|
/* Is this a read of the FAT? */
|
||||||
if (Fcb->Flags & FCB_IS_FAT)
|
if (Fcb->Flags & FCB_IS_FAT)
|
||||||
{
|
|
||||||
if (!NoCache)
|
|
||||||
{
|
{
|
||||||
DbgPrint ("Cached FAT read outside from VFATFS.SYS\n");
|
if (!NoCache)
|
||||||
KeBugCheck (0);
|
{
|
||||||
}
|
DbgPrint ("Cached FAT read outside from VFATFS.SYS\n");
|
||||||
if (ReadOffset >= Fcb->RFCB.FileSize.QuadPart || ReadOffset % BLOCKSIZE != 0 || Length % BLOCKSIZE != 0)
|
KeBugCheck (0);
|
||||||
{
|
}
|
||||||
DbgPrint ("Start or end of FAT read is not on a sector boundary\n");
|
if (ReadOffset >= Fcb->RFCB.FileSize.QuadPart ||
|
||||||
KeBugCheck (0);
|
ReadOffset % BLOCKSIZE != 0 || Length % BLOCKSIZE != 0)
|
||||||
}
|
{
|
||||||
if (ReadOffset + Length > Fcb->RFCB.FileSize.QuadPart)
|
DbgPrint ("Start or end of FAT read is not on a sector boundary\n");
|
||||||
{
|
KeBugCheck (0);
|
||||||
Length = Fcb->RFCB.FileSize.QuadPart - ReadOffset;
|
}
|
||||||
}
|
if (ReadOffset + Length > Fcb->RFCB.FileSize.QuadPart)
|
||||||
|
{
|
||||||
|
Length = Fcb->RFCB.FileSize.QuadPart - ReadOffset;
|
||||||
|
}
|
||||||
|
|
||||||
Status = VfatReadSectors(DeviceExt->StorageDevice,
|
Status = VfatReadSectors(DeviceExt->StorageDevice,
|
||||||
DeviceExt->FATStart + ReadOffset / BLOCKSIZE, Length / BLOCKSIZE, Buffer);
|
DeviceExt->FATStart + ReadOffset / BLOCKSIZE,
|
||||||
if (NT_SUCCESS(Status))
|
Length / BLOCKSIZE, Buffer);
|
||||||
{
|
if (NT_SUCCESS(Status))
|
||||||
*LengthRead = Length;
|
{
|
||||||
|
*LengthRead = Length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT1("FAT reading failed, Status %x\n", Status);
|
||||||
|
}
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
DPRINT1("FAT reading failed, Status %x\n", Status);
|
|
||||||
}
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the first cluster
|
* Find the first cluster
|
||||||
*/
|
*/
|
||||||
FirstCluster = CurrentCluster = vfatDirEntryGetFirstCluster (DeviceExt, &Fcb->entry);
|
FirstCluster = CurrentCluster =
|
||||||
|
vfatDirEntryGetFirstCluster (DeviceExt, &Fcb->entry);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Truncate the read if necessary
|
* Truncate the read if necessary
|
||||||
*/
|
*/
|
||||||
if (!(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY))
|
if (!(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
{
|
|
||||||
if (ReadOffset >= Fcb->entry.FileSize)
|
|
||||||
{
|
{
|
||||||
return (STATUS_END_OF_FILE);
|
if (ReadOffset >= Fcb->entry.FileSize)
|
||||||
|
{
|
||||||
|
return (STATUS_END_OF_FILE);
|
||||||
|
}
|
||||||
|
if ((ReadOffset + Length) > Fcb->entry.FileSize)
|
||||||
|
{
|
||||||
|
Length = Fcb->entry.FileSize - ReadOffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((ReadOffset + Length) > Fcb->entry.FileSize)
|
|
||||||
{
|
|
||||||
Length = Fcb->entry.FileSize - ReadOffset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FirstCluster == 1)
|
if (FirstCluster == 1)
|
||||||
{
|
|
||||||
// root directory of FAT12 od FAT16
|
|
||||||
if (ReadOffset + Length > DeviceExt->rootDirectorySectors * BLOCKSIZE)
|
|
||||||
{
|
{
|
||||||
Length = DeviceExt->rootDirectorySectors * BLOCKSIZE - ReadOffset;
|
/* root directory of FAT12 or FAT16 */
|
||||||
}
|
if (ReadOffset + Length > DeviceExt->rootDirectorySectors * BLOCKSIZE)
|
||||||
|
{
|
||||||
|
Length = DeviceExt->rootDirectorySectors * BLOCKSIZE - ReadOffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// using the Cc-interface if possible
|
/* Using the Cc-interface if possible. */
|
||||||
if (!NoCache)
|
if (!NoCache)
|
||||||
{
|
{
|
||||||
FileOffset.QuadPart = ReadOffset;
|
FileOffset.QuadPart = ReadOffset;
|
||||||
CcCopyRead(FileObject, &FileOffset, Length, TRUE, Buffer, &IoStatus);
|
CcCopyRead(FileObject, &FileOffset, Length, TRUE, Buffer, &IoStatus);
|
||||||
*LengthRead = IoStatus.Information;
|
*LengthRead = IoStatus.Information;
|
||||||
return IoStatus.Status;
|
return IoStatus.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the cluster to start the read from
|
* Find the cluster to start the read from
|
||||||
*/
|
*/
|
||||||
if (Ccb->LastCluster > 0 && ReadOffset > Ccb->LastOffset)
|
if (Ccb->LastCluster > 0 && ReadOffset > Ccb->LastOffset)
|
||||||
{
|
{
|
||||||
CurrentCluster = Ccb->LastCluster;
|
CurrentCluster = Ccb->LastCluster;
|
||||||
}
|
}
|
||||||
Status = OffsetToCluster(DeviceExt,
|
Status = OffsetToCluster(DeviceExt,
|
||||||
Fcb,
|
Fcb,
|
||||||
FirstCluster,
|
FirstCluster,
|
||||||
|
@ -408,72 +412,83 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
&CurrentCluster,
|
&CurrentCluster,
|
||||||
FALSE);
|
FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* If the read doesn't begin on a chunk boundary then we need special
|
* If the read doesn't begin on a chunk boundary then we need special
|
||||||
* handling
|
* handling
|
||||||
*/
|
*/
|
||||||
if ((ReadOffset % DeviceExt->BytesPerCluster) != 0 )
|
if ((ReadOffset % DeviceExt->BytesPerCluster) != 0 )
|
||||||
{
|
|
||||||
TempLength = min (Length, DeviceExt->BytesPerCluster - (ReadOffset % DeviceExt->BytesPerCluster));
|
|
||||||
Ccb->LastCluster = CurrentCluster;
|
|
||||||
Ccb->LastOffset = ROUND_DOWN(ReadOffset, DeviceExt->BytesPerCluster);
|
|
||||||
Status = VfatReadCluster(DeviceExt, Fcb, FirstCluster, &CurrentCluster,
|
|
||||||
Buffer, ReadOffset % DeviceExt->BytesPerCluster,
|
|
||||||
TempLength);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
(*LengthRead) = (*LengthRead) + TempLength;
|
TempLength = min (Length, DeviceExt->BytesPerCluster -
|
||||||
Length = Length - TempLength;
|
(ReadOffset % DeviceExt->BytesPerCluster));
|
||||||
Buffer = Buffer + TempLength;
|
Ccb->LastCluster = CurrentCluster;
|
||||||
ReadOffset = ReadOffset + TempLength;
|
Ccb->LastOffset = ROUND_DOWN(ReadOffset, DeviceExt->BytesPerCluster);
|
||||||
}
|
Status = VfatReadCluster(DeviceExt, Fcb, FirstCluster, &CurrentCluster,
|
||||||
|
Buffer,
|
||||||
|
ReadOffset % DeviceExt->BytesPerCluster,
|
||||||
|
TempLength);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
(*LengthRead) = (*LengthRead) + TempLength;
|
||||||
|
Length = Length - TempLength;
|
||||||
|
Buffer = Buffer + TempLength;
|
||||||
|
ReadOffset = ReadOffset + TempLength;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Length >= DeviceExt->BytesPerCluster && CurrentCluster != 0xffffffff && NT_SUCCESS(Status))
|
while (Length >= DeviceExt->BytesPerCluster &&
|
||||||
{
|
CurrentCluster != 0xffffffff && NT_SUCCESS(Status))
|
||||||
StartCluster = CurrentCluster;
|
|
||||||
ClusterCount = 0;
|
|
||||||
// search for continous clusters
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
ClusterCount++;
|
StartCluster = CurrentCluster;
|
||||||
Status = NextCluster(DeviceExt, Fcb, FirstCluster, &CurrentCluster, FALSE);
|
ClusterCount = 0;
|
||||||
}
|
BytesDone = 0;
|
||||||
while (StartCluster + ClusterCount == CurrentCluster && NT_SUCCESS(Status) &&
|
/* Search for continous clusters. */
|
||||||
Length - ClusterCount * DeviceExt->BytesPerCluster >= DeviceExt->BytesPerCluster);
|
do
|
||||||
DPRINT("Count %d, Start %x Next %x\n", ClusterCount, StartCluster, CurrentCluster);
|
{
|
||||||
Ccb->LastCluster = StartCluster + (ClusterCount - 1);
|
ClusterCount++;
|
||||||
Ccb->LastOffset = ReadOffset + (ClusterCount - 1) * DeviceExt->BytesPerCluster;
|
BytesDone += DeviceExt->BytesPerCluster;
|
||||||
|
Status = NextCluster(DeviceExt, Fcb, FirstCluster, &CurrentCluster,
|
||||||
|
FALSE);
|
||||||
|
}
|
||||||
|
while (StartCluster + ClusterCount == CurrentCluster &&
|
||||||
|
NT_SUCCESS(Status) &&
|
||||||
|
Length - BytesDone >= DeviceExt->BytesPerCluster);
|
||||||
|
|
||||||
Status = VfatRawReadCluster(DeviceExt, FirstCluster, Buffer, StartCluster, ClusterCount);
|
DPRINT("Count %d, Start %x Next %x\n", ClusterCount, StartCluster,
|
||||||
if (NT_SUCCESS(Status))
|
CurrentCluster);
|
||||||
{
|
Ccb->LastCluster = StartCluster + (ClusterCount - 1);
|
||||||
ClusterCount *= DeviceExt->BytesPerCluster;
|
Ccb->LastOffset = ReadOffset +
|
||||||
(*LengthRead) = (*LengthRead) + ClusterCount;
|
(ClusterCount - 1) * DeviceExt->BytesPerCluster;
|
||||||
Buffer += ClusterCount;
|
|
||||||
Length -= ClusterCount;
|
Status = VfatRawReadCluster(DeviceExt, FirstCluster, Buffer,
|
||||||
ReadOffset += ClusterCount;
|
StartCluster, ClusterCount);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ClusterCount *= DeviceExt->BytesPerCluster;
|
||||||
|
(*LengthRead) = (*LengthRead) + ClusterCount;
|
||||||
|
Buffer += ClusterCount;
|
||||||
|
Length -= ClusterCount;
|
||||||
|
ReadOffset += ClusterCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* If the read doesn't end on a chunk boundary then we need special
|
* If the read doesn't end on a chunk boundary then we need special
|
||||||
* handling
|
* handling
|
||||||
*/
|
*/
|
||||||
if (Length > 0 && CurrentCluster != 0xffffffff && NT_SUCCESS(Status))
|
if (Length > 0 && CurrentCluster != 0xffffffff && NT_SUCCESS(Status))
|
||||||
{
|
|
||||||
Ccb->LastCluster = CurrentCluster;
|
|
||||||
Ccb->LastOffset = ReadOffset + DeviceExt->BytesPerCluster;
|
|
||||||
|
|
||||||
Status = VfatReadCluster(DeviceExt, Fcb, FirstCluster, &CurrentCluster,
|
|
||||||
Buffer, 0, Length);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
(*LengthRead) = (*LengthRead) + Length;
|
Ccb->LastCluster = CurrentCluster;
|
||||||
|
Ccb->LastOffset = ReadOffset + DeviceExt->BytesPerCluster;
|
||||||
|
|
||||||
|
Status = VfatReadCluster(DeviceExt, Fcb, FirstCluster, &CurrentCluster,
|
||||||
|
Buffer, 0, Length);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
(*LengthRead) = (*LengthRead) + Length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,82 +896,91 @@ NTSTATUS vfatExtendSpace (PDEVICE_EXTENSION pDeviceExt, PFILE_OBJECT pFileObject
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS VfatRead(PVFAT_IRP_CONTEXT IrpContext)
|
NTSTATUS
|
||||||
|
VfatRead(PVFAT_IRP_CONTEXT IrpContext)
|
||||||
{
|
{
|
||||||
PVFATFCB Fcb;
|
PVFATFCB Fcb;
|
||||||
PVFATCCB Ccb;
|
PVFATCCB Ccb;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
ULONG ReadLength;
|
ULONG ReadLength;
|
||||||
ULONG ReturnedReadLength = 0;
|
ULONG ReturnedReadLength = 0;
|
||||||
LARGE_INTEGER ReadOffset;
|
LARGE_INTEGER ReadOffset;
|
||||||
PVOID Buffer;
|
PVOID Buffer;
|
||||||
|
|
||||||
DPRINT ("VfatRead(IrpContext %x)\n", IrpContext);
|
DPRINT ("VfatRead(IrpContext %x)\n", IrpContext);
|
||||||
assert (IrpContext);
|
assert (IrpContext);
|
||||||
Ccb = (PVFATCCB) IrpContext->FileObject->FsContext2;
|
Ccb = (PVFATCCB) IrpContext->FileObject->FsContext2;
|
||||||
assert (Ccb);
|
assert (Ccb);
|
||||||
Fcb = Ccb->pFcb;
|
Fcb = Ccb->pFcb;
|
||||||
assert (Fcb);
|
assert (Fcb);
|
||||||
|
|
||||||
if (IrpContext->Irp->Flags & IRP_PAGING_IO)
|
if (IrpContext->Irp->Flags & IRP_PAGING_IO)
|
||||||
{
|
{
|
||||||
if (!ExAcquireResourceSharedLite(&Fcb->PagingIoResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
|
if (!ExAcquireResourceSharedLite(&Fcb->PagingIoResource,
|
||||||
|
IrpContext->Flags & IRPCONTEXT_CANWAIT))
|
||||||
{
|
{
|
||||||
return VfatQueueRequest (IrpContext);
|
return VfatQueueRequest (IrpContext);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!ExAcquireResourceSharedLite(&Fcb->MainResource,
|
||||||
|
IrpContext->Flags & IRPCONTEXT_CANWAIT))
|
||||||
|
{
|
||||||
|
return VfatQueueRequest (IrpContext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
ReadLength = IrpContext->Stack->Parameters.Read.Length;
|
||||||
|
ReadOffset = IrpContext->Stack->Parameters.Read.ByteOffset;
|
||||||
|
Buffer = MmGetSystemAddressForMdl (IrpContext->Irp->MdlAddress);
|
||||||
|
|
||||||
|
/* fail if file is a directory and no paged read */
|
||||||
|
if (Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY &&
|
||||||
|
!(IrpContext->Irp->Flags & IRP_PAGING_IO))
|
||||||
{
|
{
|
||||||
if (!ExAcquireResourceSharedLite(&Fcb->MainResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
|
Status = STATUS_FILE_IS_A_DIRECTORY;
|
||||||
{
|
|
||||||
return VfatQueueRequest (IrpContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
ReadLength = IrpContext->Stack->Parameters.Read.Length;
|
{
|
||||||
ReadOffset = IrpContext->Stack->Parameters.Read.ByteOffset;
|
BOOLEAN NoCache;
|
||||||
Buffer = MmGetSystemAddressForMdl (IrpContext->Irp->MdlAddress);
|
NoCache = IrpContext->FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING
|
||||||
|
|| IrpContext->Irp->Flags & IRP_PAGING_IO;
|
||||||
/* fail if file is a directory and no paged read */
|
|
||||||
if (Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY && !(IrpContext->Irp->Flags & IRP_PAGING_IO))
|
|
||||||
{
|
|
||||||
Status = STATUS_FILE_IS_A_DIRECTORY;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Status = VfatReadFile (IrpContext->DeviceExt, IrpContext->FileObject,
|
Status = VfatReadFile (IrpContext->DeviceExt, IrpContext->FileObject,
|
||||||
Buffer, ReadLength, ReadOffset.u.LowPart, &ReturnedReadLength,
|
Buffer, ReadLength, ReadOffset.u.LowPart,
|
||||||
IrpContext->FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING
|
&ReturnedReadLength,
|
||||||
|| IrpContext->Irp->Flags & IRP_PAGING_IO);
|
NoCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IrpContext->Irp->Flags & IRP_PAGING_IO)
|
if (IrpContext->Irp->Flags & IRP_PAGING_IO)
|
||||||
{
|
{
|
||||||
ExReleaseResourceLite(&Fcb->PagingIoResource);
|
ExReleaseResourceLite(&Fcb->PagingIoResource);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExReleaseResourceLite(&Fcb->MainResource);
|
ExReleaseResourceLite(&Fcb->MainResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
if (IrpContext->FileObject->Flags & FO_SYNCHRONOUS_IO && !(IrpContext->Irp->Flags & IRP_PAGING_IO))
|
if (IrpContext->FileObject->Flags & FO_SYNCHRONOUS_IO &&
|
||||||
|
!(IrpContext->Irp->Flags & IRP_PAGING_IO))
|
||||||
{
|
{
|
||||||
IrpContext->FileObject->CurrentByteOffset.QuadPart = ReadOffset.QuadPart + ReturnedReadLength;
|
IrpContext->FileObject->CurrentByteOffset.QuadPart =
|
||||||
|
ReadOffset.QuadPart + ReturnedReadLength;
|
||||||
}
|
}
|
||||||
IrpContext->Irp->IoStatus.Information = ReturnedReadLength;
|
IrpContext->Irp->IoStatus.Information = ReturnedReadLength;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IrpContext->Irp->IoStatus.Information = 0;
|
IrpContext->Irp->IoStatus.Information = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
IrpContext->Irp->IoStatus.Status = Status;
|
IrpContext->Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
|
IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
|
||||||
VfatFreeIrpContext (IrpContext);
|
VfatFreeIrpContext (IrpContext);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS VfatWrite(PVFAT_IRP_CONTEXT IrpContext)
|
NTSTATUS VfatWrite(PVFAT_IRP_CONTEXT IrpContext)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: psfuncs.h,v 1.19 2002/01/26 21:22:48 dwelch Exp $
|
/* $Id: psfuncs.h,v 1.20 2002/01/27 01:11:22 dwelch Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _INCLUDE_DDK_PSFUNCS_H
|
#ifndef _INCLUDE_DDK_PSFUNCS_H
|
||||||
#define _INCLUDE_DDK_PSFUNCS_H
|
#define _INCLUDE_DDK_PSFUNCS_H
|
||||||
|
@ -38,7 +38,8 @@ NTSTATUS STDCALL PsCreateSystemProcess(PHANDLE ProcessHandle,
|
||||||
ACCESS_MASK DesiredAccess,
|
ACCESS_MASK DesiredAccess,
|
||||||
POBJECT_ATTRIBUTES ObjectAttributes);
|
POBJECT_ATTRIBUTES ObjectAttributes);
|
||||||
|
|
||||||
NTSTATUS STDCALL PsCreateWin32Process(PEPROCESS Process);
|
NTSTATUS STDCALL PsCreateWin32Process(struct _EPROCESS* Process);
|
||||||
|
NTSTATUS STDCALL PsCreateWin32Thread(struct _ETHREAD* Thread);
|
||||||
|
|
||||||
VOID STDCALL PsEstablishWin32Callouts(PVOID Param1,
|
VOID STDCALL PsEstablishWin32Callouts(PVOID Param1,
|
||||||
PVOID Param2,
|
PVOID Param2,
|
||||||
|
@ -70,8 +71,6 @@ BOOLEAN STDCALL PsGetVersion (PULONG MajorVersion OPTIONAL,
|
||||||
PULONG BuildNumber OPTIONAL,
|
PULONG BuildNumber OPTIONAL,
|
||||||
PUNICODE_STRING CSDVersion OPTIONAL);
|
PUNICODE_STRING CSDVersion OPTIONAL);
|
||||||
|
|
||||||
VOID STDCALL PsDispatchThread(ULONG NewThreadStatus);
|
|
||||||
|
|
||||||
LARGE_INTEGER STDCALL PsGetProcessExitTime(VOID);
|
LARGE_INTEGER STDCALL PsGetProcessExitTime(VOID);
|
||||||
BOOLEAN STDCALL PsIsThreadTerminating(struct _ETHREAD* Thread);
|
BOOLEAN STDCALL PsIsThreadTerminating(struct _ETHREAD* Thread);
|
||||||
|
|
||||||
|
|
23
reactos/include/napi/win32.h
Normal file
23
reactos/include/napi/win32.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef __INCLUDE_NAPI_WIN32_H
|
||||||
|
#define __INCLUDE_NAPI_WIN32_H
|
||||||
|
|
||||||
|
typedef struct _W32THREAD
|
||||||
|
{
|
||||||
|
PVOID MessageQueue;
|
||||||
|
} __attribute__((packed)) W32THREAD, *PW32THREAD;
|
||||||
|
|
||||||
|
typedef struct _W32PROCESS
|
||||||
|
{
|
||||||
|
FAST_MUTEX ClassListLock;
|
||||||
|
LIST_ENTRY ClassListHead;
|
||||||
|
FAST_MUTEX WindowListLock;
|
||||||
|
LIST_ENTRY WindowListHead;
|
||||||
|
struct _USER_HANDLE_TABLE* HandleTable;
|
||||||
|
} W32PROCESS, *PW32PROCESS;
|
||||||
|
|
||||||
|
PW32THREAD STDCALL
|
||||||
|
PsGetWin32Thread(VOID);
|
||||||
|
PW32PROCESS STDCALL
|
||||||
|
PsGetWin32Process(VOID);
|
||||||
|
|
||||||
|
#endif /* __INCLUDE_NAPI_WIN32_H */
|
19
reactos/include/user32/callback.h
Normal file
19
reactos/include/user32/callback.h
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef __INCLUDE_USER32_CALLBACK_H
|
||||||
|
#define __INCLUDE_USER32_CALLBACK_H
|
||||||
|
|
||||||
|
#define USER32_CALLBACK_WINDOWPROC (0)
|
||||||
|
#define USER32_CALLBACK_MAXIMUM (1)
|
||||||
|
|
||||||
|
typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
|
||||||
|
{
|
||||||
|
WNDPROC Proc;
|
||||||
|
HWND Wnd;
|
||||||
|
UINT Msg;
|
||||||
|
WPARAM wParam;
|
||||||
|
LPARAM lParam;
|
||||||
|
} WINDOWPROC_CALLBACK_ARGUMENTS, *PWINDOWPROC_CALLBACK_ARGUMENTS;
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||||
|
|
||||||
|
#endif /* __INCLUDE_USER32_CALLBACK_H */
|
|
@ -2,5 +2,5 @@
|
||||||
/sbin/modprobe loop
|
/sbin/modprobe loop
|
||||||
echo "Installing to disk."
|
echo "Installing to disk."
|
||||||
mount -t vfat /mnt/hda3/bochs/10M.vga.dos /mnt/floppy -o loop,offset=8704,rw
|
mount -t vfat /mnt/hda3/bochs/10M.vga.dos /mnt/floppy -o loop,offset=8704,rw
|
||||||
./install.sh /mnt/floppy
|
cp -rv reactos/system32 /mnt/floppy/reactos
|
||||||
umount /mnt/floppy
|
umount /mnt/floppy
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
#include <user32/callback.h>
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
|
||||||
|
@ -21,6 +22,10 @@ Init(VOID)
|
||||||
|
|
||||||
ProcessHeap = RtlGetProcessHeap();
|
ProcessHeap = RtlGetProcessHeap();
|
||||||
|
|
||||||
|
/* Set up the kernel callbacks. */
|
||||||
|
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
|
||||||
|
(PVOID)User32CallWindowProcFromKernel;
|
||||||
|
|
||||||
//ProcessWindowStation = CreateWindowStationW(L"WinStaName",0,GENERIC_ALL,NULL);
|
//ProcessWindowStation = CreateWindowStationW(L"WinStaName",0,GENERIC_ALL,NULL);
|
||||||
//Desktop = CreateDesktopA(NULL,NULL,NULL,0,0,NULL);
|
//Desktop = CreateDesktopA(NULL,NULL,NULL,0,0,NULL);
|
||||||
|
|
||||||
|
@ -41,29 +46,26 @@ Cleanup(VOID)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT
|
INT STDCALL
|
||||||
STDCALL
|
DllMain(PVOID hinstDll,
|
||||||
DllMain(
|
|
||||||
PVOID hinstDll,
|
|
||||||
ULONG dwReason,
|
ULONG dwReason,
|
||||||
PVOID reserved
|
PVOID reserved)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
D(MAX_TRACE, ("hinstDll (0x%X) dwReason (0x%X)\n", hinstDll, dwReason));
|
D(MAX_TRACE, ("hinstDll (0x%X) dwReason (0x%X)\n", hinstDll, dwReason));
|
||||||
|
|
||||||
switch (dwReason)
|
switch (dwReason)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
Init();
|
Init();
|
||||||
break;
|
break;
|
||||||
case DLL_THREAD_ATTACH:
|
case DLL_THREAD_ATTACH:
|
||||||
break;
|
break;
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
break;
|
break;
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
Cleanup();
|
Cleanup();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: window.c,v 1.3 2002/01/13 22:52:07 dwelch Exp $
|
/* $Id: window.c,v 1.4 2002/01/27 01:11:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -15,9 +15,27 @@
|
||||||
#include <user32.h>
|
#include <user32.h>
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
#include <user32/callback.h>
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
|
{
|
||||||
|
PWINDOWPROC_CALLBACK_ARGUMENTS CallbackArgs;
|
||||||
|
LRESULT Result;
|
||||||
|
|
||||||
|
CallbackArgs = (PWINDOWPROC_CALLBACK_ARGUMENTS)Arguments;
|
||||||
|
if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
|
||||||
|
{
|
||||||
|
return(STATUS_INFO_LENGTH_MISMATCH);
|
||||||
|
}
|
||||||
|
Result = CallbackArgs->Proc(CallbackArgs->Wnd, CallbackArgs->Msg,
|
||||||
|
CallbackArgs->wParam, CallbackArgs->lParam);
|
||||||
|
ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
|
||||||
|
/* Doesn't return. */
|
||||||
|
}
|
||||||
|
|
||||||
WINBOOL STDCALL
|
WINBOOL STDCALL
|
||||||
AdjustWindowRect(LPRECT lpRect,
|
AdjustWindowRect(LPRECT lpRect,
|
||||||
DWORD dwStyle,
|
DWORD dwStyle,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: ps.h,v 1.29 2002/01/26 21:21:02 dwelch Exp $
|
/* $Id: ps.h,v 1.30 2002/01/27 01:11:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* FILE: ntoskrnl/ke/kthread.c
|
* FILE: ntoskrnl/ke/kthread.c
|
||||||
* PURPOSE: Process manager definitions
|
* PURPOSE: Process manager definitions
|
||||||
|
@ -585,6 +585,9 @@ PiTimeoutThread(struct _KDPC *dpc,
|
||||||
PVOID arg1,
|
PVOID arg1,
|
||||||
PVOID arg2);
|
PVOID arg2);
|
||||||
|
|
||||||
|
VOID STDCALL
|
||||||
|
PsDispatchThread(ULONG NewThreadStatus);
|
||||||
|
|
||||||
#endif /* ASSEMBLER */
|
#endif /* ASSEMBLER */
|
||||||
|
|
||||||
#endif /* __INCLUDE_INTERNAL_PS_H */
|
#endif /* __INCLUDE_INTERNAL_PS_H */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: trap.s,v 1.11 2001/09/24 00:51:17 chorns Exp $
|
/* $Id: trap.s,v 1.12 2002/01/27 01:11:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/i386/trap.s
|
* FILE: ntoskrnl/ke/i386/trap.s
|
||||||
|
@ -139,19 +139,19 @@ _KiTrapProlog:
|
||||||
pushl $0 /* XXX: DebugEIP */
|
pushl $0 /* XXX: DebugEIP */
|
||||||
pushl $0 /* XXX: DebugEBP */
|
pushl $0 /* XXX: DebugEBP */
|
||||||
|
|
||||||
/* Load the segment registers */
|
/* Load the segment registers */
|
||||||
movl $KERNEL_DS, %ebx
|
movl $KERNEL_DS, %ebx
|
||||||
movl %ebx, %ds
|
movl %ebx, %ds
|
||||||
movl %ebx, %es
|
movl %ebx, %es
|
||||||
movl %ebx, %gs
|
movl %ebx, %gs
|
||||||
|
|
||||||
/* Set ES to kernel segment */
|
/* Set ES to kernel segment */
|
||||||
movw $KERNEL_DS,%bx
|
movw $KERNEL_DS,%bx
|
||||||
movw %bx,%es
|
movw %bx,%es
|
||||||
|
|
||||||
movl %esp, %ebx
|
movl %esp, %ebx
|
||||||
|
|
||||||
/* Save a pointer to the trap frame in the current KTHREAD */
|
/* Save a pointer to the trap frame in the current KTHREAD */
|
||||||
movl %ebx, %ss:KTHREAD_TRAP_FRAME(%edi)
|
movl %ebx, %ss:KTHREAD_TRAP_FRAME(%edi)
|
||||||
|
|
||||||
/* Call the C exception handler */
|
/* Call the C exception handler */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntoskrnl.def,v 1.125 2002/01/13 22:52:07 dwelch Exp $
|
; $Id: ntoskrnl.def,v 1.126 2002/01/27 01:11:23 dwelch Exp $
|
||||||
;
|
;
|
||||||
; reactos/ntoskrnl/ntoskrnl.def
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -551,6 +551,7 @@ NtSetSecurityObject@12
|
||||||
NtSetSystemTime@8
|
NtSetSystemTime@8
|
||||||
NtUnlockFile@20
|
NtUnlockFile@20
|
||||||
NtVdmControl@8
|
NtVdmControl@8
|
||||||
|
NtW32Call@20
|
||||||
NtWaitForSingleObject@12
|
NtWaitForSingleObject@12
|
||||||
NtWriteFile@36
|
NtWriteFile@36
|
||||||
;ObAssignSecurity@16
|
;ObAssignSecurity@16
|
||||||
|
@ -593,9 +594,12 @@ PsAssignImpersonationToken@8
|
||||||
;PsChargePoolQuota@12
|
;PsChargePoolQuota@12
|
||||||
PsCreateSystemProcess@12
|
PsCreateSystemProcess@12
|
||||||
PsCreateSystemThread@28
|
PsCreateSystemThread@28
|
||||||
|
PsCreateWin32Thread@4
|
||||||
PsCreateWin32Process@4
|
PsCreateWin32Process@4
|
||||||
PsGetWin32Thread@0
|
PsGetWin32Thread@0
|
||||||
|
PsGetWin32Process@0
|
||||||
PsEstablishWin32Callouts@24
|
PsEstablishWin32Callouts@24
|
||||||
|
PsGetCurrentProcess@0
|
||||||
PsGetCurrentProcessId@0
|
PsGetCurrentProcessId@0
|
||||||
PsGetCurrentThreadId@0
|
PsGetCurrentThreadId@0
|
||||||
PsGetCurrentThread@0
|
PsGetCurrentThread@0
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntoskrnl.edf,v 1.111 2002/01/13 22:52:07 dwelch Exp $
|
; $Id: ntoskrnl.edf,v 1.112 2002/01/27 01:11:23 dwelch Exp $
|
||||||
;
|
;
|
||||||
; reactos/ntoskrnl/ntoskrnl.def
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -551,6 +551,7 @@ NtSetSecurityObject=NtSetSecurityObject@12
|
||||||
NtSetSystemTime=NtSetSystemTime@8
|
NtSetSystemTime=NtSetSystemTime@8
|
||||||
NtUnlockFile=NtUnlockFile@20
|
NtUnlockFile=NtUnlockFile@20
|
||||||
NtVdmControl=NtVdmControl@8
|
NtVdmControl=NtVdmControl@8
|
||||||
|
NtW32Call=NtW32Call@20
|
||||||
NtWaitForSingleObject=NtWaitForSingleObject@12
|
NtWaitForSingleObject=NtWaitForSingleObject@12
|
||||||
NtWriteFile=NtWriteFile@36
|
NtWriteFile=NtWriteFile@36
|
||||||
;ObAssignSecurity=ObAssignSecurity@16
|
;ObAssignSecurity=ObAssignSecurity@16
|
||||||
|
@ -593,9 +594,12 @@ PsAssignImpersonationToken=PsAssignImpersonationToken@8
|
||||||
;PsChargePoolQuota=PsChargePoolQuota@12
|
;PsChargePoolQuota=PsChargePoolQuota@12
|
||||||
PsCreateSystemProcess=PsCreateSystemProcess@12
|
PsCreateSystemProcess=PsCreateSystemProcess@12
|
||||||
PsCreateSystemThread=PsCreateSystemThread@28
|
PsCreateSystemThread=PsCreateSystemThread@28
|
||||||
|
PsCreateWin32Thread=PsCreateWin32Thread@4
|
||||||
PsCreateWin32Process=PsCreateWin32Process@4
|
PsCreateWin32Process=PsCreateWin32Process@4
|
||||||
PsGetWin32Thread=PsGetWin32Thread@0
|
PsGetWin32Thread=PsGetWin32Thread@0
|
||||||
|
PsGetWin32Process=PsGetWin32Process@0
|
||||||
PsEstablishWin32Callouts=PsEstablishWin32Callouts@24
|
PsEstablishWin32Callouts=PsEstablishWin32Callouts@24
|
||||||
|
PsGetCurrentProcess=PsGetCurrentProcess@0
|
||||||
PsGetCurrentProcessId=PsGetCurrentProcessId@0
|
PsGetCurrentProcessId=PsGetCurrentProcessId@0
|
||||||
PsGetCurrentThreadId=PsGetCurrentThreadId@0
|
PsGetCurrentThreadId=PsGetCurrentThreadId@0
|
||||||
PsGetCurrentThread=PsGetCurrentThread@0
|
PsGetCurrentThread=PsGetCurrentThread@0
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
#include <napi/win32.h>
|
||||||
|
|
||||||
#define IS_ATOM(x) \
|
#define IS_ATOM(x) \
|
||||||
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
|
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
|
||||||
|
|
||||||
|
|
||||||
typedef struct _WNDCLASS_OBJECT
|
typedef struct _WNDCLASS_OBJECT
|
||||||
{
|
{
|
||||||
WNDCLASSEX Class;
|
WNDCLASSEX Class;
|
||||||
|
@ -15,7 +15,6 @@ typedef struct _WNDCLASS_OBJECT
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
} WNDCLASS_OBJECT, *PWNDCLASS_OBJECT;
|
} WNDCLASS_OBJECT, *PWNDCLASS_OBJECT;
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
InitClassImpl(VOID);
|
InitClassImpl(VOID);
|
||||||
|
|
||||||
|
@ -23,19 +22,17 @@ NTSTATUS
|
||||||
CleanupClassImpl(VOID);
|
CleanupClassImpl(VOID);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ClassReferenceClassByName(
|
ClassReferenceClassByName(PW32PROCESS Process,
|
||||||
PWNDCLASS_OBJECT *Class,
|
PWNDCLASS_OBJECT *Class,
|
||||||
LPWSTR ClassName);
|
LPWSTR ClassName);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ClassReferenceClassByAtom(
|
ClassReferenceClassByAtom(PWNDCLASS_OBJECT *Class,
|
||||||
PWNDCLASS_OBJECT *Class,
|
RTL_ATOM ClassAtom);
|
||||||
RTL_ATOM ClassAtom);
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ClassReferenceClassByNameOrAtom(
|
ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
|
||||||
PWNDCLASS_OBJECT *Class,
|
LPWSTR ClassNameOrAtom);
|
||||||
LPWSTR ClassNameOrAtom);
|
|
||||||
|
|
||||||
#endif /* __WIN32K_CLASS_H */
|
#endif /* __WIN32K_CLASS_H */
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ typedef struct _USER_OBJECT_HEADER
|
||||||
CSHORT Size;
|
CSHORT Size;
|
||||||
} USER_OBJECT_HEADER, *PUSER_OBJECT_HEADER;
|
} USER_OBJECT_HEADER, *PUSER_OBJECT_HEADER;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _USER_HANDLE
|
typedef struct _USER_HANDLE
|
||||||
{
|
{
|
||||||
PVOID ObjectBody;
|
PVOID ObjectBody;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: dllmain.c,v 1.22 2002/01/13 22:52:08 dwelch Exp $
|
/* $Id: dllmain.c,v 1.23 2002/01/27 01:11:24 dwelch Exp $
|
||||||
*
|
*
|
||||||
* Entry Point for win32k.sys
|
* Entry Point for win32k.sys
|
||||||
*/
|
*/
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
#include <ddk/winddi.h>
|
#include <ddk/winddi.h>
|
||||||
#include <ddk/service.h>
|
#include <ddk/service.h>
|
||||||
|
|
||||||
|
#include <napi/win32.h>
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
|
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
|
@ -50,6 +51,11 @@ DllMain (
|
||||||
|
|
||||||
DbgPrint("System services added successfully!\n");
|
DbgPrint("System services added successfully!\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register our per-process and per-thread structures.
|
||||||
|
*/
|
||||||
|
PsEstablishWin32Callouts(0, 0, 0, 0, sizeof(W32THREAD), sizeof(W32PROCESS));
|
||||||
|
|
||||||
Status = InitWindowStationImpl();
|
Status = InitWindowStationImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -71,7 +77,7 @@ DllMain (
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = InitInputImpl();
|
Status = InitInputImpl();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize input implementation.\n");
|
DbgPrint("Failed to initialize input implementation.\n");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.41 2002/01/13 22:52:08 dwelch Exp $
|
# $Id: makefile,v 1.42 2002/01/27 01:11:24 dwelch Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../..
|
PATH_TO_TOP = ../..
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ LDR_OBJECTS = ldr/loader.o
|
||||||
NTUSER_OBJECTS = ntuser/class.o ntuser/guicheck.o ntuser/hook.o \
|
NTUSER_OBJECTS = ntuser/class.o ntuser/guicheck.o ntuser/hook.o \
|
||||||
ntuser/message.o ntuser/msgqueue.o ntuser/stubs.o \
|
ntuser/message.o ntuser/msgqueue.o ntuser/stubs.o \
|
||||||
ntuser/userobj.o ntuser/window.o ntuser/winsta.o \
|
ntuser/userobj.o ntuser/window.o ntuser/winsta.o \
|
||||||
ntuser/input.o
|
ntuser/input.o ntuser/keyboard.o ntuser/callback.o
|
||||||
OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \
|
OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \
|
||||||
objects/color.o objects/coord.o objects/dc.o \
|
objects/color.o objects/coord.o objects/dc.o \
|
||||||
objects/fillshap.o objects/gdiobj.o objects/icm.o \
|
objects/fillshap.o objects/gdiobj.o objects/icm.o \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: object.c,v 1.1 2001/06/12 17:51:51 chorns Exp $
|
/* $Id: object.c,v 1.2 2002/01/27 01:11:24 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -9,65 +9,64 @@
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 06-06-2001 CSH Ported kernel object manager
|
* 06-06-2001 CSH Ported kernel object manager
|
||||||
*/
|
*/
|
||||||
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
HEADER_TO_BODY(
|
HEADER_TO_BODY(PUSER_OBJECT_HEADER ObjectHeader)
|
||||||
PUSER_OBJECT_HEADER ObjectHeader)
|
|
||||||
{
|
{
|
||||||
return (((PUSER_OBJECT_HEADER)ObjectHeader) + 1);
|
return (((PUSER_OBJECT_HEADER)ObjectHeader) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
PUSER_OBJECT_HEADER BODY_TO_HEADER(
|
PUSER_OBJECT_HEADER
|
||||||
PVOID ObjectBody)
|
BODY_TO_HEADER(PVOID ObjectBody)
|
||||||
{
|
{
|
||||||
return (((PUSER_OBJECT_HEADER)ObjectBody) - 1);
|
return (((PUSER_OBJECT_HEADER)ObjectBody) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
VOID STATIC
|
||||||
ObmpLockHandleTable(
|
ObmpLockHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||||
PUSER_HANDLE_TABLE HandleTable)
|
|
||||||
{
|
{
|
||||||
// ExAcquireFastMutex(HandleTable->ListLock);
|
ExAcquireFastMutex(HandleTable->ListLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
VOID STATIC
|
||||||
ObmpUnlockHandleTable(
|
ObmpUnlockHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||||
PUSER_HANDLE_TABLE HandleTable)
|
|
||||||
{
|
{
|
||||||
// ExReleaseFastMutex(AtomTable->ListLock);
|
ExReleaseFastMutex(HandleTable->ListLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ObmpPerformRetentionChecks(
|
ObmpPerformRetentionChecks(PUSER_OBJECT_HEADER ObjectHeader)
|
||||||
PUSER_OBJECT_HEADER ObjectHeader)
|
|
||||||
{
|
{
|
||||||
if (ObjectHeader->RefCount < 0)
|
if (ObjectHeader->RefCount < 0)
|
||||||
{
|
{
|
||||||
DbgPrint("ObjectHeader 0x%X has invalid reference count (%d)\n",
|
DbgPrint("ObjectHeader 0x%X has invalid reference count (%d)\n",
|
||||||
ObjectHeader, ObjectHeader->RefCount);
|
ObjectHeader, ObjectHeader->RefCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectHeader->HandleCount < 0)
|
if (ObjectHeader->HandleCount < 0)
|
||||||
{
|
{
|
||||||
DbgPrint("Object 0x%X has invalid handle count (%d)\n",
|
DbgPrint("Object 0x%X has invalid handle count (%d)\n",
|
||||||
ObjectHeader, ObjectHeader->HandleCount);
|
ObjectHeader, ObjectHeader->HandleCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ObjectHeader->RefCount == 0) && (ObjectHeader->HandleCount == 0))
|
if ((ObjectHeader->RefCount == 0) && (ObjectHeader->HandleCount == 0))
|
||||||
{
|
{
|
||||||
ExFreePool(ObjectHeader);
|
ExFreePool(ObjectHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PUSER_HANDLE
|
PUSER_HANDLE
|
||||||
ObmpGetObjectByHandle(
|
ObmpGetObjectByHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||||
PUSER_HANDLE_TABLE HandleTable,
|
HANDLE Handle)
|
||||||
HANDLE Handle)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Get the data structure for a handle
|
* FUNCTION: Get the data structure for a handle
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -83,25 +82,24 @@ ObmpGetObjectByHandle(
|
||||||
PUSER_HANDLE_BLOCK Block = NULL;
|
PUSER_HANDLE_BLOCK Block = NULL;
|
||||||
PLIST_ENTRY Current;
|
PLIST_ENTRY Current;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
Current = HandleTable->ListHead.Flink;
|
Current = HandleTable->ListHead.Flink;
|
||||||
|
|
||||||
for (i = 0; i < Count; i++)
|
for (i = 0; i < Count; i++)
|
||||||
{
|
|
||||||
Current = Current->Flink;
|
|
||||||
if (Current == &(HandleTable->ListHead))
|
|
||||||
{
|
{
|
||||||
return NULL;
|
Current = Current->Flink;
|
||||||
|
if (Current == &(HandleTable->ListHead))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Block = CONTAINING_RECORD(Current, USER_HANDLE_BLOCK, ListEntry);
|
Block = CONTAINING_RECORD(Current, USER_HANDLE_BLOCK, ListEntry);
|
||||||
return &(Block->Handles[Index % HANDLE_BLOCK_ENTRIES]);
|
return &(Block->Handles[Index % HANDLE_BLOCK_ENTRIES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ObmpCloseAllHandles(
|
ObmpCloseAllHandles(PUSER_HANDLE_TABLE HandleTable)
|
||||||
PUSER_HANDLE_TABLE HandleTable)
|
|
||||||
{
|
{
|
||||||
PLIST_ENTRY CurrentEntry;
|
PLIST_ENTRY CurrentEntry;
|
||||||
PUSER_HANDLE_BLOCK Current;
|
PUSER_HANDLE_BLOCK Current;
|
||||||
|
@ -109,127 +107,122 @@ ObmpCloseAllHandles(
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
ObmpLockHandleTable(HandleTable);
|
ObmpLockHandleTable(HandleTable);
|
||||||
|
|
||||||
CurrentEntry = HandleTable->ListHead.Flink;
|
CurrentEntry = HandleTable->ListHead.Flink;
|
||||||
|
|
||||||
while (CurrentEntry != &HandleTable->ListHead)
|
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;
|
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 = BODY_TO_HEADER(ObjectBody);
|
||||||
|
|
||||||
|
ObmReferenceObjectByPointer(ObjectBody, otUnknown);
|
||||||
|
ObjectHeader->HandleCount--;
|
||||||
|
Current->Handles[i].ObjectBody = NULL;
|
||||||
|
|
||||||
|
ObmpUnlockHandleTable(HandleTable);
|
||||||
|
|
||||||
|
ObmDereferenceObject(ObjectBody);
|
||||||
|
|
||||||
if (ObjectBody != NULL)
|
ObmpLockHandleTable(HandleTable);
|
||||||
{
|
CurrentEntry = &HandleTable->ListHead;
|
||||||
PUSER_OBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
break;
|
||||||
|
}
|
||||||
ObmReferenceObjectByPointer(ObjectBody, otUnknown);
|
}
|
||||||
ObjectHeader->HandleCount--;
|
|
||||||
Current->Handles[i].ObjectBody = NULL;
|
CurrentEntry = CurrentEntry->Flink;
|
||||||
|
|
||||||
ObmpUnlockHandleTable(HandleTable);
|
|
||||||
|
|
||||||
ObmDereferenceObject(ObjectBody);
|
|
||||||
|
|
||||||
ObmpLockHandleTable(HandleTable);
|
|
||||||
CurrentEntry = &HandleTable->ListHead;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentEntry = CurrentEntry->Flink;
|
|
||||||
}
|
|
||||||
|
|
||||||
ObmpUnlockHandleTable(HandleTable);
|
ObmpUnlockHandleTable(HandleTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ObmpDeleteHandleTable(
|
ObmpDeleteHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||||
PUSER_HANDLE_TABLE HandleTable)
|
|
||||||
{
|
{
|
||||||
PUSER_HANDLE_BLOCK Current;
|
PUSER_HANDLE_BLOCK Current;
|
||||||
PLIST_ENTRY CurrentEntry;
|
PLIST_ENTRY CurrentEntry;
|
||||||
|
|
||||||
ObmpCloseAllHandles(HandleTable);
|
ObmpCloseAllHandles(HandleTable);
|
||||||
|
|
||||||
CurrentEntry = RemoveHeadList(&HandleTable->ListHead);
|
CurrentEntry = RemoveHeadList(&HandleTable->ListHead);
|
||||||
|
|
||||||
while (CurrentEntry != &HandleTable->ListHead)
|
while (CurrentEntry != &HandleTable->ListHead)
|
||||||
{
|
{
|
||||||
Current = CONTAINING_RECORD(CurrentEntry,
|
Current = CONTAINING_RECORD(CurrentEntry,
|
||||||
USER_HANDLE_BLOCK,
|
USER_HANDLE_BLOCK,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
|
|
||||||
ExFreePool(Current);
|
ExFreePool(Current);
|
||||||
|
|
||||||
CurrentEntry = RemoveHeadList(&HandleTable->ListHead);
|
CurrentEntry = RemoveHeadList(&HandleTable->ListHead);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
ObmpDeleteHandle(
|
ObmpDeleteHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||||
PUSER_HANDLE_TABLE HandleTable,
|
HANDLE Handle)
|
||||||
HANDLE Handle)
|
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER ObjectHeader;
|
PUSER_OBJECT_HEADER ObjectHeader;
|
||||||
PUSER_HANDLE Entry;
|
PUSER_HANDLE Entry;
|
||||||
PVOID ObjectBody;
|
PVOID ObjectBody;
|
||||||
|
|
||||||
ObmpLockHandleTable(HandleTable);
|
ObmpLockHandleTable(HandleTable);
|
||||||
|
|
||||||
Entry = ObmpGetObjectByHandle(HandleTable, Handle);
|
Entry = ObmpGetObjectByHandle(HandleTable, Handle);
|
||||||
if (Entry == NULL)
|
if (Entry == NULL)
|
||||||
{
|
{
|
||||||
ObmpUnlockHandleTable(HandleTable);
|
ObmpUnlockHandleTable(HandleTable);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectBody = Entry->ObjectBody;
|
ObjectBody = Entry->ObjectBody;
|
||||||
|
|
||||||
if (ObjectBody != NULL)
|
if (ObjectBody != NULL)
|
||||||
{
|
{
|
||||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||||
ObjectHeader->HandleCount--;
|
ObjectHeader->HandleCount--;
|
||||||
ObmReferenceObjectByPointer(ObjectBody, otUnknown);
|
ObmReferenceObjectByPointer(ObjectBody, otUnknown);
|
||||||
Entry->ObjectBody = NULL;
|
Entry->ObjectBody = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObmpUnlockHandleTable(HandleTable);
|
ObmpUnlockHandleTable(HandleTable);
|
||||||
|
|
||||||
return ObjectBody;
|
return ObjectBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ObmpInitializeObject(
|
ObmpInitializeObject(PUSER_HANDLE_TABLE HandleTable,
|
||||||
PUSER_HANDLE_TABLE HandleTable,
|
PUSER_OBJECT_HEADER ObjectHeader,
|
||||||
PUSER_OBJECT_HEADER ObjectHeader,
|
PHANDLE Handle,
|
||||||
PHANDLE Handle,
|
USER_OBJECT_TYPE ObjectType,
|
||||||
USER_OBJECT_TYPE ObjectType,
|
ULONG ObjectSize)
|
||||||
ULONG ObjectSize)
|
|
||||||
{
|
{
|
||||||
DWORD Status = STATUS_SUCCESS;
|
DWORD Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
ObjectHeader->Type = ObjectType;
|
ObjectHeader->Type = ObjectType;
|
||||||
ObjectHeader->HandleCount = 0;
|
ObjectHeader->HandleCount = 0;
|
||||||
ObjectHeader->RefCount = 1;
|
ObjectHeader->RefCount = 1;
|
||||||
ObjectHeader->Size = ObjectSize;
|
ObjectHeader->Size = ObjectSize;
|
||||||
|
|
||||||
if (Handle != NULL)
|
if (Handle != NULL)
|
||||||
{
|
{
|
||||||
Status = ObmCreateHandle(
|
Status = ObmCreateHandle(HandleTable,
|
||||||
HandleTable,
|
HEADER_TO_BODY(ObjectHeader),
|
||||||
HEADER_TO_BODY(ObjectHeader),
|
Handle);
|
||||||
Handle);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
ObmGetReferenceCount(
|
ObmGetReferenceCount(PVOID ObjectBody)
|
||||||
PVOID ObjectBody)
|
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
PUSER_OBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||||
|
|
||||||
|
@ -237,8 +230,7 @@ ObmGetReferenceCount(
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
ObmGetHandleCount(
|
ObmGetHandleCount(PVOID ObjectBody)
|
||||||
PVOID ObjectBody)
|
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
PUSER_OBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||||
|
|
||||||
|
@ -246,8 +238,7 @@ ObmGetHandleCount(
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ObmReferenceObject(
|
ObmReferenceObject(PVOID ObjectBody)
|
||||||
PVOID ObjectBody)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Increments a given object's reference count and performs
|
* FUNCTION: Increments a given object's reference count and performs
|
||||||
* retention checks
|
* retention checks
|
||||||
|
@ -256,22 +247,21 @@ ObmReferenceObject(
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER ObjectHeader;
|
PUSER_OBJECT_HEADER ObjectHeader;
|
||||||
|
|
||||||
if (!ObjectBody)
|
if (!ObjectBody)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||||
|
|
||||||
ObjectHeader->RefCount++;
|
ObjectHeader->RefCount++;
|
||||||
|
|
||||||
ObmpPerformRetentionChecks(ObjectHeader);
|
ObmpPerformRetentionChecks(ObjectHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ObmDereferenceObject(
|
ObmDereferenceObject(PVOID ObjectBody)
|
||||||
PVOID ObjectBody)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Decrements a given object's reference count and performs
|
* FUNCTION: Decrements a given object's reference count and performs
|
||||||
* retention checks
|
* retention checks
|
||||||
|
@ -280,23 +270,22 @@ ObmDereferenceObject(
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER ObjectHeader;
|
PUSER_OBJECT_HEADER ObjectHeader;
|
||||||
|
|
||||||
if (!ObjectBody)
|
if (!ObjectBody)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||||
|
|
||||||
ObjectHeader->RefCount--;
|
ObjectHeader->RefCount--;
|
||||||
|
|
||||||
ObmpPerformRetentionChecks(ObjectHeader);
|
ObmpPerformRetentionChecks(ObjectHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ObmReferenceObjectByPointer(
|
ObmReferenceObjectByPointer(PVOID ObjectBody,
|
||||||
PVOID ObjectBody,
|
USER_OBJECT_TYPE ObjectType)
|
||||||
USER_OBJECT_TYPE ObjectType)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Increments the pointer reference count for a given object
|
* FUNCTION: Increments the pointer reference count for a given object
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -306,62 +295,59 @@ ObmReferenceObjectByPointer(
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER ObjectHeader;
|
PUSER_OBJECT_HEADER ObjectHeader;
|
||||||
|
|
||||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||||
|
|
||||||
if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
|
if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectHeader->RefCount++;
|
ObjectHeader->RefCount++;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
ObmCreateObject(
|
ObmCreateObject(PUSER_HANDLE_TABLE HandleTable,
|
||||||
PUSER_HANDLE_TABLE HandleTable,
|
PHANDLE Handle,
|
||||||
PHANDLE Handle,
|
USER_OBJECT_TYPE ObjectType,
|
||||||
USER_OBJECT_TYPE ObjectType,
|
ULONG ObjectSize)
|
||||||
ULONG ObjectSize)
|
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER ObjectHeader;
|
PUSER_OBJECT_HEADER ObjectHeader;
|
||||||
PVOID ObjectBody;
|
PVOID ObjectBody;
|
||||||
DWORD Status;
|
DWORD Status;
|
||||||
|
|
||||||
ObjectHeader = (PUSER_OBJECT_HEADER)ExAllocatePool(
|
ObjectHeader = (PUSER_OBJECT_HEADER)ExAllocatePool(NonPagedPool,
|
||||||
NonPagedPool, ObjectSize + sizeof(USER_OBJECT_HEADER));
|
ObjectSize + sizeof(USER_OBJECT_HEADER));
|
||||||
if (!ObjectHeader)
|
if (!ObjectHeader)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectBody = HEADER_TO_BODY(ObjectHeader);
|
ObjectBody = HEADER_TO_BODY(ObjectHeader);
|
||||||
|
|
||||||
RtlZeroMemory(ObjectBody, ObjectSize);
|
RtlZeroMemory(ObjectBody, ObjectSize);
|
||||||
|
|
||||||
Status = ObmpInitializeObject(
|
Status = ObmpInitializeObject(HandleTable,
|
||||||
HandleTable,
|
ObjectHeader,
|
||||||
ObjectHeader,
|
Handle,
|
||||||
Handle,
|
ObjectType,
|
||||||
ObjectType,
|
ObjectSize);
|
||||||
ObjectSize);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePool(ObjectHeader);
|
ExFreePool(ObjectHeader);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ObjectBody;
|
return ObjectBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ObmCreateHandle(
|
ObmCreateHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||||
PUSER_HANDLE_TABLE HandleTable,
|
PVOID ObjectBody,
|
||||||
PVOID ObjectBody,
|
PHANDLE HandleReturn)
|
||||||
PHANDLE HandleReturn)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Add a handle referencing an object
|
* FUNCTION: Add a handle referencing an object
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -375,49 +361,50 @@ ObmCreateHandle(
|
||||||
ULONG Handle;
|
ULONG Handle;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
if (ObjectBody != NULL) {
|
if (ObjectBody != NULL)
|
||||||
BODY_TO_HEADER(ObjectBody)->HandleCount++;
|
{
|
||||||
}
|
BODY_TO_HEADER(ObjectBody)->HandleCount++;
|
||||||
|
}
|
||||||
|
|
||||||
ObmpLockHandleTable(HandleTable);
|
ObmpLockHandleTable(HandleTable);
|
||||||
|
|
||||||
Current = HandleTable->ListHead.Flink;
|
Current = HandleTable->ListHead.Flink;
|
||||||
/*
|
/*
|
||||||
* Scan through the currently allocated Handle blocks looking for a free
|
* Scan through the currently allocated Handle blocks looking for a free
|
||||||
* slot
|
* slot
|
||||||
*/
|
*/
|
||||||
while (Current != &(HandleTable->ListHead))
|
while (Current != &(HandleTable->ListHead))
|
||||||
{
|
|
||||||
PUSER_HANDLE_BLOCK Block = CONTAINING_RECORD(
|
|
||||||
Current, USER_HANDLE_BLOCK, ListEntry);
|
|
||||||
|
|
||||||
Handle = 1;
|
|
||||||
for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
|
|
||||||
{
|
{
|
||||||
if (!Block->Handles[i].ObjectBody)
|
PUSER_HANDLE_BLOCK Block =
|
||||||
{
|
CONTAINING_RECORD(Current, USER_HANDLE_BLOCK, ListEntry);
|
||||||
Block->Handles[i].ObjectBody = ObjectBody;
|
|
||||||
ObmpUnlockHandleTable(HandleTable);
|
Handle = 1;
|
||||||
*HandleReturn = (HANDLE)((Handle + i) << 2);
|
for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
|
||||||
return ERROR_SUCCESS;
|
{
|
||||||
}
|
if (!Block->Handles[i].ObjectBody)
|
||||||
}
|
{
|
||||||
|
Block->Handles[i].ObjectBody = ObjectBody;
|
||||||
|
ObmpUnlockHandleTable(HandleTable);
|
||||||
|
*HandleReturn = (HANDLE)((Handle + i) << 2);
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Handle = Handle + HANDLE_BLOCK_ENTRIES;
|
Handle = Handle + HANDLE_BLOCK_ENTRIES;
|
||||||
Current = Current->Flink;
|
Current = Current->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a new Handle block to the end of the list
|
* Add a new Handle block to the end of the list
|
||||||
*/
|
*/
|
||||||
NewBlock = (PUSER_HANDLE_BLOCK)ExAllocatePool(
|
NewBlock = (PUSER_HANDLE_BLOCK)ExAllocatePool(NonPagedPool,
|
||||||
NonPagedPool, sizeof(USER_HANDLE_BLOCK));
|
sizeof(USER_HANDLE_BLOCK));
|
||||||
if (!NewBlock)
|
if (!NewBlock)
|
||||||
{
|
{
|
||||||
*HandleReturn = (PHANDLE)NULL;
|
*HandleReturn = (PHANDLE)NULL;
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(NewBlock, sizeof(USER_HANDLE_BLOCK));
|
RtlZeroMemory(NewBlock, sizeof(USER_HANDLE_BLOCK));
|
||||||
NewBlock->Handles[0].ObjectBody = ObjectBody;
|
NewBlock->Handles[0].ObjectBody = ObjectBody;
|
||||||
InsertTailList(&HandleTable->ListHead, &NewBlock->ListEntry);
|
InsertTailList(&HandleTable->ListHead, &NewBlock->ListEntry);
|
||||||
|
@ -428,11 +415,10 @@ ObmCreateHandle(
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ObmReferenceObjectByHandle(
|
ObmReferenceObjectByHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||||
PUSER_HANDLE_TABLE HandleTable,
|
HANDLE Handle,
|
||||||
HANDLE Handle,
|
USER_OBJECT_TYPE ObjectType,
|
||||||
USER_OBJECT_TYPE ObjectType,
|
PVOID* Object)
|
||||||
PVOID* Object)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Increments the reference count for an object and returns a
|
* FUNCTION: Increments the reference count for an object and returns a
|
||||||
* pointer to its body
|
* pointer to its body
|
||||||
|
@ -447,64 +433,60 @@ ObmReferenceObjectByHandle(
|
||||||
PUSER_OBJECT_HEADER ObjectHeader;
|
PUSER_OBJECT_HEADER ObjectHeader;
|
||||||
PUSER_HANDLE UserHandle;
|
PUSER_HANDLE UserHandle;
|
||||||
PVOID ObjectBody;
|
PVOID ObjectBody;
|
||||||
|
|
||||||
ObmpLockHandleTable(HandleTable);
|
ObmpLockHandleTable(HandleTable);
|
||||||
|
|
||||||
UserHandle = ObmpGetObjectByHandle(HandleTable, Handle);
|
UserHandle = ObmpGetObjectByHandle(HandleTable, Handle);
|
||||||
|
|
||||||
if ((UserHandle == NULL) || (UserHandle->ObjectBody == NULL))
|
if ((UserHandle == NULL) || (UserHandle->ObjectBody == NULL))
|
||||||
{
|
{
|
||||||
ObmpUnlockHandleTable(HandleTable);
|
ObmpUnlockHandleTable(HandleTable);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectBody = UserHandle->ObjectBody;
|
ObjectBody = UserHandle->ObjectBody;
|
||||||
ObmReferenceObjectByPointer(ObjectBody, ObjectType);
|
ObmReferenceObjectByPointer(ObjectBody, ObjectType);
|
||||||
|
|
||||||
ObmpUnlockHandleTable(HandleTable);
|
ObmpUnlockHandleTable(HandleTable);
|
||||||
|
|
||||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||||
|
|
||||||
if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
|
if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
|
||||||
{
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Object = ObjectBody;
|
*Object = ObjectBody;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ObmCloseHandle(
|
ObmCloseHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||||
PUSER_HANDLE_TABLE HandleTable,
|
HANDLE Handle)
|
||||||
HANDLE Handle)
|
|
||||||
{
|
{
|
||||||
PVOID ObjectBody;
|
PVOID ObjectBody;
|
||||||
|
|
||||||
ObjectBody = ObmpDeleteHandle(HandleTable, Handle);
|
ObjectBody = ObmpDeleteHandle(HandleTable, Handle);
|
||||||
if (ObjectBody == NULL)
|
if (ObjectBody == NULL)
|
||||||
{
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObmDereferenceObject(ObjectBody);
|
ObmDereferenceObject(ObjectBody);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ObmInitializeHandleTable(
|
ObmInitializeHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||||
PUSER_HANDLE_TABLE HandleTable)
|
|
||||||
{
|
{
|
||||||
InitializeListHead(&HandleTable->ListHead);
|
InitializeListHead(&HandleTable->ListHead);
|
||||||
//ExInitializeFastMutex(HandleTable->ListLock);
|
ExInitializeFastMutex(HandleTable->ListLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ObmFreeHandleTable(
|
ObmFreeHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||||
PUSER_HANDLE_TABLE HandleTable)
|
|
||||||
{
|
{
|
||||||
ObmpDeleteHandleTable(HandleTable);
|
ObmpDeleteHandleTable(HandleTable);
|
||||||
}
|
}
|
||||||
|
@ -514,21 +496,20 @@ ObmCreateHandleTable(VOID)
|
||||||
{
|
{
|
||||||
PUSER_HANDLE_TABLE HandleTable;
|
PUSER_HANDLE_TABLE HandleTable;
|
||||||
|
|
||||||
HandleTable = (PUSER_HANDLE_TABLE)ExAllocatePool(
|
HandleTable = (PUSER_HANDLE_TABLE)ExAllocatePool(NonPagedPool,
|
||||||
NonPagedPool, sizeof(USER_HANDLE_TABLE));
|
sizeof(USER_HANDLE_TABLE));
|
||||||
if (!HandleTable)
|
if (!HandleTable)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObmInitializeHandleTable(HandleTable);
|
ObmInitializeHandleTable(HandleTable);
|
||||||
|
|
||||||
return HandleTable;
|
return HandleTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ObmDestroyHandleTable(
|
ObmDestroyHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||||
PUSER_HANDLE_TABLE HandleTable)
|
|
||||||
{
|
{
|
||||||
ObmFreeHandleTable(HandleTable);
|
ObmFreeHandleTable(HandleTable);
|
||||||
ExFreePool(HandleTable);
|
ExFreePool(HandleTable);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: class.c,v 1.3 2002/01/13 22:52:08 dwelch Exp $
|
/* $Id: class.c,v 1.4 2002/01/27 01:11:24 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -12,28 +12,20 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
#include <win32k/userobj.h>
|
#include <napi/win32.h>
|
||||||
#include <include/class.h>
|
#include <include/class.h>
|
||||||
#include <include/error.h>
|
#include <include/error.h>
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
|
#include <include/object.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
|
||||||
|
|
||||||
/* List of system classes */
|
|
||||||
static LIST_ENTRY SystemClassListHead;
|
|
||||||
static FAST_MUTEX SystemClassListLock;
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
InitClassImpl(VOID)
|
InitClassImpl(VOID)
|
||||||
{
|
{
|
||||||
ExInitializeFastMutex(&SystemClassListLock);
|
|
||||||
InitializeListHead(&SystemClassListHead);
|
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,85 +36,35 @@ CleanupClassImpl(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
NTSTATUS
|
||||||
CliFindClassByName(PWNDCLASS_OBJECT* Class,
|
ClassReferenceClassByName(PW32PROCESS Process,
|
||||||
LPWSTR ClassName,
|
PWNDCLASS_OBJECT* Class,
|
||||||
PLIST_ENTRY ListHead)
|
LPWSTR ClassName)
|
||||||
{
|
{
|
||||||
PWNDCLASS_OBJECT Current;
|
PWNDCLASS_OBJECT Current;
|
||||||
PLIST_ENTRY CurrentEntry;
|
PLIST_ENTRY CurrentEntry;
|
||||||
|
|
||||||
ExAcquireFastMutexUnsafe (&SystemClassListLock);
|
ExAcquireFastMutexUnsafe (&Process->ClassListLock);
|
||||||
CurrentEntry = ListHead->Flink;
|
CurrentEntry = Process->ClassListHead.Flink;
|
||||||
while (CurrentEntry != ListHead)
|
while (CurrentEntry != &Process->ClassListHead)
|
||||||
{
|
{
|
||||||
Current = CONTAINING_RECORD(CurrentEntry, WNDCLASS_OBJECT, ListEntry);
|
Current = CONTAINING_RECORD(CurrentEntry, WNDCLASS_OBJECT, ListEntry);
|
||||||
|
|
||||||
if (_wcsicmp(ClassName, Current->Class.lpszClassName) == 0)
|
if (_wcsicmp(ClassName, Current->Class.lpszClassName) == 0)
|
||||||
{
|
{
|
||||||
*Class = Current;
|
*Class = Current;
|
||||||
ExReleaseFastMutexUnsafe (&SystemClassListLock);
|
ObmReferenceObject(Current);
|
||||||
|
ExReleaseFastMutexUnsafe (&Process->ClassListLock);
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentEntry = CurrentEntry->Flink;
|
CurrentEntry = CurrentEntry->Flink;
|
||||||
}
|
}
|
||||||
ExReleaseFastMutexUnsafe (&SystemClassListLock);
|
ExReleaseFastMutexUnsafe (&Process->ClassListLock);
|
||||||
|
|
||||||
return(STATUS_NOT_FOUND);
|
return(STATUS_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
CliReferenceClassByNameWinSta(PWINSTATION_OBJECT WinStaObject,
|
|
||||||
PWNDCLASS_OBJECT *Class,
|
|
||||||
LPWSTR ClassName)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (NT_SUCCESS(CliFindClassByName(Class, ClassName, &LocalClassListHead)))
|
|
||||||
{
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NT_SUCCESS(CliFindClassByName(Class, ClassName, &GlobalClassListHead)))
|
|
||||||
{
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return(CliFindClassByName(Class, ClassName, &SystemClassListHead));
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
ClassReferenceClassByName(PWNDCLASS_OBJECT *Class,
|
|
||||||
LPWSTR ClassName)
|
|
||||||
{
|
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
if (!ClassName)
|
|
||||||
{
|
|
||||||
return(STATUS_INVALID_PARAMETER);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
|
||||||
KernelMode,
|
|
||||||
0,
|
|
||||||
&WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
|
||||||
PROCESS_WINDOW_STATION());
|
|
||||||
return(STATUS_UNSUCCESSFUL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = CliReferenceClassByNameWinSta(WinStaObject,
|
|
||||||
Class,
|
|
||||||
ClassName);
|
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ClassReferenceClassByAtom(PWNDCLASS_OBJECT *Class,
|
ClassReferenceClassByAtom(PWNDCLASS_OBJECT *Class,
|
||||||
RTL_ATOM ClassAtom)
|
RTL_ATOM ClassAtom)
|
||||||
|
@ -156,9 +98,9 @@ ClassReferenceClassByAtom(PWNDCLASS_OBJECT *Class,
|
||||||
&ClassName[0],
|
&ClassName[0],
|
||||||
&ClassNameLength);
|
&ClassNameLength);
|
||||||
|
|
||||||
Status = CliReferenceClassByNameWinSta(WinStaObject,
|
Status = ClassReferenceClassByName(PsGetWin32Process(),
|
||||||
Class,
|
Class,
|
||||||
&ClassName[0]);
|
&ClassName[0]);
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
|
|
||||||
|
@ -178,7 +120,8 @@ ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = ClassReferenceClassByName(Class, ClassNameOrAtom);
|
Status = ClassReferenceClassByName(PsGetWin32Process(), Class,
|
||||||
|
ClassNameOrAtom);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -190,11 +133,11 @@ ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserGetClassInfo(DWORD Unknown0,
|
NtUserGetClassInfo(IN LPWSTR ClassName,
|
||||||
DWORD Unknown1,
|
IN ULONG InfoClass,
|
||||||
DWORD Unknown2,
|
OUT PVOID Info,
|
||||||
DWORD Unknown3,
|
IN ULONG InfoLength,
|
||||||
DWORD Unknown4)
|
OUT PULONG ReturnedLength)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
|
@ -220,6 +163,13 @@ NtUserGetWOWClass(DWORD Unknown0,
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RTL_ATOM STDCALL
|
||||||
|
NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
||||||
|
BOOL bUnicodeClass,
|
||||||
|
DWORD Unknown2,
|
||||||
|
DWORD Unknown3,
|
||||||
|
DWORD Unknown4,
|
||||||
|
DWORD Unknown5)
|
||||||
/*
|
/*
|
||||||
* FUNCTION:
|
* FUNCTION:
|
||||||
* Registers a new class with the window manager
|
* Registers a new class with the window manager
|
||||||
|
@ -230,13 +180,6 @@ NtUserGetWOWClass(DWORD Unknown0,
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
* Atom identifying the new class
|
* Atom identifying the new class
|
||||||
*/
|
*/
|
||||||
RTL_ATOM STDCALL
|
|
||||||
NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
|
||||||
BOOL bUnicodeClass,
|
|
||||||
DWORD Unknown2,
|
|
||||||
DWORD Unknown3,
|
|
||||||
DWORD Unknown4,
|
|
||||||
DWORD Unknown5)
|
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
PWNDCLASS_OBJECT ClassObject;
|
PWNDCLASS_OBJECT ClassObject;
|
||||||
|
@ -244,7 +187,7 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
||||||
RTL_ATOM Atom;
|
RTL_ATOM Atom;
|
||||||
WORD objectSize;
|
WORD objectSize;
|
||||||
LPTSTR namePtr;
|
LPTSTR namePtr;
|
||||||
|
|
||||||
DPRINT("About to open window station handle (0x%X)\n",
|
DPRINT("About to open window station handle (0x%X)\n",
|
||||||
PROCESS_WINDOW_STATION());
|
PROCESS_WINDOW_STATION());
|
||||||
|
|
||||||
|
@ -275,7 +218,7 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
||||||
objectSize = sizeof(WNDCLASS_OBJECT) +
|
objectSize = sizeof(WNDCLASS_OBJECT) +
|
||||||
(lpwcx->lpszMenuName != 0 ? wcslen (lpwcx->lpszMenuName) + 1 : 0) +
|
(lpwcx->lpszMenuName != 0 ? wcslen (lpwcx->lpszMenuName) + 1 : 0) +
|
||||||
wcslen (lpwcx->lpszClassName) + 1;
|
wcslen (lpwcx->lpszClassName) + 1;
|
||||||
ClassObject = USEROBJ_AllocObject (objectSize, UO_CLASS_MAGIC);
|
ClassObject = ObmCreateObject(NULL, NULL, otClass, objectSize);
|
||||||
if (ClassObject == 0)
|
if (ClassObject == 0)
|
||||||
{
|
{
|
||||||
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
|
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
|
||||||
|
@ -297,16 +240,9 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
||||||
}
|
}
|
||||||
ClassObject->Class.lpszClassName = namePtr;
|
ClassObject->Class.lpszClassName = namePtr;
|
||||||
wcscpy (namePtr, lpwcx->lpszClassName);
|
wcscpy (namePtr, lpwcx->lpszClassName);
|
||||||
|
ExAcquireFastMutex(&PsGetWin32Process()->ClassListLock);
|
||||||
if (lpwcx->style & CS_GLOBALCLASS)
|
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
|
||||||
{
|
ExReleaseFastMutex(&PsGetWin32Process()->ClassListLock);
|
||||||
InsertTailList(&SystemClassListHead, &ClassObject->ListEntry);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* FIXME: Put on local list */
|
|
||||||
InsertTailList(&SystemClassListHead, &ClassObject->ListEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: guicheck.c,v 1.3 2002/01/13 22:52:08 dwelch Exp $
|
/* $Id: guicheck.c,v 1.4 2002/01/27 01:11:24 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -20,6 +20,8 @@
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
#include <include/guicheck.h>
|
#include <include/guicheck.h>
|
||||||
#include <include/msgqueue.h>
|
#include <include/msgqueue.h>
|
||||||
|
#include <include/object.h>
|
||||||
|
#include <napi/win32.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
@ -29,10 +31,22 @@
|
||||||
VOID
|
VOID
|
||||||
W32kGuiCheck(VOID)
|
W32kGuiCheck(VOID)
|
||||||
{
|
{
|
||||||
if (PsGetWin32Thread()->MessageQueue != NULL)
|
if (PsGetWin32Process() == NULL)
|
||||||
return;
|
{
|
||||||
|
PsCreateWin32Process(PsGetCurrentProcess());
|
||||||
PsGetWin32Thread()->MessageQueue = MsqCreateMessageQueue();
|
|
||||||
|
InitializeListHead(&PsGetWin32Process()->ClassListHead);
|
||||||
|
ExInitializeFastMutex(&PsGetWin32Process()->ClassListLock);
|
||||||
|
InitializeListHead(&PsGetWin32Process()->WindowListHead);
|
||||||
|
ExInitializeFastMutex(&PsGetWin32Process()->WindowListLock);
|
||||||
|
PsGetWin32Process()->HandleTable = ObmCreateHandleTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PsGetWin32Thread() == NULL)
|
||||||
|
{
|
||||||
|
PsCreateWin32Thread(PsGetCurrentThread());
|
||||||
|
PsGetWin32Thread()->MessageQueue = MsqCreateMessageQueue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: message.c,v 1.3 2002/01/13 22:52:08 dwelch Exp $
|
/* $Id: message.c,v 1.4 2002/01/27 01:11:24 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
#include <include/error.h>
|
#include <include/error.h>
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
|
#include <include/callback.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
@ -40,11 +41,43 @@ W32kCleanupMessageImpl(VOID)
|
||||||
|
|
||||||
|
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
NtUserDispatchMessage(LPMSG lpmsg)
|
NtUserDispatchMessage(LPMSG lpMsg)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
LRESULT Result;
|
||||||
|
|
||||||
return 0;
|
/* Process timer messages. */
|
||||||
|
if (lpMsg->message == WM_TIMER)
|
||||||
|
{
|
||||||
|
if (lpMsg->lParam)
|
||||||
|
{
|
||||||
|
/* FIXME: Call hooks. */
|
||||||
|
|
||||||
|
/* FIXME: Check for continuing validity of timer. */
|
||||||
|
|
||||||
|
return(W32kCallWindowProc((WNDPROC)lpMsg->lParam,
|
||||||
|
lpMsg->hwnd,
|
||||||
|
lpMsg->message,
|
||||||
|
lpMsg->wParam,
|
||||||
|
0 /* GetTickCount() */));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME: Check for valid window handle, valid window and valid window
|
||||||
|
* proc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* FIXME: Check for paint message. */
|
||||||
|
|
||||||
|
Result = W32kCallWindowProc(NULL /* WndProc */,
|
||||||
|
lpMsg->hwnd,
|
||||||
|
lpMsg->message,
|
||||||
|
lpMsg->wParam,
|
||||||
|
lpMsg->lParam);
|
||||||
|
|
||||||
|
/* FIXME: Check for paint message. */
|
||||||
|
|
||||||
|
return(Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
|
@ -68,6 +101,7 @@ NtUserGetMessage(LPMSG lpMsg,
|
||||||
PUSER_MESSAGE Message;
|
PUSER_MESSAGE Message;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Initialize the thread's win32 state if necessary. */
|
||||||
W32kGuiCheck();
|
W32kGuiCheck();
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
|
@ -211,15 +245,6 @@ NtUserSendNotifyMessage(HWND hWnd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
|
||||||
NtUserTranslateMessage(LPMSG lpMsg,
|
|
||||||
DWORD Unknown1)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserWaitMessage(VOID)
|
NtUserWaitMessage(VOID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: window.c,v 1.4 2002/01/13 22:52:08 dwelch Exp $
|
/* $Id: window.c,v 1.5 2002/01/27 01:11:24 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -8,9 +8,11 @@
|
||||||
* REVISION HISTORY:
|
* REVISION HISTORY:
|
||||||
* 06-06-2001 CSH Created
|
* 06-06-2001 CSH Created
|
||||||
*/
|
*/
|
||||||
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
#include <win32k/userobj.h>
|
#include <include/object.h>
|
||||||
#include <include/guicheck.h>
|
#include <include/guicheck.h>
|
||||||
#include <include/window.h>
|
#include <include/window.h>
|
||||||
#include <include/class.h>
|
#include <include/class.h>
|
||||||
|
@ -20,71 +22,56 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* FUNCTIONS *****************************************************************/
|
||||||
/* List of windows created by the process */
|
|
||||||
static LIST_ENTRY WindowListHead;
|
|
||||||
static FAST_MUTEX WindowListLock;
|
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
InitWindowImpl(VOID)
|
InitWindowImpl(VOID)
|
||||||
{
|
{
|
||||||
ExInitializeFastMutex(&WindowListLock);
|
return(STATUS_SUCCESS);
|
||||||
InitializeListHead(&WindowListHead);
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CleanupWindowImpl(VOID)
|
CleanupWindowImpl(VOID)
|
||||||
{
|
{
|
||||||
//ExReleaseFastMutex(&WindowListLock);
|
return(STATUS_SUCCESS);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserAlterWindowStyle(DWORD Unknown0,
|
||||||
NtUserAlterWindowStyle(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2)
|
||||||
DWORD Unknown1,
|
|
||||||
DWORD Unknown2)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserChildWindowFromPointEx(DWORD Unknown0,
|
||||||
NtUserChildWindowFromPointEx(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3)
|
||||||
DWORD Unknown2,
|
|
||||||
DWORD Unknown3)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND
|
HWND STDCALL
|
||||||
STDCALL
|
NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
NtUserCreateWindowEx(
|
PUNICODE_STRING lpClassName,
|
||||||
DWORD dwExStyle,
|
PUNICODE_STRING lpWindowName,
|
||||||
PUNICODE_STRING lpClassName,
|
DWORD dwStyle,
|
||||||
PUNICODE_STRING lpWindowName,
|
LONG x,
|
||||||
DWORD dwStyle,
|
LONG y,
|
||||||
LONG x,
|
LONG nWidth,
|
||||||
LONG y,
|
LONG nHeight,
|
||||||
LONG nWidth,
|
HWND hWndParent,
|
||||||
LONG nHeight,
|
HMENU hMenu,
|
||||||
HWND hWndParent,
|
HINSTANCE hInstance,
|
||||||
HMENU hMenu,
|
LPVOID lpParam,
|
||||||
HINSTANCE hInstance,
|
DWORD Unknown12)
|
||||||
LPVOID lpParam,
|
|
||||||
DWORD Unknown12)
|
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
PWNDCLASS_OBJECT ClassObject;
|
PWNDCLASS_OBJECT ClassObject;
|
||||||
|
@ -97,44 +84,44 @@ NtUserCreateWindowEx(
|
||||||
|
|
||||||
Status = ClassReferenceClassByNameOrAtom(&ClassObject, lpClassName->Buffer);
|
Status = ClassReferenceClassByNameOrAtom(&ClassObject, lpClassName->Buffer);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return (HWND)0;
|
return (HWND)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RtlCreateUnicodeString(&WindowName, lpWindowName->Buffer))
|
if (!RtlCreateUnicodeString(&WindowName, lpWindowName->Buffer))
|
||||||
{
|
{
|
||||||
ObmDereferenceObject(ClassObject);
|
ObmDereferenceObject(ClassObject);
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
return (HWND)0;
|
return (HWND)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ValidateWindowStationHandle(
|
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||||
PROCESS_WINDOW_STATION(),
|
KernelMode,
|
||||||
KernelMode,
|
0,
|
||||||
0,
|
&WinStaObject);
|
||||||
&WinStaObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&WindowName);
|
RtlFreeUnicodeString(&WindowName);
|
||||||
ObmDereferenceObject(ClassObject);
|
ObmDereferenceObject(ClassObject);
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||||
PROCESS_WINDOW_STATION());
|
PROCESS_WINDOW_STATION());
|
||||||
return (HWND)0;
|
return (HWND)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowObject = (PWINDOW_OBJECT) USEROBJ_AllocObject (sizeof (WINDOW_OBJECT),
|
WindowObject = (PWINDOW_OBJECT)
|
||||||
UO_WINDOW_MAGIC);
|
ObmCreateObject(PsGetWin32Process()->HandleTable, &Handle, otWindow,
|
||||||
|
sizeof(WINDOW_OBJECT));
|
||||||
if (!WindowObject)
|
if (!WindowObject)
|
||||||
{
|
{
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
ObmDereferenceObject(ClassObject);
|
ObmDereferenceObject(ClassObject);
|
||||||
RtlFreeUnicodeString(&WindowName);
|
RtlFreeUnicodeString(&WindowName);
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
return (HWND)0;
|
return (HWND)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
|
|
||||||
WindowObject->Class = ClassObject;
|
WindowObject->Class = ClassObject;
|
||||||
WindowObject->ExStyle = dwExStyle;
|
WindowObject->ExStyle = dwExStyle;
|
||||||
WindowObject->Style = dwStyle;
|
WindowObject->Style = dwStyle;
|
||||||
|
@ -149,124 +136,115 @@ NtUserCreateWindowEx(
|
||||||
|
|
||||||
RtlInitUnicodeString(&WindowObject->WindowName, WindowName.Buffer);
|
RtlInitUnicodeString(&WindowObject->WindowName, WindowName.Buffer);
|
||||||
|
|
||||||
ExAcquireFastMutexUnsafe (&WindowListLock);
|
ExAcquireFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
|
||||||
InsertTailList (&WindowListHead, &WindowObject->ListEntry);
|
InsertTailList (&PsGetWin32Process()->WindowListHead,
|
||||||
ExReleaseFastMutexUnsafe (&WindowListLock);
|
&WindowObject->ListEntry);
|
||||||
|
ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
|
||||||
|
|
||||||
return (HWND)Handle;
|
return (HWND)Handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserDeferWindowPos(DWORD Unknown0,
|
||||||
NtUserDeferWindowPos(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3,
|
||||||
DWORD Unknown2,
|
DWORD Unknown4,
|
||||||
DWORD Unknown3,
|
DWORD Unknown5,
|
||||||
DWORD Unknown4,
|
DWORD Unknown6,
|
||||||
DWORD Unknown5,
|
DWORD Unknown7)
|
||||||
DWORD Unknown6,
|
|
||||||
DWORD Unknown7)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserDestroyWindow(DWORD Unknown0)
|
||||||
NtUserDestroyWindow(
|
|
||||||
DWORD Unknown0)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserEndDeferWindowPosEx(DWORD Unknown0,
|
||||||
NtUserEndDeferWindowPosEx(
|
DWORD Unknown1)
|
||||||
DWORD Unknown0,
|
{
|
||||||
DWORD Unknown1)
|
UNIMPLEMENTED
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD STDCALL
|
||||||
|
NtUserFillWindow(DWORD Unknown0,
|
||||||
|
DWORD Unknown1,
|
||||||
|
DWORD Unknown2,
|
||||||
|
DWORD Unknown3)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
HWND STDCALL
|
||||||
STDCALL
|
NtUserFindWindowEx(HWND hwndParent,
|
||||||
NtUserFillWindow(
|
HWND hwndChildAfter,
|
||||||
DWORD Unknown0,
|
PUNICODE_STRING ucClassName,
|
||||||
DWORD Unknown1,
|
PUNICODE_STRING ucWindowName,
|
||||||
DWORD Unknown2,
|
DWORD Unknown4)
|
||||||
DWORD Unknown3)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
NTSTATUS status;
|
||||||
|
HWND windowHandle;
|
||||||
return 0;
|
PWINDOW_OBJECT windowObject;
|
||||||
}
|
PLIST_ENTRY currentEntry;
|
||||||
|
PWNDCLASS_OBJECT classObject;
|
||||||
HWND
|
|
||||||
STDCALL
|
|
||||||
NtUserFindWindowEx(
|
|
||||||
HWND hwndParent,
|
|
||||||
HWND hwndChildAfter,
|
|
||||||
PUNICODE_STRING ucClassName,
|
|
||||||
PUNICODE_STRING ucWindowName,
|
|
||||||
DWORD Unknown4)
|
|
||||||
{
|
|
||||||
NTSTATUS status;
|
|
||||||
HWND windowHandle;
|
|
||||||
PWINDOW_OBJECT windowObject;
|
|
||||||
PLIST_ENTRY currentEntry;
|
|
||||||
PWNDCLASS_OBJECT classObject;
|
|
||||||
|
|
||||||
W32kGuiCheck();
|
W32kGuiCheck();
|
||||||
|
|
||||||
status = ClassReferenceClassByNameOrAtom(&classObject, ucClassName->Buffer);
|
status = ClassReferenceClassByNameOrAtom(&classObject, ucClassName->Buffer);
|
||||||
if (!NT_SUCCESS(status))
|
if (!NT_SUCCESS(status))
|
||||||
{
|
|
||||||
return (HWND)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExAcquireFastMutexUnsafe (&WindowListLock);
|
|
||||||
currentEntry = WindowListHead.Flink;
|
|
||||||
while (currentEntry != &WindowListHead)
|
|
||||||
{
|
|
||||||
windowObject = CONTAINING_RECORD (currentEntry, WINDOW_OBJECT, ListEntry);
|
|
||||||
|
|
||||||
if (classObject == windowObject->Class &&
|
|
||||||
RtlCompareUnicodeString (ucWindowName, &windowObject->WindowName, TRUE) == 0)
|
|
||||||
{
|
{
|
||||||
windowHandle = (HWND) UserObjectHeaderToHandle (
|
return (HWND)0;
|
||||||
UserObjectBodyToHeader (windowObject));
|
|
||||||
ExReleaseFastMutexUnsafe (&WindowListLock);
|
|
||||||
ObDereferenceObject (classObject);
|
|
||||||
|
|
||||||
return windowHandle;
|
|
||||||
}
|
}
|
||||||
currentEntry = currentEntry->Flink;
|
|
||||||
}
|
|
||||||
ExReleaseFastMutexUnsafe (&WindowListLock);
|
|
||||||
|
|
||||||
ObDereferenceObject (classObject);
|
ExAcquireFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
|
||||||
|
currentEntry = PsGetWin32Process()->WindowListHead.Flink;
|
||||||
|
while (currentEntry != &PsGetWin32Process()->WindowListHead)
|
||||||
|
{
|
||||||
|
windowObject = CONTAINING_RECORD (currentEntry, WINDOW_OBJECT,
|
||||||
|
ListEntry);
|
||||||
|
|
||||||
|
if (classObject == windowObject->Class &&
|
||||||
|
RtlCompareUnicodeString (ucWindowName, &windowObject->WindowName,
|
||||||
|
TRUE) == 0)
|
||||||
|
{
|
||||||
|
ObmCreateHandle(PsGetWin32Process()->HandleTable,
|
||||||
|
windowObject,
|
||||||
|
&windowHandle);
|
||||||
|
ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
|
||||||
|
ObmDereferenceObject (classObject);
|
||||||
|
|
||||||
|
return windowHandle;
|
||||||
|
}
|
||||||
|
currentEntry = currentEntry->Flink;
|
||||||
|
}
|
||||||
|
ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
|
||||||
|
|
||||||
|
ObmDereferenceObject (classObject);
|
||||||
|
|
||||||
return (HWND)0;
|
return (HWND)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserFlashWindowEx(DWORD Unknown0)
|
||||||
NtUserFlashWindowEx(
|
|
||||||
DWORD Unknown0)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
|
||||||
NtUserGetForegroundWindow(VOID)
|
NtUserGetForegroundWindow(VOID)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
@ -274,20 +252,17 @@ NtUserGetForegroundWindow(VOID)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserGetInternalWindowPos(DWORD Unknown0,
|
||||||
NtUserGetInternalWindowPos(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2)
|
||||||
DWORD Unknown1,
|
|
||||||
DWORD Unknown2)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
|
||||||
NtUserGetOpenClipboardWindow(VOID)
|
NtUserGetOpenClipboardWindow(VOID)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
@ -295,320 +270,275 @@ NtUserGetOpenClipboardWindow(VOID)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserGetWindowDC(DWORD Unknown0)
|
||||||
NtUserGetWindowDC(
|
|
||||||
DWORD Unknown0)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserGetWindowPlacement(DWORD Unknown0,
|
||||||
NtUserGetWindowPlacement(
|
DWORD Unknown1)
|
||||||
DWORD Unknown0,
|
|
||||||
DWORD Unknown1)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserInternalGetWindowText(DWORD Unknown0,
|
||||||
NtUserInternalGetWindowText(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2)
|
||||||
DWORD Unknown1,
|
|
||||||
DWORD Unknown2)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserLockWindowUpdate(DWORD Unknown0)
|
||||||
NtUserLockWindowUpdate(
|
|
||||||
DWORD Unknown0)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserMoveWindow(DWORD Unknown0,
|
||||||
NtUserMoveWindow(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3,
|
||||||
DWORD Unknown2,
|
DWORD Unknown4,
|
||||||
DWORD Unknown3,
|
DWORD Unknown5)
|
||||||
DWORD Unknown4,
|
|
||||||
DWORD Unknown5)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserQueryWindow(DWORD Unknown0,
|
||||||
NtUserQueryWindow(
|
DWORD Unknown1)
|
||||||
DWORD Unknown0,
|
|
||||||
DWORD Unknown1)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserRealChildWindowFromPoint(DWORD Unknown0,
|
||||||
NtUserRealChildWindowFromPoint(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2)
|
||||||
DWORD Unknown1,
|
|
||||||
DWORD Unknown2)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserRedrawWindow(DWORD Unknown0,
|
||||||
NtUserRedrawWindow(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3)
|
||||||
DWORD Unknown2,
|
|
||||||
DWORD Unknown3)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserRegisterWindowMessage(DWORD Unknown0)
|
||||||
NtUserRegisterWindowMessage(
|
|
||||||
DWORD Unknown0)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserScrollWindowEx(DWORD Unknown0,
|
||||||
NtUserScrollWindowEx(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3,
|
||||||
DWORD Unknown2,
|
DWORD Unknown4,
|
||||||
DWORD Unknown3,
|
DWORD Unknown5,
|
||||||
DWORD Unknown4,
|
DWORD Unknown6,
|
||||||
DWORD Unknown5,
|
DWORD Unknown7)
|
||||||
DWORD Unknown6,
|
|
||||||
DWORD Unknown7)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetActiveWindow(DWORD Unknown0)
|
||||||
NtUserSetActiveWindow(
|
|
||||||
DWORD Unknown0)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetImeOwnerWindow(DWORD Unknown0,
|
||||||
NtUserSetImeOwnerWindow(
|
DWORD Unknown1)
|
||||||
DWORD Unknown0,
|
|
||||||
DWORD Unknown1)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetInternalWindowPos(DWORD Unknown0,
|
||||||
NtUserSetInternalWindowPos(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3)
|
||||||
DWORD Unknown2,
|
|
||||||
DWORD Unknown3)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetLayeredWindowAttributes(DWORD Unknown0,
|
||||||
NtUserSetLayeredWindowAttributes(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3)
|
||||||
DWORD Unknown2,
|
|
||||||
DWORD Unknown3)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetLogonNotifyWindow(DWORD Unknown0)
|
||||||
NtUserSetLogonNotifyWindow(
|
|
||||||
DWORD Unknown0)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetShellWindowEx(DWORD Unknown0,
|
||||||
NtUserSetShellWindowEx(
|
DWORD Unknown1)
|
||||||
DWORD Unknown0,
|
|
||||||
DWORD Unknown1)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetWindowFNID(DWORD Unknown0,
|
||||||
NtUserSetWindowFNID(
|
DWORD Unknown1)
|
||||||
DWORD Unknown0,
|
|
||||||
DWORD Unknown1)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetWindowLong(DWORD Unknown0,
|
||||||
NtUserSetWindowLong(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3)
|
||||||
DWORD Unknown2,
|
|
||||||
DWORD Unknown3)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetWindowPlacement(DWORD Unknown0,
|
||||||
NtUserSetWindowPlacement(
|
DWORD Unknown1)
|
||||||
DWORD Unknown0,
|
|
||||||
DWORD Unknown1)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetWindowPos(DWORD Unknown0,
|
||||||
NtUserSetWindowPos(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3,
|
||||||
DWORD Unknown2,
|
DWORD Unknown4,
|
||||||
DWORD Unknown3,
|
DWORD Unknown5,
|
||||||
DWORD Unknown4,
|
DWORD Unknown6)
|
||||||
DWORD Unknown5,
|
|
||||||
DWORD Unknown6)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetWindowRgn(DWORD Unknown0,
|
||||||
NtUserSetWindowRgn(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2)
|
||||||
DWORD Unknown1,
|
|
||||||
DWORD Unknown2)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserSetWindowWord(DWORD Unknown0,
|
||||||
NtUserSetWindowWord(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2)
|
||||||
DWORD Unknown1,
|
|
||||||
DWORD Unknown2)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL STDCALL
|
||||||
STDCALL
|
NtUserShowWindow(HWND hWnd,
|
||||||
NtUserShowWindow(
|
LONG nCmdShow)
|
||||||
HWND hWnd,
|
|
||||||
LONG nCmdShow)
|
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
W32kGuiCheck();
|
W32kGuiCheck();
|
||||||
|
|
||||||
WindowObject = USEROBJ_HandleToPtr (hWnd, UO_WINDOW_MAGIC);
|
Status = ObmReferenceObjectByHandle(PsGetWin32Process()->HandleTable,
|
||||||
|
hWnd,
|
||||||
|
otWindow,
|
||||||
|
(PVOID*)&WindowObject);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserShowWindowAsync(DWORD Unknown0,
|
||||||
NtUserShowWindowAsync(
|
DWORD Unknown1)
|
||||||
DWORD Unknown0,
|
|
||||||
DWORD Unknown1)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserUpdateLayeredWindow(DWORD Unknown0,
|
||||||
NtUserUpdateLayeredWindow(
|
DWORD Unknown1,
|
||||||
DWORD Unknown0,
|
DWORD Unknown2,
|
||||||
DWORD Unknown1,
|
DWORD Unknown3,
|
||||||
DWORD Unknown2,
|
DWORD Unknown4,
|
||||||
DWORD Unknown3,
|
DWORD Unknown5,
|
||||||
DWORD Unknown4,
|
DWORD Unknown6,
|
||||||
DWORD Unknown5,
|
DWORD Unknown7,
|
||||||
DWORD Unknown6,
|
DWORD Unknown8)
|
||||||
DWORD Unknown7,
|
|
||||||
DWORD Unknown8)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserWindowFromPoint(DWORD Unknown0,
|
||||||
NtUserWindowFromPoint(
|
DWORD Unknown1)
|
||||||
DWORD Unknown0,
|
|
||||||
DWORD Unknown1)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue