mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -309,6 +309,7 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
ULONG TempLength;
|
||||
LARGE_INTEGER FileOffset;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
ULONG BytesDone;
|
||||
|
||||
/* PRECONDITION */
|
||||
assert (DeviceExt != NULL);
|
||||
|
@ -317,90 +318,93 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
assert (FileObject->FsContext2 != NULL);
|
||||
|
||||
DPRINT("VfatReadFile(DeviceExt %x, FileObject %x, Buffer %x, "
|
||||
"Length %d, ReadOffset 0x%x)\n", DeviceExt, FileObject, Buffer,
|
||||
Length, ReadOffset);
|
||||
"Length %d, ReadOffset 0x%x)\n", DeviceExt, FileObject, Buffer,
|
||||
Length, ReadOffset);
|
||||
|
||||
*LengthRead = 0;
|
||||
|
||||
Ccb = (PVFATCCB)FileObject->FsContext2;
|
||||
Fcb = Ccb->pFcb;
|
||||
|
||||
// Is this a read of the FAT ?
|
||||
/* Is this a read of the FAT? */
|
||||
if (Fcb->Flags & FCB_IS_FAT)
|
||||
{
|
||||
if (!NoCache)
|
||||
{
|
||||
DbgPrint ("Cached FAT read outside from VFATFS.SYS\n");
|
||||
KeBugCheck (0);
|
||||
}
|
||||
if (ReadOffset >= Fcb->RFCB.FileSize.QuadPart || ReadOffset % BLOCKSIZE != 0 || Length % BLOCKSIZE != 0)
|
||||
{
|
||||
DbgPrint ("Start or end of FAT read is not on a sector boundary\n");
|
||||
KeBugCheck (0);
|
||||
}
|
||||
if (ReadOffset + Length > Fcb->RFCB.FileSize.QuadPart)
|
||||
{
|
||||
Length = Fcb->RFCB.FileSize.QuadPart - ReadOffset;
|
||||
}
|
||||
if (!NoCache)
|
||||
{
|
||||
DbgPrint ("Cached FAT read outside from VFATFS.SYS\n");
|
||||
KeBugCheck (0);
|
||||
}
|
||||
if (ReadOffset >= Fcb->RFCB.FileSize.QuadPart ||
|
||||
ReadOffset % BLOCKSIZE != 0 || Length % BLOCKSIZE != 0)
|
||||
{
|
||||
DbgPrint ("Start or end of FAT read is not on a sector boundary\n");
|
||||
KeBugCheck (0);
|
||||
}
|
||||
if (ReadOffset + Length > Fcb->RFCB.FileSize.QuadPart)
|
||||
{
|
||||
Length = Fcb->RFCB.FileSize.QuadPart - ReadOffset;
|
||||
}
|
||||
|
||||
Status = VfatReadSectors(DeviceExt->StorageDevice,
|
||||
DeviceExt->FATStart + ReadOffset / BLOCKSIZE, Length / BLOCKSIZE, Buffer);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
*LengthRead = Length;
|
||||
Status = VfatReadSectors(DeviceExt->StorageDevice,
|
||||
DeviceExt->FATStart + ReadOffset / BLOCKSIZE,
|
||||
Length / BLOCKSIZE, Buffer);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
*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
|
||||
*/
|
||||
FirstCluster = CurrentCluster = vfatDirEntryGetFirstCluster (DeviceExt, &Fcb->entry);
|
||||
FirstCluster = CurrentCluster =
|
||||
vfatDirEntryGetFirstCluster (DeviceExt, &Fcb->entry);
|
||||
|
||||
/*
|
||||
* Truncate the read if necessary
|
||||
*/
|
||||
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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
FileOffset.QuadPart = ReadOffset;
|
||||
CcCopyRead(FileObject, &FileOffset, Length, TRUE, Buffer, &IoStatus);
|
||||
*LengthRead = IoStatus.Information;
|
||||
return IoStatus.Status;
|
||||
}
|
||||
{
|
||||
FileOffset.QuadPart = ReadOffset;
|
||||
CcCopyRead(FileObject, &FileOffset, Length, TRUE, Buffer, &IoStatus);
|
||||
*LengthRead = IoStatus.Information;
|
||||
return IoStatus.Status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the cluster to start the read from
|
||||
*/
|
||||
if (Ccb->LastCluster > 0 && ReadOffset > Ccb->LastOffset)
|
||||
{
|
||||
CurrentCluster = Ccb->LastCluster;
|
||||
}
|
||||
{
|
||||
CurrentCluster = Ccb->LastCluster;
|
||||
}
|
||||
Status = OffsetToCluster(DeviceExt,
|
||||
Fcb,
|
||||
FirstCluster,
|
||||
|
@ -408,72 +412,83 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
&CurrentCluster,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
/*
|
||||
* If the read doesn't begin on a chunk boundary then we need special
|
||||
* handling
|
||||
*/
|
||||
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;
|
||||
Length = Length - TempLength;
|
||||
Buffer = Buffer + TempLength;
|
||||
ReadOffset = ReadOffset + TempLength;
|
||||
}
|
||||
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;
|
||||
Length = Length - TempLength;
|
||||
Buffer = Buffer + TempLength;
|
||||
ReadOffset = ReadOffset + TempLength;
|
||||
}
|
||||
}
|
||||
|
||||
while (Length >= DeviceExt->BytesPerCluster && CurrentCluster != 0xffffffff && NT_SUCCESS(Status))
|
||||
{
|
||||
StartCluster = CurrentCluster;
|
||||
ClusterCount = 0;
|
||||
// search for continous clusters
|
||||
do
|
||||
while (Length >= DeviceExt->BytesPerCluster &&
|
||||
CurrentCluster != 0xffffffff && NT_SUCCESS(Status))
|
||||
{
|
||||
ClusterCount++;
|
||||
Status = NextCluster(DeviceExt, Fcb, FirstCluster, &CurrentCluster, FALSE);
|
||||
}
|
||||
while (StartCluster + ClusterCount == CurrentCluster && NT_SUCCESS(Status) &&
|
||||
Length - ClusterCount * DeviceExt->BytesPerCluster >= DeviceExt->BytesPerCluster);
|
||||
DPRINT("Count %d, Start %x Next %x\n", ClusterCount, StartCluster, CurrentCluster);
|
||||
Ccb->LastCluster = StartCluster + (ClusterCount - 1);
|
||||
Ccb->LastOffset = ReadOffset + (ClusterCount - 1) * DeviceExt->BytesPerCluster;
|
||||
StartCluster = CurrentCluster;
|
||||
ClusterCount = 0;
|
||||
BytesDone = 0;
|
||||
/* Search for continous clusters. */
|
||||
do
|
||||
{
|
||||
ClusterCount++;
|
||||
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);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
ClusterCount *= DeviceExt->BytesPerCluster;
|
||||
(*LengthRead) = (*LengthRead) + ClusterCount;
|
||||
Buffer += ClusterCount;
|
||||
Length -= ClusterCount;
|
||||
ReadOffset += ClusterCount;
|
||||
DPRINT("Count %d, Start %x Next %x\n", ClusterCount, StartCluster,
|
||||
CurrentCluster);
|
||||
Ccb->LastCluster = StartCluster + (ClusterCount - 1);
|
||||
Ccb->LastOffset = ReadOffset +
|
||||
(ClusterCount - 1) * DeviceExt->BytesPerCluster;
|
||||
|
||||
Status = VfatRawReadCluster(DeviceExt, FirstCluster, Buffer,
|
||||
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
|
||||
* handling
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -881,82 +896,91 @@ NTSTATUS vfatExtendSpace (PDEVICE_EXTENSION pDeviceExt, PFILE_OBJECT pFileObject
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS VfatRead(PVFAT_IRP_CONTEXT IrpContext)
|
||||
NTSTATUS
|
||||
VfatRead(PVFAT_IRP_CONTEXT IrpContext)
|
||||
{
|
||||
PVFATFCB Fcb;
|
||||
PVFATCCB Ccb;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
ULONG ReadLength;
|
||||
ULONG ReturnedReadLength = 0;
|
||||
LARGE_INTEGER ReadOffset;
|
||||
PVOID Buffer;
|
||||
|
||||
DPRINT ("VfatRead(IrpContext %x)\n", IrpContext);
|
||||
assert (IrpContext);
|
||||
Ccb = (PVFATCCB) IrpContext->FileObject->FsContext2;
|
||||
assert (Ccb);
|
||||
Fcb = Ccb->pFcb;
|
||||
assert (Fcb);
|
||||
|
||||
if (IrpContext->Irp->Flags & IRP_PAGING_IO)
|
||||
{
|
||||
if (!ExAcquireResourceSharedLite(&Fcb->PagingIoResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
|
||||
PVFATFCB Fcb;
|
||||
PVFATCCB Ccb;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
ULONG ReadLength;
|
||||
ULONG ReturnedReadLength = 0;
|
||||
LARGE_INTEGER ReadOffset;
|
||||
PVOID Buffer;
|
||||
|
||||
DPRINT ("VfatRead(IrpContext %x)\n", IrpContext);
|
||||
assert (IrpContext);
|
||||
Ccb = (PVFATCCB) IrpContext->FileObject->FsContext2;
|
||||
assert (Ccb);
|
||||
Fcb = Ccb->pFcb;
|
||||
assert (Fcb);
|
||||
|
||||
if (IrpContext->Irp->Flags & IRP_PAGING_IO)
|
||||
{
|
||||
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))
|
||||
{
|
||||
return VfatQueueRequest (IrpContext);
|
||||
}
|
||||
Status = STATUS_FILE_IS_A_DIRECTORY;
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
Status = STATUS_FILE_IS_A_DIRECTORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
BOOLEAN NoCache;
|
||||
NoCache = IrpContext->FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING
|
||||
|| IrpContext->Irp->Flags & IRP_PAGING_IO;
|
||||
Status = VfatReadFile (IrpContext->DeviceExt, IrpContext->FileObject,
|
||||
Buffer, ReadLength, ReadOffset.u.LowPart, &ReturnedReadLength,
|
||||
IrpContext->FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING
|
||||
|| IrpContext->Irp->Flags & IRP_PAGING_IO);
|
||||
}
|
||||
Buffer, ReadLength, ReadOffset.u.LowPart,
|
||||
&ReturnedReadLength,
|
||||
NoCache);
|
||||
}
|
||||
|
||||
if (IrpContext->Irp->Flags & IRP_PAGING_IO)
|
||||
{
|
||||
if (IrpContext->Irp->Flags & IRP_PAGING_IO)
|
||||
{
|
||||
ExReleaseResourceLite(&Fcb->PagingIoResource);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
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.Status = Status;
|
||||
IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
|
||||
VfatFreeIrpContext (IrpContext);
|
||||
|
||||
return Status;
|
||||
IrpContext->Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
|
||||
VfatFreeIrpContext (IrpContext);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
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
|
||||
#define _INCLUDE_DDK_PSFUNCS_H
|
||||
|
@ -38,7 +38,8 @@ NTSTATUS STDCALL PsCreateSystemProcess(PHANDLE ProcessHandle,
|
|||
ACCESS_MASK DesiredAccess,
|
||||
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,
|
||||
PVOID Param2,
|
||||
|
@ -70,8 +71,6 @@ BOOLEAN STDCALL PsGetVersion (PULONG MajorVersion OPTIONAL,
|
|||
PULONG BuildNumber OPTIONAL,
|
||||
PUNICODE_STRING CSDVersion OPTIONAL);
|
||||
|
||||
VOID STDCALL PsDispatchThread(ULONG NewThreadStatus);
|
||||
|
||||
LARGE_INTEGER STDCALL PsGetProcessExitTime(VOID);
|
||||
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
|
||||
echo "Installing to disk."
|
||||
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
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <windows.h>
|
||||
#include <debug.h>
|
||||
#include <user32/callback.h>
|
||||
|
||||
#ifdef DBG
|
||||
|
||||
|
@ -21,6 +22,10 @@ Init(VOID)
|
|||
|
||||
ProcessHeap = RtlGetProcessHeap();
|
||||
|
||||
/* Set up the kernel callbacks. */
|
||||
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
|
||||
(PVOID)User32CallWindowProcFromKernel;
|
||||
|
||||
//ProcessWindowStation = CreateWindowStationW(L"WinStaName",0,GENERIC_ALL,NULL);
|
||||
//Desktop = CreateDesktopA(NULL,NULL,NULL,0,0,NULL);
|
||||
|
||||
|
@ -41,29 +46,26 @@ Cleanup(VOID)
|
|||
return Status;
|
||||
}
|
||||
|
||||
INT
|
||||
STDCALL
|
||||
DllMain(
|
||||
PVOID hinstDll,
|
||||
INT STDCALL
|
||||
DllMain(PVOID hinstDll,
|
||||
ULONG dwReason,
|
||||
PVOID reserved
|
||||
)
|
||||
PVOID reserved)
|
||||
{
|
||||
D(MAX_TRACE, ("hinstDll (0x%X) dwReason (0x%X)\n", hinstDll, dwReason));
|
||||
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
Init();
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
Cleanup();
|
||||
break;
|
||||
}
|
||||
return(1);
|
||||
break;
|
||||
}
|
||||
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
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -15,9 +15,27 @@
|
|||
#include <user32.h>
|
||||
#include <window.h>
|
||||
#include <debug.h>
|
||||
#include <user32/callback.h>
|
||||
|
||||
/* 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
|
||||
AdjustWindowRect(LPRECT lpRect,
|
||||
DWORD dwStyle,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
* PURPOSE: Process manager definitions
|
||||
|
@ -585,6 +585,9 @@ PiTimeoutThread(struct _KDPC *dpc,
|
|||
PVOID arg1,
|
||||
PVOID arg2);
|
||||
|
||||
VOID STDCALL
|
||||
PsDispatchThread(ULONG NewThreadStatus);
|
||||
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#endif /* __INCLUDE_INTERNAL_PS_H */
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
* FILE: ntoskrnl/ke/i386/trap.s
|
||||
|
@ -139,19 +139,19 @@ _KiTrapProlog:
|
|||
pushl $0 /* XXX: DebugEIP */
|
||||
pushl $0 /* XXX: DebugEBP */
|
||||
|
||||
/* Load the segment registers */
|
||||
/* Load the segment registers */
|
||||
movl $KERNEL_DS, %ebx
|
||||
movl %ebx, %ds
|
||||
movl %ebx, %es
|
||||
movl %ebx, %gs
|
||||
|
||||
/* Set ES to kernel segment */
|
||||
movw $KERNEL_DS,%bx
|
||||
movw %bx,%es
|
||||
/* Set ES to kernel segment */
|
||||
movw $KERNEL_DS,%bx
|
||||
movw %bx,%es
|
||||
|
||||
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)
|
||||
|
||||
/* 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
|
||||
;
|
||||
|
@ -551,6 +551,7 @@ NtSetSecurityObject@12
|
|||
NtSetSystemTime@8
|
||||
NtUnlockFile@20
|
||||
NtVdmControl@8
|
||||
NtW32Call@20
|
||||
NtWaitForSingleObject@12
|
||||
NtWriteFile@36
|
||||
;ObAssignSecurity@16
|
||||
|
@ -593,9 +594,12 @@ PsAssignImpersonationToken@8
|
|||
;PsChargePoolQuota@12
|
||||
PsCreateSystemProcess@12
|
||||
PsCreateSystemThread@28
|
||||
PsCreateWin32Thread@4
|
||||
PsCreateWin32Process@4
|
||||
PsGetWin32Thread@0
|
||||
PsGetWin32Process@0
|
||||
PsEstablishWin32Callouts@24
|
||||
PsGetCurrentProcess@0
|
||||
PsGetCurrentProcessId@0
|
||||
PsGetCurrentThreadId@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
|
||||
;
|
||||
|
@ -551,6 +551,7 @@ NtSetSecurityObject=NtSetSecurityObject@12
|
|||
NtSetSystemTime=NtSetSystemTime@8
|
||||
NtUnlockFile=NtUnlockFile@20
|
||||
NtVdmControl=NtVdmControl@8
|
||||
NtW32Call=NtW32Call@20
|
||||
NtWaitForSingleObject=NtWaitForSingleObject@12
|
||||
NtWriteFile=NtWriteFile@36
|
||||
;ObAssignSecurity=ObAssignSecurity@16
|
||||
|
@ -593,9 +594,12 @@ PsAssignImpersonationToken=PsAssignImpersonationToken@8
|
|||
;PsChargePoolQuota=PsChargePoolQuota@12
|
||||
PsCreateSystemProcess=PsCreateSystemProcess@12
|
||||
PsCreateSystemThread=PsCreateSystemThread@28
|
||||
PsCreateWin32Thread=PsCreateWin32Thread@4
|
||||
PsCreateWin32Process=PsCreateWin32Process@4
|
||||
PsGetWin32Thread=PsGetWin32Thread@0
|
||||
PsGetWin32Process=PsGetWin32Process@0
|
||||
PsEstablishWin32Callouts=PsEstablishWin32Callouts@24
|
||||
PsGetCurrentProcess=PsGetCurrentProcess@0
|
||||
PsGetCurrentProcessId=PsGetCurrentProcessId@0
|
||||
PsGetCurrentThreadId=PsGetCurrentThreadId@0
|
||||
PsGetCurrentThread=PsGetCurrentThread@0
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <napi/win32.h>
|
||||
|
||||
#define IS_ATOM(x) \
|
||||
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
|
||||
|
||||
|
||||
typedef struct _WNDCLASS_OBJECT
|
||||
{
|
||||
WNDCLASSEX Class;
|
||||
|
@ -15,7 +15,6 @@ typedef struct _WNDCLASS_OBJECT
|
|||
LIST_ENTRY ListEntry;
|
||||
} WNDCLASS_OBJECT, *PWNDCLASS_OBJECT;
|
||||
|
||||
|
||||
NTSTATUS
|
||||
InitClassImpl(VOID);
|
||||
|
||||
|
@ -23,19 +22,17 @@ NTSTATUS
|
|||
CleanupClassImpl(VOID);
|
||||
|
||||
NTSTATUS
|
||||
ClassReferenceClassByName(
|
||||
PWNDCLASS_OBJECT *Class,
|
||||
LPWSTR ClassName);
|
||||
ClassReferenceClassByName(PW32PROCESS Process,
|
||||
PWNDCLASS_OBJECT *Class,
|
||||
LPWSTR ClassName);
|
||||
|
||||
NTSTATUS
|
||||
ClassReferenceClassByAtom(
|
||||
PWNDCLASS_OBJECT *Class,
|
||||
RTL_ATOM ClassAtom);
|
||||
ClassReferenceClassByAtom(PWNDCLASS_OBJECT *Class,
|
||||
RTL_ATOM ClassAtom);
|
||||
|
||||
NTSTATUS
|
||||
ClassReferenceClassByNameOrAtom(
|
||||
PWNDCLASS_OBJECT *Class,
|
||||
LPWSTR ClassNameOrAtom);
|
||||
ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
|
||||
LPWSTR ClassNameOrAtom);
|
||||
|
||||
#endif /* __WIN32K_CLASS_H */
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ typedef struct _USER_OBJECT_HEADER
|
|||
CSHORT Size;
|
||||
} USER_OBJECT_HEADER, *PUSER_OBJECT_HEADER;
|
||||
|
||||
|
||||
typedef struct _USER_HANDLE
|
||||
{
|
||||
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
|
||||
*/
|
||||
|
@ -10,6 +10,7 @@
|
|||
#include <ddk/winddi.h>
|
||||
#include <ddk/service.h>
|
||||
|
||||
#include <napi/win32.h>
|
||||
#include <win32k/win32k.h>
|
||||
|
||||
#include <include/winsta.h>
|
||||
|
@ -50,6 +51,11 @@ DllMain (
|
|||
|
||||
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();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -71,7 +77,7 @@ DllMain (
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
Status = InitInputImpl();
|
||||
Status = InitInputImpl();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
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 = ../..
|
||||
|
||||
|
@ -24,7 +24,7 @@ LDR_OBJECTS = ldr/loader.o
|
|||
NTUSER_OBJECTS = ntuser/class.o ntuser/guicheck.o ntuser/hook.o \
|
||||
ntuser/message.o ntuser/msgqueue.o ntuser/stubs.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/color.o objects/coord.o objects/dc.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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -9,65 +9,64 @@
|
|||
* UPDATE HISTORY:
|
||||
* 06-06-2001 CSH Ported kernel object manager
|
||||
*/
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <include/object.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
PVOID
|
||||
HEADER_TO_BODY(
|
||||
PUSER_OBJECT_HEADER ObjectHeader)
|
||||
HEADER_TO_BODY(PUSER_OBJECT_HEADER ObjectHeader)
|
||||
{
|
||||
return (((PUSER_OBJECT_HEADER)ObjectHeader) + 1);
|
||||
return (((PUSER_OBJECT_HEADER)ObjectHeader) + 1);
|
||||
}
|
||||
|
||||
PUSER_OBJECT_HEADER BODY_TO_HEADER(
|
||||
PVOID ObjectBody)
|
||||
PUSER_OBJECT_HEADER
|
||||
BODY_TO_HEADER(PVOID ObjectBody)
|
||||
{
|
||||
return (((PUSER_OBJECT_HEADER)ObjectBody) - 1);
|
||||
}
|
||||
|
||||
static VOID
|
||||
ObmpLockHandleTable(
|
||||
PUSER_HANDLE_TABLE HandleTable)
|
||||
VOID STATIC
|
||||
ObmpLockHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||
{
|
||||
// ExAcquireFastMutex(HandleTable->ListLock);
|
||||
ExAcquireFastMutex(HandleTable->ListLock);
|
||||
}
|
||||
|
||||
static VOID
|
||||
ObmpUnlockHandleTable(
|
||||
PUSER_HANDLE_TABLE HandleTable)
|
||||
VOID STATIC
|
||||
ObmpUnlockHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||
{
|
||||
// ExReleaseFastMutex(AtomTable->ListLock);
|
||||
ExReleaseFastMutex(HandleTable->ListLock);
|
||||
}
|
||||
|
||||
VOID
|
||||
ObmpPerformRetentionChecks(
|
||||
PUSER_OBJECT_HEADER ObjectHeader)
|
||||
ObmpPerformRetentionChecks(PUSER_OBJECT_HEADER ObjectHeader)
|
||||
{
|
||||
if (ObjectHeader->RefCount < 0)
|
||||
{
|
||||
DbgPrint("ObjectHeader 0x%X has invalid reference count (%d)\n",
|
||||
ObjectHeader, ObjectHeader->RefCount);
|
||||
}
|
||||
|
||||
{
|
||||
DbgPrint("ObjectHeader 0x%X has invalid reference count (%d)\n",
|
||||
ObjectHeader, ObjectHeader->RefCount);
|
||||
}
|
||||
|
||||
if (ObjectHeader->HandleCount < 0)
|
||||
{
|
||||
DbgPrint("Object 0x%X has invalid handle count (%d)\n",
|
||||
ObjectHeader, ObjectHeader->HandleCount);
|
||||
}
|
||||
|
||||
{
|
||||
DbgPrint("Object 0x%X has invalid handle count (%d)\n",
|
||||
ObjectHeader, ObjectHeader->HandleCount);
|
||||
}
|
||||
|
||||
if ((ObjectHeader->RefCount == 0) && (ObjectHeader->HandleCount == 0))
|
||||
{
|
||||
ExFreePool(ObjectHeader);
|
||||
}
|
||||
{
|
||||
ExFreePool(ObjectHeader);
|
||||
}
|
||||
}
|
||||
|
||||
PUSER_HANDLE
|
||||
ObmpGetObjectByHandle(
|
||||
PUSER_HANDLE_TABLE HandleTable,
|
||||
HANDLE Handle)
|
||||
ObmpGetObjectByHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||
HANDLE Handle)
|
||||
/*
|
||||
* FUNCTION: Get the data structure for a handle
|
||||
* ARGUMENTS:
|
||||
|
@ -83,25 +82,24 @@ ObmpGetObjectByHandle(
|
|||
PUSER_HANDLE_BLOCK Block = NULL;
|
||||
PLIST_ENTRY Current;
|
||||
ULONG i;
|
||||
|
||||
|
||||
Current = HandleTable->ListHead.Flink;
|
||||
|
||||
|
||||
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);
|
||||
return &(Block->Handles[Index % HANDLE_BLOCK_ENTRIES]);
|
||||
}
|
||||
|
||||
VOID
|
||||
ObmpCloseAllHandles(
|
||||
PUSER_HANDLE_TABLE HandleTable)
|
||||
ObmpCloseAllHandles(PUSER_HANDLE_TABLE HandleTable)
|
||||
{
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PUSER_HANDLE_BLOCK Current;
|
||||
|
@ -109,127 +107,122 @@ ObmpCloseAllHandles(
|
|||
ULONG i;
|
||||
|
||||
ObmpLockHandleTable(HandleTable);
|
||||
|
||||
|
||||
CurrentEntry = HandleTable->ListHead.Flink;
|
||||
|
||||
while (CurrentEntry != &HandleTable->ListHead)
|
||||
{
|
||||
Current = CONTAINING_RECORD(CurrentEntry, USER_HANDLE_BLOCK, ListEntry);
|
||||
|
||||
for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
|
||||
{
|
||||
ObjectBody = Current->Handles[i].ObjectBody;
|
||||
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)
|
||||
{
|
||||
PUSER_OBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
|
||||
ObmReferenceObjectByPointer(ObjectBody, otUnknown);
|
||||
ObjectHeader->HandleCount--;
|
||||
Current->Handles[i].ObjectBody = NULL;
|
||||
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
|
||||
ObmDereferenceObject(ObjectBody);
|
||||
|
||||
ObmpLockHandleTable(HandleTable);
|
||||
CurrentEntry = &HandleTable->ListHead;
|
||||
break;
|
||||
}
|
||||
ObmpLockHandleTable(HandleTable);
|
||||
CurrentEntry = &HandleTable->ListHead;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
|
||||
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
}
|
||||
|
||||
VOID
|
||||
ObmpDeleteHandleTable(
|
||||
PUSER_HANDLE_TABLE HandleTable)
|
||||
ObmpDeleteHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||
{
|
||||
PUSER_HANDLE_BLOCK Current;
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
|
||||
ObmpCloseAllHandles(HandleTable);
|
||||
|
||||
|
||||
CurrentEntry = RemoveHeadList(&HandleTable->ListHead);
|
||||
|
||||
|
||||
while (CurrentEntry != &HandleTable->ListHead)
|
||||
{
|
||||
Current = CONTAINING_RECORD(CurrentEntry,
|
||||
USER_HANDLE_BLOCK,
|
||||
ListEntry);
|
||||
USER_HANDLE_BLOCK,
|
||||
ListEntry);
|
||||
|
||||
ExFreePool(Current);
|
||||
|
||||
CurrentEntry = RemoveHeadList(&HandleTable->ListHead);
|
||||
|
||||
CurrentEntry = RemoveHeadList(&HandleTable->ListHead);
|
||||
}
|
||||
}
|
||||
|
||||
PVOID
|
||||
ObmpDeleteHandle(
|
||||
PUSER_HANDLE_TABLE HandleTable,
|
||||
HANDLE Handle)
|
||||
ObmpDeleteHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||
HANDLE Handle)
|
||||
{
|
||||
PUSER_OBJECT_HEADER ObjectHeader;
|
||||
PUSER_HANDLE Entry;
|
||||
PVOID ObjectBody;
|
||||
|
||||
ObmpLockHandleTable(HandleTable);
|
||||
|
||||
|
||||
Entry = ObmpGetObjectByHandle(HandleTable, Handle);
|
||||
if (Entry == NULL)
|
||||
{
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ObjectBody = Entry->ObjectBody;
|
||||
|
||||
|
||||
if (ObjectBody != NULL)
|
||||
{
|
||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
ObjectHeader->HandleCount--;
|
||||
ObmReferenceObjectByPointer(ObjectBody, otUnknown);
|
||||
Entry->ObjectBody = NULL;
|
||||
}
|
||||
|
||||
{
|
||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
ObjectHeader->HandleCount--;
|
||||
ObmReferenceObjectByPointer(ObjectBody, otUnknown);
|
||||
Entry->ObjectBody = NULL;
|
||||
}
|
||||
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
|
||||
return ObjectBody;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ObmpInitializeObject(
|
||||
PUSER_HANDLE_TABLE HandleTable,
|
||||
PUSER_OBJECT_HEADER ObjectHeader,
|
||||
PHANDLE Handle,
|
||||
USER_OBJECT_TYPE ObjectType,
|
||||
ULONG ObjectSize)
|
||||
ObmpInitializeObject(PUSER_HANDLE_TABLE HandleTable,
|
||||
PUSER_OBJECT_HEADER ObjectHeader,
|
||||
PHANDLE Handle,
|
||||
USER_OBJECT_TYPE ObjectType,
|
||||
ULONG ObjectSize)
|
||||
{
|
||||
DWORD Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
ObjectHeader->Type = ObjectType;
|
||||
ObjectHeader->HandleCount = 0;
|
||||
ObjectHeader->RefCount = 1;
|
||||
ObjectHeader->Size = ObjectSize;
|
||||
|
||||
if (Handle != NULL)
|
||||
{
|
||||
Status = ObmCreateHandle(
|
||||
HandleTable,
|
||||
HEADER_TO_BODY(ObjectHeader),
|
||||
Handle);
|
||||
}
|
||||
{
|
||||
Status = ObmCreateHandle(HandleTable,
|
||||
HEADER_TO_BODY(ObjectHeader),
|
||||
Handle);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
ULONG
|
||||
ObmGetReferenceCount(
|
||||
PVOID ObjectBody)
|
||||
ObmGetReferenceCount(PVOID ObjectBody)
|
||||
{
|
||||
PUSER_OBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
|
||||
|
@ -237,8 +230,7 @@ ObmGetReferenceCount(
|
|||
}
|
||||
|
||||
ULONG
|
||||
ObmGetHandleCount(
|
||||
PVOID ObjectBody)
|
||||
ObmGetHandleCount(PVOID ObjectBody)
|
||||
{
|
||||
PUSER_OBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
|
||||
|
@ -246,8 +238,7 @@ ObmGetHandleCount(
|
|||
}
|
||||
|
||||
VOID
|
||||
ObmReferenceObject(
|
||||
PVOID ObjectBody)
|
||||
ObmReferenceObject(PVOID ObjectBody)
|
||||
/*
|
||||
* FUNCTION: Increments a given object's reference count and performs
|
||||
* retention checks
|
||||
|
@ -256,22 +247,21 @@ ObmReferenceObject(
|
|||
*/
|
||||
{
|
||||
PUSER_OBJECT_HEADER ObjectHeader;
|
||||
|
||||
|
||||
if (!ObjectBody)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
|
||||
|
||||
ObjectHeader->RefCount++;
|
||||
|
||||
ObmpPerformRetentionChecks(ObjectHeader);
|
||||
}
|
||||
|
||||
VOID
|
||||
ObmDereferenceObject(
|
||||
PVOID ObjectBody)
|
||||
ObmDereferenceObject(PVOID ObjectBody)
|
||||
/*
|
||||
* FUNCTION: Decrements a given object's reference count and performs
|
||||
* retention checks
|
||||
|
@ -280,23 +270,22 @@ ObmDereferenceObject(
|
|||
*/
|
||||
{
|
||||
PUSER_OBJECT_HEADER ObjectHeader;
|
||||
|
||||
|
||||
if (!ObjectBody)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
|
||||
|
||||
ObjectHeader->RefCount--;
|
||||
|
||||
ObmpPerformRetentionChecks(ObjectHeader);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ObmReferenceObjectByPointer(
|
||||
PVOID ObjectBody,
|
||||
USER_OBJECT_TYPE ObjectType)
|
||||
ObmReferenceObjectByPointer(PVOID ObjectBody,
|
||||
USER_OBJECT_TYPE ObjectType)
|
||||
/*
|
||||
* FUNCTION: Increments the pointer reference count for a given object
|
||||
* ARGUMENTS:
|
||||
|
@ -306,62 +295,59 @@ ObmReferenceObjectByPointer(
|
|||
*/
|
||||
{
|
||||
PUSER_OBJECT_HEADER ObjectHeader;
|
||||
|
||||
|
||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
|
||||
|
||||
if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ObjectHeader->RefCount++;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
PVOID
|
||||
ObmCreateObject(
|
||||
PUSER_HANDLE_TABLE HandleTable,
|
||||
PHANDLE Handle,
|
||||
USER_OBJECT_TYPE ObjectType,
|
||||
ULONG ObjectSize)
|
||||
ObmCreateObject(PUSER_HANDLE_TABLE HandleTable,
|
||||
PHANDLE Handle,
|
||||
USER_OBJECT_TYPE ObjectType,
|
||||
ULONG ObjectSize)
|
||||
{
|
||||
PUSER_OBJECT_HEADER ObjectHeader;
|
||||
PVOID ObjectBody;
|
||||
DWORD Status;
|
||||
|
||||
ObjectHeader = (PUSER_OBJECT_HEADER)ExAllocatePool(
|
||||
NonPagedPool, ObjectSize + sizeof(USER_OBJECT_HEADER));
|
||||
|
||||
ObjectHeader = (PUSER_OBJECT_HEADER)ExAllocatePool(NonPagedPool,
|
||||
ObjectSize + sizeof(USER_OBJECT_HEADER));
|
||||
if (!ObjectHeader)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ObjectBody = HEADER_TO_BODY(ObjectHeader);
|
||||
|
||||
|
||||
RtlZeroMemory(ObjectBody, ObjectSize);
|
||||
|
||||
Status = ObmpInitializeObject(
|
||||
HandleTable,
|
||||
ObjectHeader,
|
||||
Handle,
|
||||
ObjectType,
|
||||
ObjectSize);
|
||||
|
||||
|
||||
Status = ObmpInitializeObject(HandleTable,
|
||||
ObjectHeader,
|
||||
Handle,
|
||||
ObjectType,
|
||||
ObjectSize);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(ObjectHeader);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
{
|
||||
ExFreePool(ObjectHeader);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ObjectBody;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ObmCreateHandle(
|
||||
PUSER_HANDLE_TABLE HandleTable,
|
||||
PVOID ObjectBody,
|
||||
PHANDLE HandleReturn)
|
||||
ObmCreateHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||
PVOID ObjectBody,
|
||||
PHANDLE HandleReturn)
|
||||
/*
|
||||
* FUNCTION: Add a handle referencing an object
|
||||
* ARGUMENTS:
|
||||
|
@ -375,49 +361,50 @@ ObmCreateHandle(
|
|||
ULONG Handle;
|
||||
ULONG i;
|
||||
|
||||
if (ObjectBody != NULL) {
|
||||
BODY_TO_HEADER(ObjectBody)->HandleCount++;
|
||||
}
|
||||
|
||||
if (ObjectBody != NULL)
|
||||
{
|
||||
BODY_TO_HEADER(ObjectBody)->HandleCount++;
|
||||
}
|
||||
|
||||
ObmpLockHandleTable(HandleTable);
|
||||
|
||||
|
||||
Current = HandleTable->ListHead.Flink;
|
||||
/*
|
||||
* Scan through the currently allocated Handle blocks looking for a free
|
||||
* slot
|
||||
*/
|
||||
while (Current != &(HandleTable->ListHead))
|
||||
{
|
||||
PUSER_HANDLE_BLOCK Block = CONTAINING_RECORD(
|
||||
Current, USER_HANDLE_BLOCK, ListEntry);
|
||||
|
||||
Handle = 1;
|
||||
for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
|
||||
{
|
||||
if (!Block->Handles[i].ObjectBody)
|
||||
{
|
||||
Block->Handles[i].ObjectBody = ObjectBody;
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
*HandleReturn = (HANDLE)((Handle + i) << 2);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
Block->Handles[i].ObjectBody = ObjectBody;
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
*HandleReturn = (HANDLE)((Handle + i) << 2);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Handle = Handle + HANDLE_BLOCK_ENTRIES;
|
||||
Current = Current->Flink;
|
||||
}
|
||||
Handle = Handle + HANDLE_BLOCK_ENTRIES;
|
||||
Current = Current->Flink;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a new Handle block to the end of the list
|
||||
*/
|
||||
NewBlock = (PUSER_HANDLE_BLOCK)ExAllocatePool(
|
||||
NonPagedPool, sizeof(USER_HANDLE_BLOCK));
|
||||
NewBlock = (PUSER_HANDLE_BLOCK)ExAllocatePool(NonPagedPool,
|
||||
sizeof(USER_HANDLE_BLOCK));
|
||||
if (!NewBlock)
|
||||
{
|
||||
*HandleReturn = (PHANDLE)NULL;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
{
|
||||
*HandleReturn = (PHANDLE)NULL;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlZeroMemory(NewBlock, sizeof(USER_HANDLE_BLOCK));
|
||||
NewBlock->Handles[0].ObjectBody = ObjectBody;
|
||||
InsertTailList(&HandleTable->ListHead, &NewBlock->ListEntry);
|
||||
|
@ -428,11 +415,10 @@ ObmCreateHandle(
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
ObmReferenceObjectByHandle(
|
||||
PUSER_HANDLE_TABLE HandleTable,
|
||||
HANDLE Handle,
|
||||
USER_OBJECT_TYPE ObjectType,
|
||||
PVOID* Object)
|
||||
ObmReferenceObjectByHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||
HANDLE Handle,
|
||||
USER_OBJECT_TYPE ObjectType,
|
||||
PVOID* Object)
|
||||
/*
|
||||
* FUNCTION: Increments the reference count for an object and returns a
|
||||
* pointer to its body
|
||||
|
@ -447,64 +433,60 @@ ObmReferenceObjectByHandle(
|
|||
PUSER_OBJECT_HEADER ObjectHeader;
|
||||
PUSER_HANDLE UserHandle;
|
||||
PVOID ObjectBody;
|
||||
|
||||
|
||||
ObmpLockHandleTable(HandleTable);
|
||||
|
||||
|
||||
UserHandle = ObmpGetObjectByHandle(HandleTable, Handle);
|
||||
|
||||
|
||||
if ((UserHandle == NULL) || (UserHandle->ObjectBody == NULL))
|
||||
{
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
{
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
ObjectBody = UserHandle->ObjectBody;
|
||||
ObmReferenceObjectByPointer(ObjectBody, ObjectType);
|
||||
|
||||
|
||||
ObmpUnlockHandleTable(HandleTable);
|
||||
|
||||
|
||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
|
||||
|
||||
if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
*Object = ObjectBody;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ObmCloseHandle(
|
||||
PUSER_HANDLE_TABLE HandleTable,
|
||||
HANDLE Handle)
|
||||
ObmCloseHandle(PUSER_HANDLE_TABLE HandleTable,
|
||||
HANDLE Handle)
|
||||
{
|
||||
PVOID ObjectBody;
|
||||
|
||||
ObjectBody = ObmpDeleteHandle(HandleTable, Handle);
|
||||
if (ObjectBody == NULL)
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
ObmDereferenceObject(ObjectBody);
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ObmInitializeHandleTable(
|
||||
PUSER_HANDLE_TABLE HandleTable)
|
||||
ObmInitializeHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||
{
|
||||
InitializeListHead(&HandleTable->ListHead);
|
||||
//ExInitializeFastMutex(HandleTable->ListLock);
|
||||
ExInitializeFastMutex(HandleTable->ListLock);
|
||||
}
|
||||
|
||||
VOID
|
||||
ObmFreeHandleTable(
|
||||
PUSER_HANDLE_TABLE HandleTable)
|
||||
ObmFreeHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||
{
|
||||
ObmpDeleteHandleTable(HandleTable);
|
||||
}
|
||||
|
@ -514,21 +496,20 @@ ObmCreateHandleTable(VOID)
|
|||
{
|
||||
PUSER_HANDLE_TABLE HandleTable;
|
||||
|
||||
HandleTable = (PUSER_HANDLE_TABLE)ExAllocatePool(
|
||||
NonPagedPool, sizeof(USER_HANDLE_TABLE));
|
||||
HandleTable = (PUSER_HANDLE_TABLE)ExAllocatePool(NonPagedPool,
|
||||
sizeof(USER_HANDLE_TABLE));
|
||||
if (!HandleTable)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ObmInitializeHandleTable(HandleTable);
|
||||
|
||||
|
||||
return HandleTable;
|
||||
}
|
||||
|
||||
VOID
|
||||
ObmDestroyHandleTable(
|
||||
PUSER_HANDLE_TABLE HandleTable)
|
||||
ObmDestroyHandleTable(PUSER_HANDLE_TABLE HandleTable)
|
||||
{
|
||||
ObmFreeHandleTable(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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -12,28 +12,20 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <win32k/win32k.h>
|
||||
#include <win32k/userobj.h>
|
||||
#include <napi/win32.h>
|
||||
#include <include/class.h>
|
||||
#include <include/error.h>
|
||||
#include <include/winsta.h>
|
||||
#include <include/object.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
/* List of system classes */
|
||||
static LIST_ENTRY SystemClassListHead;
|
||||
static FAST_MUTEX SystemClassListLock;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
InitClassImpl(VOID)
|
||||
{
|
||||
ExInitializeFastMutex(&SystemClassListLock);
|
||||
InitializeListHead(&SystemClassListHead);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -44,85 +36,35 @@ CleanupClassImpl(VOID)
|
|||
}
|
||||
|
||||
|
||||
DWORD
|
||||
CliFindClassByName(PWNDCLASS_OBJECT* Class,
|
||||
LPWSTR ClassName,
|
||||
PLIST_ENTRY ListHead)
|
||||
NTSTATUS
|
||||
ClassReferenceClassByName(PW32PROCESS Process,
|
||||
PWNDCLASS_OBJECT* Class,
|
||||
LPWSTR ClassName)
|
||||
{
|
||||
PWNDCLASS_OBJECT Current;
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
|
||||
ExAcquireFastMutexUnsafe (&SystemClassListLock);
|
||||
CurrentEntry = ListHead->Flink;
|
||||
while (CurrentEntry != ListHead)
|
||||
ExAcquireFastMutexUnsafe (&Process->ClassListLock);
|
||||
CurrentEntry = Process->ClassListHead.Flink;
|
||||
while (CurrentEntry != &Process->ClassListHead)
|
||||
{
|
||||
Current = CONTAINING_RECORD(CurrentEntry, WNDCLASS_OBJECT, ListEntry);
|
||||
|
||||
if (_wcsicmp(ClassName, Current->Class.lpszClassName) == 0)
|
||||
{
|
||||
*Class = Current;
|
||||
ExReleaseFastMutexUnsafe (&SystemClassListLock);
|
||||
ObmReferenceObject(Current);
|
||||
ExReleaseFastMutexUnsafe (&Process->ClassListLock);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
ExReleaseFastMutexUnsafe (&SystemClassListLock);
|
||||
ExReleaseFastMutexUnsafe (&Process->ClassListLock);
|
||||
|
||||
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
|
||||
ClassReferenceClassByAtom(PWNDCLASS_OBJECT *Class,
|
||||
RTL_ATOM ClassAtom)
|
||||
|
@ -156,9 +98,9 @@ ClassReferenceClassByAtom(PWNDCLASS_OBJECT *Class,
|
|||
&ClassName[0],
|
||||
&ClassNameLength);
|
||||
|
||||
Status = CliReferenceClassByNameWinSta(WinStaObject,
|
||||
Class,
|
||||
&ClassName[0]);
|
||||
Status = ClassReferenceClassByName(PsGetWin32Process(),
|
||||
Class,
|
||||
&ClassName[0]);
|
||||
|
||||
ObDereferenceObject(WinStaObject);
|
||||
|
||||
|
@ -178,7 +120,8 @@ ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
|
|||
}
|
||||
else
|
||||
{
|
||||
Status = ClassReferenceClassByName(Class, ClassNameOrAtom);
|
||||
Status = ClassReferenceClassByName(PsGetWin32Process(), Class,
|
||||
ClassNameOrAtom);
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -190,11 +133,11 @@ ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
|
|||
}
|
||||
|
||||
DWORD STDCALL
|
||||
NtUserGetClassInfo(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4)
|
||||
NtUserGetClassInfo(IN LPWSTR ClassName,
|
||||
IN ULONG InfoClass,
|
||||
OUT PVOID Info,
|
||||
IN ULONG InfoLength,
|
||||
OUT PULONG ReturnedLength)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
||||
|
@ -220,6 +163,13 @@ NtUserGetWOWClass(DWORD Unknown0,
|
|||
return(0);
|
||||
}
|
||||
|
||||
RTL_ATOM STDCALL
|
||||
NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
||||
BOOL bUnicodeClass,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5)
|
||||
/*
|
||||
* FUNCTION:
|
||||
* Registers a new class with the window manager
|
||||
|
@ -230,13 +180,6 @@ NtUserGetWOWClass(DWORD Unknown0,
|
|||
* RETURNS:
|
||||
* Atom identifying the new class
|
||||
*/
|
||||
RTL_ATOM STDCALL
|
||||
NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
||||
BOOL bUnicodeClass,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5)
|
||||
{
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
PWNDCLASS_OBJECT ClassObject;
|
||||
|
@ -244,7 +187,7 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
|||
RTL_ATOM Atom;
|
||||
WORD objectSize;
|
||||
LPTSTR namePtr;
|
||||
|
||||
|
||||
DPRINT("About to open window station handle (0x%X)\n",
|
||||
PROCESS_WINDOW_STATION());
|
||||
|
||||
|
@ -275,7 +218,7 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
|||
objectSize = sizeof(WNDCLASS_OBJECT) +
|
||||
(lpwcx->lpszMenuName != 0 ? wcslen (lpwcx->lpszMenuName) + 1 : 0) +
|
||||
wcslen (lpwcx->lpszClassName) + 1;
|
||||
ClassObject = USEROBJ_AllocObject (objectSize, UO_CLASS_MAGIC);
|
||||
ClassObject = ObmCreateObject(NULL, NULL, otClass, objectSize);
|
||||
if (ClassObject == 0)
|
||||
{
|
||||
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
|
||||
|
@ -297,16 +240,9 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
|||
}
|
||||
ClassObject->Class.lpszClassName = namePtr;
|
||||
wcscpy (namePtr, lpwcx->lpszClassName);
|
||||
|
||||
if (lpwcx->style & CS_GLOBALCLASS)
|
||||
{
|
||||
InsertTailList(&SystemClassListHead, &ClassObject->ListEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: Put on local list */
|
||||
InsertTailList(&SystemClassListHead, &ClassObject->ListEntry);
|
||||
}
|
||||
ExAcquireFastMutex(&PsGetWin32Process()->ClassListLock);
|
||||
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
|
||||
ExReleaseFastMutex(&PsGetWin32Process()->ClassListLock);
|
||||
|
||||
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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -20,6 +20,8 @@
|
|||
#include <win32k/win32k.h>
|
||||
#include <include/guicheck.h>
|
||||
#include <include/msgqueue.h>
|
||||
#include <include/object.h>
|
||||
#include <napi/win32.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
@ -29,10 +31,22 @@
|
|||
VOID
|
||||
W32kGuiCheck(VOID)
|
||||
{
|
||||
if (PsGetWin32Thread()->MessageQueue != NULL)
|
||||
return;
|
||||
|
||||
PsGetWin32Thread()->MessageQueue = MsqCreateMessageQueue();
|
||||
if (PsGetWin32Process() == NULL)
|
||||
{
|
||||
PsCreateWin32Process(PsGetCurrentProcess());
|
||||
|
||||
InitializeListHead(&PsGetWin32Process()->ClassListHead);
|
||||
ExInitializeFastMutex(&PsGetWin32Process()->ClassListLock);
|
||||
InitializeListHead(&PsGetWin32Process()->WindowListHead);
|
||||
ExInitializeFastMutex(&PsGetWin32Process()->WindowListLock);
|
||||
PsGetWin32Process()->HandleTable = ObmCreateHandleTable();
|
||||
}
|
||||
|
||||
if (PsGetWin32Thread() == NULL)
|
||||
{
|
||||
PsCreateWin32Thread(PsGetCurrentThread());
|
||||
PsGetWin32Thread()->MessageQueue = MsqCreateMessageQueue();
|
||||
}
|
||||
}
|
||||
|
||||
/* 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -20,6 +20,7 @@
|
|||
#include <include/error.h>
|
||||
#include <include/object.h>
|
||||
#include <include/winsta.h>
|
||||
#include <include/callback.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
@ -40,11 +41,43 @@ W32kCleanupMessageImpl(VOID)
|
|||
|
||||
|
||||
LRESULT STDCALL
|
||||
NtUserDispatchMessage(LPMSG lpmsg)
|
||||
NtUserDispatchMessage(LPMSG lpMsg)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
||||
return 0;
|
||||
LRESULT Result;
|
||||
|
||||
/* 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
|
||||
|
@ -68,6 +101,7 @@ NtUserGetMessage(LPMSG lpMsg,
|
|||
PUSER_MESSAGE Message;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Initialize the thread's win32 state if necessary. */
|
||||
W32kGuiCheck();
|
||||
|
||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||
|
@ -211,15 +245,6 @@ NtUserSendNotifyMessage(HWND hWnd,
|
|||
return 0;
|
||||
}
|
||||
|
||||
BOOL STDCALL
|
||||
NtUserTranslateMessage(LPMSG lpMsg,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL STDCALL
|
||||
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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -8,9 +8,11 @@
|
|||
* REVISION HISTORY:
|
||||
* 06-06-2001 CSH Created
|
||||
*/
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <win32k/win32k.h>
|
||||
#include <win32k/userobj.h>
|
||||
#include <include/object.h>
|
||||
#include <include/guicheck.h>
|
||||
#include <include/window.h>
|
||||
#include <include/class.h>
|
||||
|
@ -20,71 +22,56 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
/* List of windows created by the process */
|
||||
static LIST_ENTRY WindowListHead;
|
||||
static FAST_MUTEX WindowListLock;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
InitWindowImpl(VOID)
|
||||
{
|
||||
ExInitializeFastMutex(&WindowListLock);
|
||||
InitializeListHead(&WindowListHead);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
CleanupWindowImpl(VOID)
|
||||
{
|
||||
//ExReleaseFastMutex(&WindowListLock);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserAlterWindowStyle(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
DWORD STDCALL
|
||||
NtUserAlterWindowStyle(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserChildWindowFromPointEx(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
DWORD STDCALL
|
||||
NtUserChildWindowFromPointEx(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
HWND
|
||||
STDCALL
|
||||
NtUserCreateWindowEx(
|
||||
DWORD dwExStyle,
|
||||
PUNICODE_STRING lpClassName,
|
||||
PUNICODE_STRING lpWindowName,
|
||||
DWORD dwStyle,
|
||||
LONG x,
|
||||
LONG y,
|
||||
LONG nWidth,
|
||||
LONG nHeight,
|
||||
HWND hWndParent,
|
||||
HMENU hMenu,
|
||||
HINSTANCE hInstance,
|
||||
LPVOID lpParam,
|
||||
DWORD Unknown12)
|
||||
HWND STDCALL
|
||||
NtUserCreateWindowEx(DWORD dwExStyle,
|
||||
PUNICODE_STRING lpClassName,
|
||||
PUNICODE_STRING lpWindowName,
|
||||
DWORD dwStyle,
|
||||
LONG x,
|
||||
LONG y,
|
||||
LONG nWidth,
|
||||
LONG nHeight,
|
||||
HWND hWndParent,
|
||||
HMENU hMenu,
|
||||
HINSTANCE hInstance,
|
||||
LPVOID lpParam,
|
||||
DWORD Unknown12)
|
||||
{
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
PWNDCLASS_OBJECT ClassObject;
|
||||
|
@ -97,44 +84,44 @@ NtUserCreateWindowEx(
|
|||
|
||||
Status = ClassReferenceClassByNameOrAtom(&ClassObject, lpClassName->Buffer);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
{
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
if (!RtlCreateUnicodeString(&WindowName, lpWindowName->Buffer))
|
||||
{
|
||||
ObmDereferenceObject(ClassObject);
|
||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return (HWND)0;
|
||||
}
|
||||
{
|
||||
ObmDereferenceObject(ClassObject);
|
||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
Status = ValidateWindowStationHandle(
|
||||
PROCESS_WINDOW_STATION(),
|
||||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
ObmDereferenceObject(ClassObject);
|
||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||
PROCESS_WINDOW_STATION());
|
||||
return (HWND)0;
|
||||
}
|
||||
{
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
ObmDereferenceObject(ClassObject);
|
||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||
PROCESS_WINDOW_STATION());
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
WindowObject = (PWINDOW_OBJECT) USEROBJ_AllocObject (sizeof (WINDOW_OBJECT),
|
||||
UO_WINDOW_MAGIC);
|
||||
WindowObject = (PWINDOW_OBJECT)
|
||||
ObmCreateObject(PsGetWin32Process()->HandleTable, &Handle, otWindow,
|
||||
sizeof(WINDOW_OBJECT));
|
||||
if (!WindowObject)
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
ObmDereferenceObject(ClassObject);
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return (HWND)0;
|
||||
}
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
ObmDereferenceObject(ClassObject);
|
||||
RtlFreeUnicodeString(&WindowName);
|
||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
ObDereferenceObject(WinStaObject);
|
||||
|
||||
|
||||
WindowObject->Class = ClassObject;
|
||||
WindowObject->ExStyle = dwExStyle;
|
||||
WindowObject->Style = dwStyle;
|
||||
|
@ -149,124 +136,115 @@ NtUserCreateWindowEx(
|
|||
|
||||
RtlInitUnicodeString(&WindowObject->WindowName, WindowName.Buffer);
|
||||
|
||||
ExAcquireFastMutexUnsafe (&WindowListLock);
|
||||
InsertTailList (&WindowListHead, &WindowObject->ListEntry);
|
||||
ExReleaseFastMutexUnsafe (&WindowListLock);
|
||||
ExAcquireFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
|
||||
InsertTailList (&PsGetWin32Process()->WindowListHead,
|
||||
&WindowObject->ListEntry);
|
||||
ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
|
||||
|
||||
return (HWND)Handle;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserDeferWindowPos(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5,
|
||||
DWORD Unknown6,
|
||||
DWORD Unknown7)
|
||||
DWORD STDCALL
|
||||
NtUserDeferWindowPos(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5,
|
||||
DWORD Unknown6,
|
||||
DWORD Unknown7)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserDestroyWindow(
|
||||
DWORD Unknown0)
|
||||
DWORD STDCALL
|
||||
NtUserDestroyWindow(DWORD Unknown0)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserEndDeferWindowPosEx(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
DWORD STDCALL
|
||||
NtUserEndDeferWindowPosEx(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD STDCALL
|
||||
NtUserFillWindow(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserFillWindow(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
HWND STDCALL
|
||||
NtUserFindWindowEx(HWND hwndParent,
|
||||
HWND hwndChildAfter,
|
||||
PUNICODE_STRING ucClassName,
|
||||
PUNICODE_STRING ucWindowName,
|
||||
DWORD Unknown4)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
NTSTATUS status;
|
||||
HWND windowHandle;
|
||||
PWINDOW_OBJECT windowObject;
|
||||
PLIST_ENTRY currentEntry;
|
||||
PWNDCLASS_OBJECT classObject;
|
||||
|
||||
W32kGuiCheck();
|
||||
|
||||
|
||||
status = ClassReferenceClassByNameOrAtom(&classObject, ucClassName->Buffer);
|
||||
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 (
|
||||
UserObjectBodyToHeader (windowObject));
|
||||
ExReleaseFastMutexUnsafe (&WindowListLock);
|
||||
ObDereferenceObject (classObject);
|
||||
|
||||
return windowHandle;
|
||||
return (HWND)0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserFlashWindowEx(
|
||||
DWORD Unknown0)
|
||||
DWORD STDCALL
|
||||
NtUserFlashWindowEx(DWORD Unknown0)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
DWORD STDCALL
|
||||
NtUserGetForegroundWindow(VOID)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
@ -274,20 +252,17 @@ NtUserGetForegroundWindow(VOID)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserGetInternalWindowPos(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
DWORD STDCALL
|
||||
NtUserGetInternalWindowPos(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
DWORD STDCALL
|
||||
NtUserGetOpenClipboardWindow(VOID)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
@ -295,320 +270,275 @@ NtUserGetOpenClipboardWindow(VOID)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserGetWindowDC(
|
||||
DWORD Unknown0)
|
||||
DWORD STDCALL
|
||||
NtUserGetWindowDC(DWORD Unknown0)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserGetWindowPlacement(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
DWORD STDCALL
|
||||
NtUserGetWindowPlacement(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserInternalGetWindowText(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
DWORD STDCALL
|
||||
NtUserInternalGetWindowText(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserLockWindowUpdate(
|
||||
DWORD Unknown0)
|
||||
DWORD STDCALL
|
||||
NtUserLockWindowUpdate(DWORD Unknown0)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserMoveWindow(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5)
|
||||
DWORD STDCALL
|
||||
NtUserMoveWindow(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserQueryWindow(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
DWORD STDCALL
|
||||
NtUserQueryWindow(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserRealChildWindowFromPoint(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
DWORD STDCALL
|
||||
NtUserRealChildWindowFromPoint(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserRedrawWindow(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
DWORD STDCALL
|
||||
NtUserRedrawWindow(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserRegisterWindowMessage(
|
||||
DWORD Unknown0)
|
||||
DWORD STDCALL
|
||||
NtUserRegisterWindowMessage(DWORD Unknown0)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserScrollWindowEx(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5,
|
||||
DWORD Unknown6,
|
||||
DWORD Unknown7)
|
||||
DWORD STDCALL
|
||||
NtUserScrollWindowEx(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5,
|
||||
DWORD Unknown6,
|
||||
DWORD Unknown7)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetActiveWindow(
|
||||
DWORD Unknown0)
|
||||
DWORD STDCALL
|
||||
NtUserSetActiveWindow(DWORD Unknown0)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetImeOwnerWindow(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
DWORD STDCALL
|
||||
NtUserSetImeOwnerWindow(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetInternalWindowPos(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
DWORD STDCALL
|
||||
NtUserSetInternalWindowPos(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetLayeredWindowAttributes(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
DWORD STDCALL
|
||||
NtUserSetLayeredWindowAttributes(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetLogonNotifyWindow(
|
||||
DWORD Unknown0)
|
||||
DWORD STDCALL
|
||||
NtUserSetLogonNotifyWindow(DWORD Unknown0)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetShellWindowEx(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
DWORD STDCALL
|
||||
NtUserSetShellWindowEx(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetWindowFNID(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
DWORD STDCALL
|
||||
NtUserSetWindowFNID(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetWindowLong(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
DWORD STDCALL
|
||||
NtUserSetWindowLong(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetWindowPlacement(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
DWORD STDCALL
|
||||
NtUserSetWindowPlacement(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetWindowPos(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5,
|
||||
DWORD Unknown6)
|
||||
DWORD STDCALL
|
||||
NtUserSetWindowPos(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5,
|
||||
DWORD Unknown6)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetWindowRgn(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
DWORD STDCALL
|
||||
NtUserSetWindowRgn(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserSetWindowWord(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
DWORD STDCALL
|
||||
NtUserSetWindowWord(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserShowWindow(
|
||||
HWND hWnd,
|
||||
LONG nCmdShow)
|
||||
BOOL STDCALL
|
||||
NtUserShowWindow(HWND hWnd,
|
||||
LONG nCmdShow)
|
||||
{
|
||||
PWINDOW_OBJECT WindowObject;
|
||||
|
||||
NTSTATUS Status;
|
||||
|
||||
W32kGuiCheck();
|
||||
|
||||
WindowObject = USEROBJ_HandleToPtr (hWnd, UO_WINDOW_MAGIC);
|
||||
|
||||
Status = ObmReferenceObjectByHandle(PsGetWin32Process()->HandleTable,
|
||||
hWnd,
|
||||
otWindow,
|
||||
(PVOID*)&WindowObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserShowWindowAsync(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
DWORD STDCALL
|
||||
NtUserShowWindowAsync(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserUpdateLayeredWindow(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5,
|
||||
DWORD Unknown6,
|
||||
DWORD Unknown7,
|
||||
DWORD Unknown8)
|
||||
DWORD STDCALL
|
||||
NtUserUpdateLayeredWindow(DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5,
|
||||
DWORD Unknown6,
|
||||
DWORD Unknown7,
|
||||
DWORD Unknown8)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserWindowFromPoint(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
DWORD STDCALL
|
||||
NtUserWindowFromPoint(DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
|
|
Loading…
Reference in a new issue