mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed some bugs.
svn path=/trunk/; revision=3243
This commit is contained in:
parent
21214f6b8c
commit
9d6848e6ed
38 changed files with 1644 additions and 658 deletions
|
@ -82,13 +82,15 @@ typedef enum _JOBOBJECTINFOCLASS { // Q S
|
||||||
#define ProcessWx86Information 19
|
#define ProcessWx86Information 19
|
||||||
#define ProcessHandleCount 20
|
#define ProcessHandleCount 20
|
||||||
#define ProcessAffinityMask 21
|
#define ProcessAffinityMask 21
|
||||||
#define ProcessImageFileName 22 // ???
|
|
||||||
#define ProcessPriorityBoost 22
|
#define ProcessPriorityBoost 22
|
||||||
#define ProcessDeviceMap 23
|
#define ProcessDeviceMap 23
|
||||||
#define ProcessSessionInformation 24
|
#define ProcessSessionInformation 24
|
||||||
#define ProcessForegroundInformation 25
|
#define ProcessForegroundInformation 25
|
||||||
#define ProcessWow64Information 26
|
#define ProcessWow64Information 26
|
||||||
#define MaxProcessInfoClass 26
|
/* ReactOS private. */
|
||||||
|
#define ProcessImageFileName 27
|
||||||
|
#define ProcessDesktop 28
|
||||||
|
#define MaxProcessInfoClass 29
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* thread query / set information class
|
* thread query / set information class
|
||||||
|
|
|
@ -1,19 +1,35 @@
|
||||||
#ifndef __INCLUDE_NAPI_CORE_H
|
#ifndef __INCLUDE_NAPI_CORE_H
|
||||||
#define __INCLUDE_NAPI_CORE_H
|
#define __INCLUDE_NAPI_CORE_H
|
||||||
|
|
||||||
|
#include "../ntoskrnl/include/internal/ke.h"
|
||||||
|
|
||||||
#define MM_CORE_DUMP_HEADER_MAGIC (0xdeafbead)
|
#define MM_CORE_DUMP_HEADER_MAGIC (0xdeafbead)
|
||||||
#define MM_CORE_DUMP_HEADER_VERSION (0x1)
|
#define MM_CORE_DUMP_HEADER_VERSION (0x1)
|
||||||
|
#define MM_CORE_DUMP_TYPE_MINIMAL (0x1)
|
||||||
|
#define MM_CORE_DUMP_TYPE_FULL (0x2)
|
||||||
|
|
||||||
typedef struct _MM_CORE_DUMP_HEADER
|
typedef struct _MM_CORE_DUMP_HEADER
|
||||||
{
|
{
|
||||||
ULONG Magic;
|
ULONG Magic;
|
||||||
ULONG Version;
|
ULONG Version;
|
||||||
CONTEXT Context;
|
ULONG Type;
|
||||||
ULONG DumpLength;
|
KTRAP_FRAME TrapFrame;
|
||||||
ULONG BugCode;
|
ULONG BugCheckCode;
|
||||||
ULONG ExceptionCode;
|
ULONG BugCheckParameters[4];
|
||||||
ULONG Cr2;
|
PVOID FaultingStackBase;
|
||||||
ULONG Cr3;
|
ULONG FaultingStackSize;
|
||||||
|
ULONG PhysicalMemorySize;
|
||||||
} MM_CORE_DUMP_HEADER, *PMM_CORE_DUMP_HEADER;
|
} MM_CORE_DUMP_HEADER, *PMM_CORE_DUMP_HEADER;
|
||||||
|
|
||||||
|
typedef struct _MM_DUMP_POINTERS
|
||||||
|
{
|
||||||
|
PVOID Context;
|
||||||
|
NTSTATUS (*DeviceInit)(PVOID Context);
|
||||||
|
NTSTATUS (*DeviceWrite)(PVOID Context, ULONG Block, PMDL Mdl);
|
||||||
|
NTSTATUS (*DeviceFinish)(PVOID Context);
|
||||||
|
} MM_DUMP_POINTERS, *PMM_DUMP_POINTERS;
|
||||||
|
|
||||||
|
#define FSCTL_GET_DUMP_BLOCK_MAP (('R' << 24) | 0xF1)
|
||||||
|
#define IOCTL_GET_DUMP_POINTERS (('R' << 24) | 0xF2)
|
||||||
|
|
||||||
#endif /* __INCLUDE_NAPI_CORE_H */
|
#endif /* __INCLUDE_NAPI_CORE_H */
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
#define USER32_CALLBACK_SENDNCCREATE (2)
|
#define USER32_CALLBACK_SENDNCCREATE (2)
|
||||||
#define USER32_CALLBACK_SENDNCCALCSIZE (3)
|
#define USER32_CALLBACK_SENDNCCALCSIZE (3)
|
||||||
#define USER32_CALLBACK_SENDCREATE (4)
|
#define USER32_CALLBACK_SENDCREATE (4)
|
||||||
#define USER32_CALLBACK_MAXIMUM (5)
|
#define USER32_CALLBACK_SENDGETMINMAXINFO (5)
|
||||||
|
#define USER32_CALLBACK_MAXIMUM (6)
|
||||||
|
|
||||||
typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
|
typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
|
||||||
{
|
{
|
||||||
|
@ -29,14 +30,14 @@ typedef struct _SENDASYNCPROC_CALLBACK_ARGUMENTS
|
||||||
typedef struct _SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS
|
typedef struct _SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS
|
||||||
{
|
{
|
||||||
HWND Wnd;
|
HWND Wnd;
|
||||||
CREATESTRUCT CreateStruct;
|
CREATESTRUCTW CreateStruct;
|
||||||
} SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS,
|
} SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS,
|
||||||
*PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS;
|
*PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS;
|
||||||
|
|
||||||
typedef struct _SENDCREATEMESSAGE_CALLBACK_ARGUMENTS
|
typedef struct _SENDCREATEMESSAGE_CALLBACK_ARGUMENTS
|
||||||
{
|
{
|
||||||
HWND Wnd;
|
HWND Wnd;
|
||||||
CREATESTRUCT CreateStruct;
|
CREATESTRUCTW CreateStruct;
|
||||||
} SENDCREATEMESSAGE_CALLBACK_ARGUMENTS, *PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS;
|
} SENDCREATEMESSAGE_CALLBACK_ARGUMENTS, *PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS;
|
||||||
|
|
||||||
typedef struct _SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS
|
typedef struct _SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS
|
||||||
|
@ -56,6 +57,18 @@ typedef struct _SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT
|
||||||
} SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT,
|
} SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT,
|
||||||
*PSENDNCCALCSIZEMESSAGE_CALLBACK_RESULT;
|
*PSENDNCCALCSIZEMESSAGE_CALLBACK_RESULT;
|
||||||
|
|
||||||
|
typedef struct _SENDGETMINMAXINFO_CALLBACK_ARGUMENTS
|
||||||
|
{
|
||||||
|
HWND Wnd;
|
||||||
|
MINMAXINFO MinMaxInfo;
|
||||||
|
} SENDGETMINMAXINFO_CALLBACK_ARGUMENTS, *PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS;
|
||||||
|
|
||||||
|
typedef struct _SENDGETMINMAXINFO_CALLBACK_RESULT
|
||||||
|
{
|
||||||
|
LRESULT Result;
|
||||||
|
MINMAXINFO MinMaxInfo;
|
||||||
|
} SENDGETMINMAXINFO_CALLBACK_RESULT, *PSENDGETMINMAXINFO_CALLBACK_RESULT;
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
|
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
|
@ -64,5 +77,7 @@ NTSTATUS STDCALL
|
||||||
User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
|
User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
|
User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
|
||||||
|
|
||||||
#endif /* __INCLUDE_USER32_CALLBACK_H */
|
#endif /* __INCLUDE_USER32_CALLBACK_H */
|
||||||
|
|
|
@ -28,6 +28,8 @@ INT STDCALL
|
||||||
W32kGetBoxRgn(HRGN hRgn, PRECT Rect);
|
W32kGetBoxRgn(HRGN hRgn, PRECT Rect);
|
||||||
HRGN STDCALL
|
HRGN STDCALL
|
||||||
W32kCropRgn(HRGN hDest, HRGN hSrc, const RECT* Rect, const POINT* Point);
|
W32kCropRgn(HRGN hDest, HRGN hSrc, const RECT* Rect, const POINT* Point);
|
||||||
|
HRGN STDCALL
|
||||||
|
W32kUnionRectWithRgn(HRGN hDest, const RECT* Rect);
|
||||||
|
|
||||||
INT
|
INT
|
||||||
STDCALL
|
STDCALL
|
||||||
|
|
|
@ -59,6 +59,8 @@ Init(VOID)
|
||||||
(PVOID)User32SendNCCREATEMessageForKernel;
|
(PVOID)User32SendNCCREATEMessageForKernel;
|
||||||
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDCREATE] =
|
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDCREATE] =
|
||||||
(PVOID)User32SendCREATEMessageForKernel;
|
(PVOID)User32SendCREATEMessageForKernel;
|
||||||
|
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDGETMINMAXINFO] =
|
||||||
|
(PVOID)User32SendGETMINMAXINFOMessageForKernel;
|
||||||
|
|
||||||
//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);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: window.c,v 1.7 2002/07/04 19:56:34 dwelch Exp $
|
/* $Id: window.c,v 1.8 2002/07/17 21:04:54 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
|
||||||
|
@ -19,6 +19,31 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
|
{
|
||||||
|
PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS CallbackArgs;
|
||||||
|
SENDGETMINMAXINFO_CALLBACK_RESULT Result;
|
||||||
|
WNDPROC Proc;
|
||||||
|
|
||||||
|
DbgPrint("User32SendGETMINAXINFOMessageForKernel.\n");
|
||||||
|
CallbackArgs = (PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS)Arguments;
|
||||||
|
if (ArgumentLength != sizeof(SENDGETMINMAXINFO_CALLBACK_ARGUMENTS))
|
||||||
|
{
|
||||||
|
DbgPrint("Wrong length.\n");
|
||||||
|
return(STATUS_INFO_LENGTH_MISMATCH);
|
||||||
|
}
|
||||||
|
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
|
||||||
|
DbgPrint("Proc %X\n", Proc);
|
||||||
|
/* Call the window procedure; notice kernel messages are always unicode. */
|
||||||
|
Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_GETMINMAXINFO,
|
||||||
|
0, (LPARAM)&CallbackArgs->MinMaxInfo);
|
||||||
|
Result.MinMaxInfo = CallbackArgs->MinMaxInfo;
|
||||||
|
DbgPrint("Returning result %d.\n", Result);
|
||||||
|
ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS);
|
||||||
|
/* Doesn't return. */
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
|
User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: copy.c,v 1.6 2002/06/10 21:11:56 hbirr Exp $
|
/* $Id: copy.c,v 1.7 2002/07/17 21:04:55 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -84,7 +84,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
|
||||||
CcRosReleaseCacheSegment(Bcb, previous, TRUE, FALSE, FALSE);
|
CcRosReleaseCacheSegment(Bcb, previous, TRUE, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Otherwise read in a much as we can.
|
* Otherwise read in as much as we can.
|
||||||
*/
|
*/
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -194,7 +194,8 @@ ReadCacheSegment(PCACHE_SEGMENT CacheSeg)
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS WriteCacheSegment(PCACHE_SEGMENT CacheSeg)
|
NTSTATUS
|
||||||
|
WriteCacheSegment(PCACHE_SEGMENT CacheSeg)
|
||||||
{
|
{
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
PMDL Mdl;
|
PMDL Mdl;
|
||||||
|
@ -202,6 +203,7 @@ NTSTATUS WriteCacheSegment(PCACHE_SEGMENT CacheSeg)
|
||||||
IO_STATUS_BLOCK IoStatus;
|
IO_STATUS_BLOCK IoStatus;
|
||||||
LARGE_INTEGER SegOffset;
|
LARGE_INTEGER SegOffset;
|
||||||
|
|
||||||
|
CacheSeg->Dirty = FALSE;
|
||||||
SegOffset.QuadPart = CacheSeg->FileOffset;
|
SegOffset.QuadPart = CacheSeg->FileOffset;
|
||||||
Size = CacheSeg->Bcb->AllocationSize.QuadPart - CacheSeg->FileOffset;
|
Size = CacheSeg->Bcb->AllocationSize.QuadPart - CacheSeg->FileOffset;
|
||||||
if (Size > CacheSeg->Bcb->CacheSegmentSize)
|
if (Size > CacheSeg->Bcb->CacheSegmentSize)
|
||||||
|
@ -210,12 +212,15 @@ NTSTATUS WriteCacheSegment(PCACHE_SEGMENT CacheSeg)
|
||||||
}
|
}
|
||||||
Mdl = MmCreateMdl(NULL, CacheSeg->BaseAddress, Size);
|
Mdl = MmCreateMdl(NULL, CacheSeg->BaseAddress, Size);
|
||||||
MmBuildMdlForNonPagedPool(Mdl);
|
MmBuildMdlForNonPagedPool(Mdl);
|
||||||
Status = IoPageWrite(CacheSeg->Bcb->FileObject, Mdl, &SegOffset, &IoStatus, TRUE);
|
Status = IoPageWrite(CacheSeg->Bcb->FileObject, Mdl, &SegOffset, &IoStatus,
|
||||||
|
TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("IoPageWrite failed, Status %x\n", Status);
|
DPRINT1("IoPageWrite failed, Status %x\n", Status);
|
||||||
|
CacheSeg->Dirty = TRUE;
|
||||||
|
return(Status);
|
||||||
}
|
}
|
||||||
return Status;
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN STDCALL
|
BOOLEAN STDCALL
|
||||||
|
@ -308,7 +313,6 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
|
||||||
ReadOffset += TempLength;
|
ReadOffset += TempLength;
|
||||||
Buffer += TempLength;
|
Buffer += TempLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Length > 0)
|
while (Length > 0)
|
||||||
{
|
{
|
||||||
TempLength = min(max(Bcb->CacheSegmentSize, 65536), Length);
|
TempLength = min(max(Bcb->CacheSegmentSize, 65536), Length);
|
||||||
|
@ -325,8 +329,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN STDCALL
|
BOOLEAN STDCALL
|
||||||
CcCopyWrite (
|
CcCopyWrite (IN PFILE_OBJECT FileObject,
|
||||||
IN PFILE_OBJECT FileObject,
|
|
||||||
IN PLARGE_INTEGER FileOffset,
|
IN PLARGE_INTEGER FileOffset,
|
||||||
IN ULONG Length,
|
IN ULONG Length,
|
||||||
IN BOOLEAN Wait,
|
IN BOOLEAN Wait,
|
||||||
|
@ -351,20 +354,24 @@ CcCopyWrite (
|
||||||
|
|
||||||
if (!Wait)
|
if (!Wait)
|
||||||
{
|
{
|
||||||
// testing, if the requested datas are available
|
/* testing, if the requested datas are available */
|
||||||
KeAcquireSpinLock(&Bcb->BcbLock, &oldirql);
|
KeAcquireSpinLock(&Bcb->BcbLock, &oldirql);
|
||||||
current_entry = Bcb->BcbSegmentListHead.Flink;
|
current_entry = Bcb->BcbSegmentListHead.Flink;
|
||||||
while (current_entry != &Bcb->BcbSegmentListHead)
|
while (current_entry != &Bcb->BcbSegmentListHead)
|
||||||
{
|
{
|
||||||
CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
|
CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
|
||||||
|
BcbSegmentListEntry);
|
||||||
if (!CacheSeg->Valid)
|
if (!CacheSeg->Valid)
|
||||||
{
|
{
|
||||||
if ((WriteOffset >= CacheSeg->FileOffset && WriteOffset < CacheSeg->FileOffset + Bcb->CacheSegmentSize)
|
if ((WriteOffset >= CacheSeg->FileOffset &&
|
||||||
|| (WriteOffset + Length > CacheSeg->FileOffset && WriteOffset + Length <= CacheSeg->FileOffset + Bcb->CacheSegmentSize))
|
WriteOffset < CacheSeg->FileOffset + Bcb->CacheSegmentSize)
|
||||||
|
|| (WriteOffset + Length > CacheSeg->FileOffset &&
|
||||||
|
WriteOffset + Length <= CacheSeg->FileOffset +
|
||||||
|
Bcb->CacheSegmentSize))
|
||||||
{
|
{
|
||||||
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
|
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
|
||||||
// datas not available
|
/* datas not available */
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
|
@ -375,27 +382,25 @@ CcCopyWrite (
|
||||||
TempLength = WriteOffset % Bcb->CacheSegmentSize;
|
TempLength = WriteOffset % Bcb->CacheSegmentSize;
|
||||||
if (TempLength != 0)
|
if (TempLength != 0)
|
||||||
{
|
{
|
||||||
|
ULONG ROffset;
|
||||||
|
ROffset = ROUND_DOWN(WriteOffset, Bcb->CacheSegmentSize);
|
||||||
TempLength = min (Length, Bcb->CacheSegmentSize - TempLength);
|
TempLength = min (Length, Bcb->CacheSegmentSize - TempLength);
|
||||||
Status = CcRosRequestCacheSegment(Bcb,
|
Status = CcRosRequestCacheSegment(Bcb, ROffset,
|
||||||
ROUND_DOWN(WriteOffset, Bcb->CacheSegmentSize),
|
|
||||||
&BaseAddress, &Valid, &CacheSeg);
|
&BaseAddress, &Valid, &CacheSeg);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
if (!Valid)
|
if (!Valid)
|
||||||
{
|
{
|
||||||
if (!NT_SUCCESS(ReadCacheSegment(CacheSeg)))
|
if (!NT_SUCCESS(ReadCacheSegment(CacheSeg)))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy (BaseAddress + WriteOffset % Bcb->CacheSegmentSize, Buffer, TempLength);
|
memcpy (BaseAddress + WriteOffset % Bcb->CacheSegmentSize,
|
||||||
if (!NT_SUCCESS(WriteCacheSegment(CacheSeg)))
|
Buffer, TempLength);
|
||||||
{
|
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, TRUE, FALSE);
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
|
|
||||||
|
|
||||||
Length -= TempLength;
|
Length -= TempLength;
|
||||||
WriteOffset += TempLength;
|
WriteOffset += TempLength;
|
||||||
|
@ -409,7 +414,7 @@ CcCopyWrite (
|
||||||
&BaseAddress, &Valid, &CacheSeg);
|
&BaseAddress, &Valid, &CacheSeg);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
if (!Valid && TempLength < Bcb->CacheSegmentSize)
|
if (!Valid && TempLength < Bcb->CacheSegmentSize)
|
||||||
{
|
{
|
||||||
|
@ -419,25 +424,19 @@ CcCopyWrite (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy (BaseAddress, Buffer, TempLength);
|
memcpy (BaseAddress, Buffer, TempLength);
|
||||||
if (!NT_SUCCESS(WriteCacheSegment(CacheSeg)))
|
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, TRUE, FALSE);
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
|
|
||||||
Length -= TempLength;
|
Length -= TempLength;
|
||||||
WriteOffset += TempLength;
|
WriteOffset += TempLength;
|
||||||
Buffer += TempLength;
|
Buffer += TempLength;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN STDCALL
|
BOOLEAN STDCALL
|
||||||
CcZeroData (
|
CcZeroData (IN PFILE_OBJECT FileObject,
|
||||||
IN PFILE_OBJECT FileObject,
|
|
||||||
IN PLARGE_INTEGER StartOffset,
|
IN PLARGE_INTEGER StartOffset,
|
||||||
IN PLARGE_INTEGER EndOffset,
|
IN PLARGE_INTEGER EndOffset,
|
||||||
IN BOOLEAN Wait
|
IN BOOLEAN Wait)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
LARGE_INTEGER WriteOffset;
|
LARGE_INTEGER WriteOffset;
|
||||||
|
@ -446,37 +445,42 @@ CcZeroData (
|
||||||
ULONG i;
|
ULONG i;
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
|
||||||
DPRINT("CcZeroData(FileObject %x, StartOffset %I64x, EndOffset %I64x, Wait %d\n",
|
DPRINT("CcZeroData(FileObject %x, StartOffset %I64x, EndOffset %I64x, "
|
||||||
FileObject, StartOffset->QuadPart, EndOffset->QuadPart, Wait);
|
"Wait %d\n", FileObject, StartOffset->QuadPart, EndOffset->QuadPart,
|
||||||
|
Wait);
|
||||||
|
|
||||||
Length = EndOffset->u.LowPart - StartOffset->u.LowPart;
|
Length = EndOffset->u.LowPart - StartOffset->u.LowPart;
|
||||||
|
|
||||||
// FIXME: NT uses the shared chache map field for cached/non cached detection
|
/*
|
||||||
|
* FIXME: NT uses the shared cache map field for cached/non cached detection
|
||||||
|
*/
|
||||||
if (((PREACTOS_COMMON_FCB_HEADER)FileObject->FsContext)->Bcb == NULL)
|
if (((PREACTOS_COMMON_FCB_HEADER)FileObject->FsContext)->Bcb == NULL)
|
||||||
{
|
{
|
||||||
// File is not cached
|
/* File is not cached */
|
||||||
|
|
||||||
CHECKPOINT;
|
|
||||||
|
|
||||||
WriteOffset.QuadPart = StartOffset->QuadPart;
|
WriteOffset.QuadPart = StartOffset->QuadPart;
|
||||||
|
|
||||||
while (Length > 0)
|
while (Length > 0)
|
||||||
{
|
{
|
||||||
if (Length + WriteOffset.u.LowPart % PAGESIZE > 262144)
|
if (Length + WriteOffset.u.LowPart % PAGESIZE > 262144)
|
||||||
{
|
{
|
||||||
Mdl = MmCreateMdl(NULL, (PVOID)WriteOffset.u.LowPart, 262144 - WriteOffset.u.LowPart % PAGESIZE);
|
Mdl = MmCreateMdl(NULL, (PVOID)WriteOffset.u.LowPart,
|
||||||
WriteOffset.QuadPart += (262144 - WriteOffset.u.LowPart % PAGESIZE);
|
262144 - WriteOffset.u.LowPart % PAGESIZE);
|
||||||
|
WriteOffset.QuadPart +=
|
||||||
|
(262144 - WriteOffset.u.LowPart % PAGESIZE);
|
||||||
Length -= (262144 - WriteOffset.u.LowPart % PAGESIZE);
|
Length -= (262144 - WriteOffset.u.LowPart % PAGESIZE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mdl = MmCreateMdl(NULL, (PVOID)WriteOffset.u.LowPart, Length - WriteOffset.u.LowPart % PAGESIZE);
|
Mdl =
|
||||||
WriteOffset.QuadPart += (Length - WriteOffset.u.LowPart % PAGESIZE);
|
MmCreateMdl(NULL, (PVOID)WriteOffset.u.LowPart,
|
||||||
|
Length - WriteOffset.u.LowPart % PAGESIZE);
|
||||||
|
WriteOffset.QuadPart +=
|
||||||
|
(Length - WriteOffset.u.LowPart % PAGESIZE);
|
||||||
Length = 0;
|
Length = 0;
|
||||||
}
|
}
|
||||||
if (Mdl == NULL)
|
if (Mdl == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
Mdl->MdlFlags |= (MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
|
Mdl->MdlFlags |= (MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
|
||||||
for (i = 0; i < ((Mdl->Size - sizeof(MDL)) / sizeof(ULONG)); i++)
|
for (i = 0; i < ((Mdl->Size - sizeof(MDL)) / sizeof(ULONG)); i++)
|
||||||
|
@ -486,13 +490,13 @@ CcZeroData (
|
||||||
Status = IoPageWrite(FileObject, Mdl, StartOffset, &Iosb, TRUE);
|
Status = IoPageWrite(FileObject, Mdl, StartOffset, &Iosb, TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// File is cached
|
/* File is cached */
|
||||||
KIRQL oldirql;
|
KIRQL oldirql;
|
||||||
PBCB Bcb;
|
PBCB Bcb;
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
|
@ -503,26 +507,28 @@ CcZeroData (
|
||||||
ULONG size;
|
ULONG size;
|
||||||
PHYSICAL_ADDRESS page;
|
PHYSICAL_ADDRESS page;
|
||||||
|
|
||||||
CHECKPOINT;
|
|
||||||
Start = StartOffset->u.LowPart;
|
Start = StartOffset->u.LowPart;
|
||||||
Bcb = ((REACTOS_COMMON_FCB_HEADER*)FileObject->FsContext)->Bcb;
|
Bcb = ((REACTOS_COMMON_FCB_HEADER*)FileObject->FsContext)->Bcb;
|
||||||
if (Wait)
|
if (Wait)
|
||||||
{
|
{
|
||||||
// testing, if the requested datas are available
|
/* testing, if the requested datas are available */
|
||||||
KeAcquireSpinLock(&Bcb->BcbLock, &oldirql);
|
KeAcquireSpinLock(&Bcb->BcbLock, &oldirql);
|
||||||
current_entry = Bcb->BcbSegmentListHead.Flink;
|
current_entry = Bcb->BcbSegmentListHead.Flink;
|
||||||
while (current_entry != &Bcb->BcbSegmentListHead)
|
while (current_entry != &Bcb->BcbSegmentListHead)
|
||||||
{
|
{
|
||||||
CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
|
CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
|
||||||
|
BcbSegmentListEntry);
|
||||||
if (!CacheSeg->Valid)
|
if (!CacheSeg->Valid)
|
||||||
{
|
{
|
||||||
if ((Start >= CacheSeg->FileOffset && Start < CacheSeg->FileOffset + Bcb->CacheSegmentSize)
|
if ((Start >= CacheSeg->FileOffset &&
|
||||||
|
Start < CacheSeg->FileOffset + Bcb->CacheSegmentSize)
|
||||||
|| (Start + Length > CacheSeg->FileOffset &&
|
|| (Start + Length > CacheSeg->FileOffset &&
|
||||||
Start + Length <= CacheSeg->FileOffset + Bcb->CacheSegmentSize))
|
Start + Length <=
|
||||||
|
CacheSeg->FileOffset + Bcb->CacheSegmentSize))
|
||||||
{
|
{
|
||||||
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
|
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
|
||||||
// datas not available
|
/* datas not available */
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
|
@ -532,6 +538,7 @@ CcZeroData (
|
||||||
|
|
||||||
while (Length > 0)
|
while (Length > 0)
|
||||||
{
|
{
|
||||||
|
ULONG RStart = ROUND_DOWN(Start, Bcb->CacheSegmentSize);
|
||||||
WriteOffset.QuadPart = ROUND_DOWN(Start, Bcb->CacheSegmentSize);
|
WriteOffset.QuadPart = ROUND_DOWN(Start, Bcb->CacheSegmentSize);
|
||||||
if (Start % Bcb->CacheSegmentSize + Length > 262144)
|
if (Start % Bcb->CacheSegmentSize + Length > 262144)
|
||||||
{
|
{
|
||||||
|
@ -540,32 +547,33 @@ CcZeroData (
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
Status = CcRosGetCacheSegmentChain (Bcb, ROUND_DOWN(Start, Bcb->CacheSegmentSize),
|
Status = CcRosGetCacheSegmentChain (Bcb, RStart,
|
||||||
262144, &CacheSeg);
|
262144, &CacheSeg);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePool(Mdl);
|
ExFreePool(Mdl);
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mdl = MmCreateMdl(NULL, (PVOID)ROUND_DOWN(Start, Bcb->CacheSegmentSize),
|
ULONG RLength;
|
||||||
ROUND_UP(Start % Bcb->CacheSegmentSize + Length, Bcb->CacheSegmentSize));
|
Mdl = MmCreateMdl(NULL, (PVOID)RStart,
|
||||||
|
ROUND_UP(Start % Bcb->CacheSegmentSize +
|
||||||
|
Length, Bcb->CacheSegmentSize));
|
||||||
if (Mdl == NULL)
|
if (Mdl == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
Status = CcRosGetCacheSegmentChain (Bcb, ROUND_DOWN(Start, Bcb->CacheSegmentSize),
|
RLength = ROUND_UP(RStart + Length, Bcb->CacheSegmentSize);
|
||||||
min(ROUND_UP(Start % Bcb->CacheSegmentSize
|
RLength = min(RLength, Bcb->AllocationSize.u.LowPart);
|
||||||
+ Length, Bcb->CacheSegmentSize),
|
RLength -= RStart;
|
||||||
Bcb->AllocationSize.u.LowPart
|
Status = CcRosGetCacheSegmentChain (Bcb, RStart, RLength,
|
||||||
- ROUND_DOWN(Start, Bcb->CacheSegmentSize)),
|
|
||||||
&CacheSeg);
|
&CacheSeg);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePool(Mdl);
|
ExFreePool(Mdl);
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mdl->MdlFlags |= (MDL_PAGES_LOCKED|MDL_IO_PAGE_READ);
|
Mdl->MdlFlags |= (MDL_PAGES_LOCKED|MDL_IO_PAGE_READ);
|
||||||
|
@ -573,20 +581,24 @@ CcZeroData (
|
||||||
count = 0;
|
count = 0;
|
||||||
while (current != NULL)
|
while (current != NULL)
|
||||||
{
|
{
|
||||||
if (Start % Bcb->CacheSegmentSize ||
|
if ((Start % Bcb->CacheSegmentSize) != 0 ||
|
||||||
Start % Bcb->CacheSegmentSize + Length < Bcb->CacheSegmentSize)
|
Start % Bcb->CacheSegmentSize + Length <
|
||||||
|
Bcb->CacheSegmentSize)
|
||||||
{
|
{
|
||||||
if (!current->Valid)
|
if (!current->Valid)
|
||||||
{
|
{
|
||||||
// Segment lesen
|
/* Segment lesen */
|
||||||
Status = ReadCacheSegment(current);
|
Status = ReadCacheSegment(current);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("ReadCacheSegment failed, status %x\n", Status);
|
DPRINT1("ReadCacheSegment failed, status %x\n",
|
||||||
|
Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TempLength = min (Length, Bcb->CacheSegmentSize - Start % Bcb->CacheSegmentSize);
|
TempLength = min (Length, Bcb->CacheSegmentSize -
|
||||||
memset (current->BaseAddress + Start % Bcb->CacheSegmentSize, 0, TempLength);
|
Start % Bcb->CacheSegmentSize);
|
||||||
|
memset (current->BaseAddress + Start % Bcb->CacheSegmentSize,
|
||||||
|
0, TempLength);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -597,15 +609,19 @@ CcZeroData (
|
||||||
Length -= TempLength;
|
Length -= TempLength;
|
||||||
|
|
||||||
size = ((Mdl->Size - sizeof(MDL)) / sizeof(ULONG));
|
size = ((Mdl->Size - sizeof(MDL)) / sizeof(ULONG));
|
||||||
for (i = 0; i < (Bcb->CacheSegmentSize / PAGESIZE) && count < size; i++)
|
for (i = 0; i < (Bcb->CacheSegmentSize / PAGESIZE) &&
|
||||||
|
count < size; i++)
|
||||||
{
|
{
|
||||||
page = MmGetPhysicalAddressForProcess(NULL, current->BaseAddress + (i * PAGESIZE));
|
PVOID Address;
|
||||||
|
Address = current->BaseAddress + (i * PAGESIZE);
|
||||||
|
page =
|
||||||
|
MmGetPhysicalAddressForProcess(NULL, Address);
|
||||||
((PULONG)(Mdl + 1))[count++] = page.u.LowPart;
|
((PULONG)(Mdl + 1))[count++] = page.u.LowPart;
|
||||||
}
|
}
|
||||||
current = current->NextInChain;
|
current = current->NextInChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the Segment
|
/* Write the Segment */
|
||||||
Status = IoPageWrite(FileObject, Mdl, &WriteOffset, &Iosb, TRUE);
|
Status = IoPageWrite(FileObject, Mdl, &WriteOffset, &Iosb, TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -620,6 +636,6 @@ CcZeroData (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,7 @@ CcMdlReadComplete (IN PFILE_OBJECT FileObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
CcSetFileSizes (
|
CcSetFileSizes (IN PFILE_OBJECT FileObject,
|
||||||
IN PFILE_OBJECT FileObject,
|
|
||||||
IN PCC_FILE_SIZES FileSizes)
|
IN PCC_FILE_SIZES FileSizes)
|
||||||
{
|
{
|
||||||
KIRQL oldirql;
|
KIRQL oldirql;
|
||||||
|
@ -75,7 +74,8 @@ CcSetFileSizes (
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
PCACHE_SEGMENT current;
|
PCACHE_SEGMENT current;
|
||||||
|
|
||||||
DPRINT("CcSetFileSizes(FileObject %x, FileSizes %x)\n", FileObject, FileSizes);
|
DPRINT("CcSetFileSizes(FileObject %x, FileSizes %x)\n",
|
||||||
|
FileObject, FileSizes);
|
||||||
DPRINT("AllocationSize %d, FileSize %d, ValidDataLength %d\n",
|
DPRINT("AllocationSize %d, FileSize %d, ValidDataLength %d\n",
|
||||||
(ULONG)FileSizes->AllocationSize.QuadPart,
|
(ULONG)FileSizes->AllocationSize.QuadPart,
|
||||||
(ULONG)FileSizes->FileSize.QuadPart,
|
(ULONG)FileSizes->FileSize.QuadPart,
|
||||||
|
@ -90,7 +90,8 @@ CcSetFileSizes (
|
||||||
current_entry = Bcb->BcbSegmentListHead.Flink;
|
current_entry = Bcb->BcbSegmentListHead.Flink;
|
||||||
while (current_entry != &Bcb->BcbSegmentListHead)
|
while (current_entry != &Bcb->BcbSegmentListHead)
|
||||||
{
|
{
|
||||||
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
|
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
|
||||||
|
BcbSegmentListEntry);
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
if (current->FileOffset > FileSizes->AllocationSize.QuadPart)
|
if (current->FileOffset > FileSizes->AllocationSize.QuadPart)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: pin.c,v 1.2 2001/12/29 14:32:21 dwelch Exp $
|
/* $Id: pin.c,v 1.3 2002/07/17 21:04:55 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -32,12 +32,10 @@ typedef struct _INTERNAL_BCB
|
||||||
{
|
{
|
||||||
PUBLIC_BCB PFCB;
|
PUBLIC_BCB PFCB;
|
||||||
PCACHE_SEGMENT CacheSegment;
|
PCACHE_SEGMENT CacheSegment;
|
||||||
}
|
} INTERNAL_BCB, *PINTERNAL_BCB;
|
||||||
INTERNAL_BCB, *PINTERNAL_BCB;
|
|
||||||
|
|
||||||
BOOLEAN STDCALL
|
BOOLEAN STDCALL
|
||||||
CcMapData (
|
CcMapData (IN PFILE_OBJECT FileObject,
|
||||||
IN PFILE_OBJECT FileObject,
|
|
||||||
IN PLARGE_INTEGER FileOffset,
|
IN PLARGE_INTEGER FileOffset,
|
||||||
IN ULONG Length,
|
IN ULONG Length,
|
||||||
IN BOOLEAN Wait,
|
IN BOOLEAN Wait,
|
||||||
|
@ -50,6 +48,7 @@ CcMapData (
|
||||||
PCACHE_SEGMENT CacheSeg;
|
PCACHE_SEGMENT CacheSeg;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PINTERNAL_BCB iBcb;
|
PINTERNAL_BCB iBcb;
|
||||||
|
ULONG ROffset;
|
||||||
|
|
||||||
DPRINT("CcMapData(FileObject %x, FileOffset %d, Length %d, Wait %d,"
|
DPRINT("CcMapData(FileObject %x, FileOffset %d, Length %d, Wait %d,"
|
||||||
" pBcb %x, pBuffer %x)\n", FileObject, (ULONG)FileOffset->QuadPart,
|
" pBcb %x, pBuffer %x)\n", FileObject, (ULONG)FileOffset->QuadPart,
|
||||||
|
@ -64,27 +63,28 @@ CcMapData (
|
||||||
|
|
||||||
if (ReadOffset % Bcb->CacheSegmentSize + Length > Bcb->CacheSegmentSize)
|
if (ReadOffset % Bcb->CacheSegmentSize + Length > Bcb->CacheSegmentSize)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
ROffset = ROUND_DOWN (ReadOffset, Bcb->CacheSegmentSize);
|
||||||
Status = CcRosRequestCacheSegment(Bcb,
|
Status = CcRosRequestCacheSegment(Bcb,
|
||||||
ROUND_DOWN (ReadOffset, Bcb->CacheSegmentSize),
|
ROffset,
|
||||||
pBuffer,
|
pBuffer,
|
||||||
&Valid,
|
&Valid,
|
||||||
&CacheSeg);
|
&CacheSeg);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
if (!Valid)
|
if (!Valid)
|
||||||
{
|
{
|
||||||
if (!Wait)
|
if (!Wait)
|
||||||
{
|
{
|
||||||
CcRosReleaseCacheSegment(Bcb, CacheSeg, FALSE, FALSE, FALSE);
|
CcRosReleaseCacheSegment(Bcb, CacheSeg, FALSE, FALSE, FALSE);
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(ReadCacheSegment(CacheSeg)))
|
if (!NT_SUCCESS(ReadCacheSegment(CacheSeg)))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*pBuffer += ReadOffset % Bcb->CacheSegmentSize;
|
*pBuffer += ReadOffset % Bcb->CacheSegmentSize;
|
||||||
|
@ -98,25 +98,24 @@ CcMapData (
|
||||||
iBcb->PFCB.MappedLength = Length;
|
iBcb->PFCB.MappedLength = Length;
|
||||||
iBcb->PFCB.MappedFileOffset.QuadPart = FileOffset->QuadPart;
|
iBcb->PFCB.MappedFileOffset.QuadPart = FileOffset->QuadPart;
|
||||||
*pBcb = (PVOID)iBcb;
|
*pBcb = (PVOID)iBcb;
|
||||||
return TRUE;
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
CcUnpinData (
|
CcUnpinData (IN PVOID Bcb)
|
||||||
IN PVOID Bcb)
|
|
||||||
{
|
{
|
||||||
PINTERNAL_BCB iBcb = Bcb;
|
PINTERNAL_BCB iBcb = Bcb;
|
||||||
CcRosReleaseCacheSegment(iBcb->CacheSegment->Bcb, iBcb->CacheSegment, TRUE, FALSE, FALSE);
|
CcRosReleaseCacheSegment(iBcb->CacheSegment->Bcb, iBcb->CacheSegment, TRUE,
|
||||||
|
FALSE, FALSE);
|
||||||
ExFreePool(iBcb);
|
ExFreePool(iBcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
CcSetDirtyPinnedData (
|
CcSetDirtyPinnedData (IN PVOID Bcb,
|
||||||
IN PVOID Bcb,
|
|
||||||
IN PLARGE_INTEGER Lsn)
|
IN PLARGE_INTEGER Lsn)
|
||||||
{
|
{
|
||||||
PINTERNAL_BCB iBcb = Bcb;
|
PINTERNAL_BCB iBcb = Bcb;
|
||||||
// FIXME: write only the modifyed 4-pages back
|
/* FIXME: write only the modifyed 4-pages back */
|
||||||
WriteCacheSegment(iBcb->CacheSegment);
|
WriteCacheSegment(iBcb->CacheSegment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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: view.c,v 1.43 2002/06/10 21:11:56 hbirr Exp $
|
/* $Id: view.c,v 1.44 2002/07/17 21:04:55 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -62,8 +62,6 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
extern void * alloca(size_t);
|
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
||||||
|
@ -144,6 +142,8 @@ CcRosReleaseCacheSegment(PBCB Bcb,
|
||||||
BOOLEAN Dirty,
|
BOOLEAN Dirty,
|
||||||
BOOLEAN Mapped)
|
BOOLEAN Mapped)
|
||||||
{
|
{
|
||||||
|
BOOLEAN WasDirty = CacheSeg->Dirty;
|
||||||
|
|
||||||
DPRINT("CcReleaseCachePage(Bcb %x, CacheSeg %x, Valid %d)\n",
|
DPRINT("CcReleaseCachePage(Bcb %x, CacheSeg %x, Valid %d)\n",
|
||||||
Bcb, CacheSeg, Valid);
|
Bcb, CacheSeg, Valid);
|
||||||
|
|
||||||
|
@ -155,6 +155,10 @@ CcRosReleaseCacheSegment(PBCB Bcb,
|
||||||
}
|
}
|
||||||
ExReleaseFastMutex(&CacheSeg->Lock);
|
ExReleaseFastMutex(&CacheSeg->Lock);
|
||||||
ExAcquireFastMutex(&ViewLock);
|
ExAcquireFastMutex(&ViewLock);
|
||||||
|
if (!WasDirty && CacheSeg->Dirty)
|
||||||
|
{
|
||||||
|
InsertTailList(&DirtySegmentListHead, &CacheSeg->DirtySegmentListEntry);
|
||||||
|
}
|
||||||
RemoveEntryList(&CacheSeg->CacheSegmentLRUListEntry);
|
RemoveEntryList(&CacheSeg->CacheSegmentLRUListEntry);
|
||||||
InsertTailList(&CacheSegmentLRUListHead,
|
InsertTailList(&CacheSegmentLRUListHead,
|
||||||
&CacheSeg->CacheSegmentLRUListEntry);
|
&CacheSeg->CacheSegmentLRUListEntry);
|
||||||
|
@ -510,12 +514,35 @@ CcRosReleaseFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
PCACHE_SEGMENT current;
|
PCACHE_SEGMENT current;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("CcRosReleaseFileCache(FileObject %x, Bcb %x)\n", Bcb->FileObject,
|
DPRINT("CcRosReleaseFileCache(FileObject %x, Bcb %x)\n", Bcb->FileObject,
|
||||||
Bcb);
|
Bcb);
|
||||||
|
|
||||||
MmFreeSectionSegments(Bcb->FileObject);
|
MmFreeSectionSegments(Bcb->FileObject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write back dirty cache segments.
|
||||||
|
*/
|
||||||
|
current_entry = Bcb->BcbSegmentListHead.Flink;
|
||||||
|
while (current_entry != &Bcb->BcbSegmentListHead)
|
||||||
|
{
|
||||||
|
current =
|
||||||
|
CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
|
||||||
|
if (current->Dirty)
|
||||||
|
{
|
||||||
|
Status = WriteCacheSegment(current);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to write cache segment (Status %X)\n", Status);
|
||||||
|
}
|
||||||
|
ExAcquireFastMutex(&ViewLock);
|
||||||
|
RemoveEntryList(¤t->DirtySegmentListEntry);
|
||||||
|
ExReleaseFastMutex(&ViewLock);
|
||||||
|
}
|
||||||
|
current_entry = current_entry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Release all cache segments.
|
* Release all cache segments.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,6 +18,7 @@ typedef struct _WINSTATION_OBJECT
|
||||||
LIST_ENTRY DesktopListHead;
|
LIST_ENTRY DesktopListHead;
|
||||||
PRTL_ATOM_TABLE AtomTable;
|
PRTL_ATOM_TABLE AtomTable;
|
||||||
PVOID HandleTable;
|
PVOID HandleTable;
|
||||||
|
struct _DESKTOP_OBJECT* ActiveDesktop;
|
||||||
/* FIXME: Clipboard */
|
/* FIXME: Clipboard */
|
||||||
} WINSTATION_OBJECT, *PWINSTATION_OBJECT;
|
} WINSTATION_OBJECT, *PWINSTATION_OBJECT;
|
||||||
|
|
||||||
|
@ -28,8 +29,15 @@ typedef struct _DESKTOP_OBJECT
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
KSPIN_LOCK Lock;
|
KSPIN_LOCK Lock;
|
||||||
UNICODE_STRING Name;
|
UNICODE_STRING Name;
|
||||||
|
/* Pointer to the associated window station. */
|
||||||
struct _WINSTATION_OBJECT *WindowStation;
|
struct _WINSTATION_OBJECT *WindowStation;
|
||||||
|
/* Head of the list of windows in this desktop. */
|
||||||
LIST_ENTRY WindowListHead;
|
LIST_ENTRY WindowListHead;
|
||||||
|
/* Pointer to the active queue. */
|
||||||
|
PVOID ActiveMessageQueue;
|
||||||
|
/* Handle of the desktop window. */
|
||||||
|
HANDLE DesktopWindow;
|
||||||
|
HANDLE PrevActiveWindow;
|
||||||
} DESKTOP_OBJECT, *PDESKTOP_OBJECT;
|
} DESKTOP_OBJECT, *PDESKTOP_OBJECT;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -538,5 +538,13 @@ extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
|
||||||
PMM_PAGEOP
|
PMM_PAGEOP
|
||||||
MmCheckForPageOp(PMEMORY_AREA MArea, ULONG Pid, PVOID Address,
|
MmCheckForPageOp(PMEMORY_AREA MArea, ULONG Pid, PVOID Address,
|
||||||
PMM_SECTION_SEGMENT Segment, ULONG Offset);
|
PMM_SECTION_SEGMENT Segment, ULONG Offset);
|
||||||
|
struct _KTRAP_FRAME;
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
MmDumpToPagingFile(ULONG BugCode,
|
||||||
|
ULONG BugCodeParameter1,
|
||||||
|
ULONG BugCodeParameter2,
|
||||||
|
ULONG BugCodeParameter3,
|
||||||
|
ULONG BugCodeParameter4,
|
||||||
|
struct _KTRAP_FRAME* TrapFrame);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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: bug.c,v 1.23 2002/05/14 21:19:18 dwelch Exp $
|
/* $Id: bug.c,v 1.24 2002/07/17 21:04:55 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/bug.c
|
* FILE: ntoskrnl/ke/bug.c
|
||||||
|
@ -81,8 +81,13 @@ KeBugCheckWithTf(ULONG BugCheckCode,
|
||||||
ULONG BugCheckParameter4,
|
ULONG BugCheckParameter4,
|
||||||
PKTRAP_FRAME Tf)
|
PKTRAP_FRAME Tf)
|
||||||
{
|
{
|
||||||
|
KIRQL oldIrql;
|
||||||
|
KeRaiseIrql(HIGH_LEVEL, &oldIrql);
|
||||||
DbgPrint("Bug detected code: 0x%X\n", BugCheckCode);
|
DbgPrint("Bug detected code: 0x%X\n", BugCheckCode);
|
||||||
KiDumpTrapFrame(Tf, BugCheckParameter1, BugCheckParameter2);
|
KiDumpTrapFrame(Tf, BugCheckParameter1, BugCheckParameter2);
|
||||||
|
MmDumpToPagingFile(BugCheckCode, BugCheckParameter1,
|
||||||
|
BugCheckParameter2, BugCheckParameter3,
|
||||||
|
BugCheckParameter4, Tf);
|
||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +109,6 @@ KeBugCheckEx(ULONG BugCheckCode,
|
||||||
PRTL_MESSAGE_RESOURCE_ENTRY Message;
|
PRTL_MESSAGE_RESOURCE_ENTRY Message;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* PJS: disable interrupts first, then do the rest */
|
|
||||||
__asm__("cli\n\t");
|
__asm__("cli\n\t");
|
||||||
DbgPrint("Bug detected (code %x param %x %x %x %x)\n",
|
DbgPrint("Bug detected (code %x param %x %x %x %x)\n",
|
||||||
BugCheckCode,
|
BugCheckCode,
|
||||||
|
@ -150,8 +154,10 @@ KeBugCheckEx(ULONG BugCheckCode,
|
||||||
PsGetCurrentThread(),
|
PsGetCurrentThread(),
|
||||||
PsGetCurrentThread()->Cid.UniqueThread);
|
PsGetCurrentThread()->Cid.UniqueThread);
|
||||||
}
|
}
|
||||||
// PsDumpThreads();
|
|
||||||
KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
||||||
|
MmDumpToPagingFile(BugCheckCode, BugCheckParameter1,
|
||||||
|
BugCheckParameter2, BugCheckParameter3,
|
||||||
|
BugCheckParameter4, NULL);
|
||||||
|
|
||||||
if (KdDebuggerEnabled)
|
if (KdDebuggerEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -423,13 +423,15 @@ KiDoubleFaultHandler(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG ExceptionNr, ULONG cr2)
|
KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG Parameter1, ULONG Parameter2)
|
||||||
{
|
{
|
||||||
unsigned int cr3;
|
unsigned int cr3;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
ULONG StackLimit;
|
ULONG StackLimit;
|
||||||
PULONG Frame;
|
PULONG Frame;
|
||||||
ULONG Esp0;
|
ULONG Esp0;
|
||||||
|
ULONG ExceptionNr = (ULONG)Tf->DebugArgMark;
|
||||||
|
ULONG cr2 = (ULONG)Tf->DebugPointer;
|
||||||
|
|
||||||
Esp0 = (ULONG)Tf;
|
Esp0 = (ULONG)Tf;
|
||||||
|
|
||||||
|
@ -519,11 +521,15 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Esp0;
|
ULONG Esp0;
|
||||||
|
|
||||||
|
/* Store the exception number in an unused field in the trap frame. */
|
||||||
|
Tf->DebugArgMark = (PVOID)ExceptionNr;
|
||||||
|
|
||||||
/* Use the address of the trap frame as approximation to the ring0 esp */
|
/* Use the address of the trap frame as approximation to the ring0 esp */
|
||||||
Esp0 = (ULONG)&Tf->Eip;
|
Esp0 = (ULONG)&Tf->Eip;
|
||||||
|
|
||||||
/* Get CR2 */
|
/* Get CR2 */
|
||||||
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
|
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
|
||||||
|
Tf->DebugPointer = (PVOID)cr2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this was a V86 mode exception then handle it specially
|
* If this was a V86 mode exception then handle it specially
|
||||||
|
|
|
@ -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.12 2002/01/27 01:11:23 dwelch Exp $
|
/* $Id: trap.s,v 1.13 2002/07/17 21:04:55 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/i386/trap.s
|
* FILE: ntoskrnl/ke/i386/trap.s
|
||||||
|
@ -136,8 +136,9 @@ _KiTrapProlog:
|
||||||
pushl $0 /* XXX: TempCS */
|
pushl $0 /* XXX: TempCS */
|
||||||
pushl $0 /* XXX: DebugPointer */
|
pushl $0 /* XXX: DebugPointer */
|
||||||
pushl $0 /* XXX: DebugArgMark */
|
pushl $0 /* XXX: DebugArgMark */
|
||||||
pushl $0 /* XXX: DebugEIP */
|
movl 0x60(%esp), %ebx
|
||||||
pushl $0 /* XXX: DebugEBP */
|
pushl %ebx /* XXX: DebugEIP */
|
||||||
|
pushl %ebp /* XXX: DebugEBP */
|
||||||
|
|
||||||
/* Load the segment registers */
|
/* Load the segment registers */
|
||||||
movl $KERNEL_DS, %ebx
|
movl $KERNEL_DS, %ebx
|
||||||
|
@ -150,9 +151,13 @@ _KiTrapProlog:
|
||||||
movw %bx,%es
|
movw %bx,%es
|
||||||
|
|
||||||
movl %esp, %ebx
|
movl %esp, %ebx
|
||||||
|
movl %esp, %ebp
|
||||||
|
|
||||||
/* Save a pointer to the trap frame in the current KTHREAD */
|
/* Save a pointer to the trap frame in the current KTHREAD */
|
||||||
|
cmpl $0, %edi
|
||||||
|
je .L6
|
||||||
movl %ebx, %ss:KTHREAD_TRAP_FRAME(%edi)
|
movl %ebx, %ss:KTHREAD_TRAP_FRAME(%edi)
|
||||||
|
.L6:
|
||||||
|
|
||||||
/* Call the C exception handler */
|
/* Call the C exception handler */
|
||||||
pushl %esi
|
pushl %esi
|
||||||
|
|
|
@ -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: kthread.c,v 1.28 2002/07/10 15:13:33 ekohl Exp $
|
/* $Id: kthread.c,v 1.29 2002/07/17 21:04:55 dwelch Exp $
|
||||||
*
|
*
|
||||||
* FILE: ntoskrnl/ke/kthread.c
|
* FILE: ntoskrnl/ke/kthread.c
|
||||||
* PURPOSE: Microkernel thread support
|
* PURPOSE: Microkernel thread support
|
||||||
|
|
|
@ -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: main.c,v 1.128 2002/06/27 17:47:55 ekohl Exp $
|
/* $Id: main.c,v 1.129 2002/07/17 21:04:55 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/main.c
|
* FILE: ntoskrnl/ke/main.c
|
||||||
|
@ -613,6 +613,7 @@ ExpInitializeExecutive(VOID)
|
||||||
/*
|
/*
|
||||||
* Initalize services loaded at boot time
|
* Initalize services loaded at boot time
|
||||||
*/
|
*/
|
||||||
|
*(PULONG)0 = 0;
|
||||||
DPRINT("%d files loaded\n",KeLoaderBlock.ModsCount);
|
DPRINT("%d files loaded\n",KeLoaderBlock.ModsCount);
|
||||||
for (i=0; i < KeLoaderBlock.ModsCount; i++)
|
for (i=0; i < KeLoaderBlock.ModsCount; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: loader.c,v 1.115 2002/07/13 12:44:08 chorns Exp $
|
/* $Id: loader.c,v 1.116 2002/07/17 21:04:56 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -1554,7 +1554,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
||||||
CPRINT("Failed to allocate a virtual section for driver\n");
|
CPRINT("Failed to allocate a virtual section for driver\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
CPRINT("DriverBase: %x\n", DriverBase);
|
DbgPrint("DriverBase for %wZ: %x\n", FileName, DriverBase);
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
/* Copy headers over */
|
/* Copy headers over */
|
||||||
memcpy(DriverBase, ModuleLoadBase, PEOptionalHeader->SizeOfHeaders);
|
memcpy(DriverBase, ModuleLoadBase, PEOptionalHeader->SizeOfHeaders);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mminit.c,v 1.35 2002/06/04 15:26:57 dwelch Exp $
|
/* $Id: mminit.c,v 1.36 2002/07/17 21:04:56 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top directory
|
* COPYRIGHT: See COPYING in the top directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -267,7 +267,7 @@ VOID MmInit1(ULONG FirstKrnlPhysAddr,
|
||||||
*/
|
*/
|
||||||
#ifndef MP
|
#ifndef MP
|
||||||
/* FIXME: This is broken in SMP mode */
|
/* FIXME: This is broken in SMP mode */
|
||||||
//MmDeletePageTable(NULL, 0);
|
MmDeletePageTable(NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Free all pages not used for kernel memory
|
* Free all pages not used for kernel memory
|
||||||
|
|
|
@ -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: pagefile.c,v 1.20 2002/05/14 21:19:19 dwelch Exp $
|
/* $Id: pagefile.c,v 1.21 2002/07/17 21:04:56 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/pagefile.c
|
* FILE: ntoskrnl/mm/pagefile.c
|
||||||
|
@ -32,6 +32,7 @@
|
||||||
#include <internal/io.h>
|
#include <internal/io.h>
|
||||||
#include <internal/mm.h>
|
#include <internal/mm.h>
|
||||||
#include <napi/core.h>
|
#include <napi/core.h>
|
||||||
|
#include <internal/ps.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
@ -90,10 +91,12 @@ static ULONG MiReservedSwapPages;
|
||||||
*/
|
*/
|
||||||
#define MM_PAGEFILE_COMMIT_GRACE (256)
|
#define MM_PAGEFILE_COMMIT_GRACE (256)
|
||||||
|
|
||||||
#if 0
|
|
||||||
static PVOID MmCoreDumpPageFrame;
|
static PVOID MmCoreDumpPageFrame;
|
||||||
static BYTE MmCoreDumpHeader[PAGESIZE];
|
static PULONG MmCoreDumpBlockMap;
|
||||||
#endif
|
static ULONG MmCoreDumpSize;
|
||||||
|
static PULONG MmCoreDumpBlockMap = NULL;
|
||||||
|
static MM_DUMP_POINTERS MmCoreDumpDeviceFuncs;
|
||||||
|
DWORD MmCoreDumpType;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Translate between a swap entry and a file and offset pair.
|
* Translate between a swap entry and a file and offset pair.
|
||||||
|
@ -196,6 +199,19 @@ MmInitPagingFile(VOID)
|
||||||
PagingFileList[i] = NULL;
|
PagingFileList[i] = NULL;
|
||||||
}
|
}
|
||||||
MiPagingFileCount = 0;
|
MiPagingFileCount = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the crash dump support.
|
||||||
|
*/
|
||||||
|
MmCoreDumpPageFrame = MmAllocateSection(PAGESIZE);
|
||||||
|
if (MmCoreDumpType == MM_CORE_DUMP_TYPE_FULL)
|
||||||
|
{
|
||||||
|
MmCoreDumpSize = MmStats.NrTotalPages * 4096 + 1024 * 1024;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MmCoreDumpSize = 1024 * 1024;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
@ -341,27 +357,137 @@ MmAllocSwapPage(VOID)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
NTSTATUS STDCALL
|
||||||
NTSTATUS STDCALL MmDumpToPagingFile(PCONTEXT Context,
|
MmDumpToPagingFile(ULONG BugCode,
|
||||||
ULONG BugCode,
|
ULONG BugCodeParameter1,
|
||||||
ULONG ExceptionCode,
|
ULONG BugCodeParameter2,
|
||||||
ULONG Cr2)
|
ULONG BugCodeParameter3,
|
||||||
|
ULONG BugCodeParameter4,
|
||||||
|
PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
((PMM_CORE_DUMP_HEADER)MmCoreDumpHeader)->Magic =
|
PMM_CORE_DUMP_HEADER Headers;
|
||||||
MM_CORE_DUMP_HEADER_MAGIC;
|
PVOID Context;
|
||||||
((PMM_CORE_DUMP_HEADER)MmCoreDumpHeader)->Version =
|
NTSTATUS Status;
|
||||||
MM_CORE_DUMP_HEADER_VERSION;
|
UCHAR MdlBase[sizeof(MDL) + sizeof(PVOID)];
|
||||||
memcpy(&((PMM_CORE_DUMP_HEADER)MmCoreDumpHeader)->Context,
|
PMDL Mdl = (PMDL)MdlBase;
|
||||||
Context,
|
PETHREAD Thread = PsGetCurrentThread();
|
||||||
sizeof(CONTEXT));
|
ULONG StackSize;
|
||||||
((PMM_CORE_DUMP_HEADER)MmCoreDumpHeader)->DumpLength = 0;
|
PULONG MdlMap;
|
||||||
((PMM_CORE_DUMP_HEADER)MmCoreDumpHeader)->BugCode = BugCode;
|
ULONG NextOffset = 0;
|
||||||
((PMM_CORE_DUMP_HEADER)MmCoreDumpHeader)->ExceptionCode =
|
ULONG i;
|
||||||
ExceptionCode;
|
|
||||||
((PMM_CORE_DUMP_HEADER)MmCoreDumpHeader)->Cr2 = Cr2;
|
if (MmCoreDumpBlockMap == NULL)
|
||||||
((PMM_CORE_DUMP_HEADER)MmCoreDumpHeader)->Cr3 = 0;
|
{
|
||||||
|
return(STATUS_UNSUCCESSFUL);
|
||||||
|
}
|
||||||
|
|
||||||
|
DbgPrint("MM: Dumping core");
|
||||||
|
|
||||||
|
/* Prepare the dump headers. */
|
||||||
|
Headers = (PMM_CORE_DUMP_HEADER)MmCoreDumpPageFrame;
|
||||||
|
Headers->Magic = MM_CORE_DUMP_HEADER_MAGIC;
|
||||||
|
Headers->Version = MM_CORE_DUMP_HEADER_VERSION;
|
||||||
|
Headers->Type = MmCoreDumpType;
|
||||||
|
if (TrapFrame != NULL)
|
||||||
|
{
|
||||||
|
if (!(TrapFrame->Eflags & (1 << 17)))
|
||||||
|
{
|
||||||
|
memcpy(&Headers->TrapFrame, TrapFrame,
|
||||||
|
sizeof(KTRAP_FRAME) - (4 * sizeof(DWORD)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy(&Headers->TrapFrame, TrapFrame, sizeof(KTRAP_FRAME));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Headers->BugCheckCode = BugCode;
|
||||||
|
Headers->BugCheckParameters[0] = BugCodeParameter1;
|
||||||
|
Headers->BugCheckParameters[1] = BugCodeParameter2;
|
||||||
|
Headers->BugCheckParameters[2] = BugCodeParameter3;
|
||||||
|
Headers->BugCheckParameters[3] = BugCodeParameter4;
|
||||||
|
Headers->FaultingStackBase = (PVOID)Thread->Tcb.StackLimit;
|
||||||
|
Headers->FaultingStackSize = StackSize =
|
||||||
|
(ULONG)(Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
|
||||||
|
Headers->PhysicalMemorySize = MmStats.NrTotalPages * PAGESIZE;
|
||||||
|
|
||||||
|
/* Initialize the dump device. */
|
||||||
|
Context = MmCoreDumpDeviceFuncs.Context;
|
||||||
|
Status = MmCoreDumpDeviceFuncs.DeviceInit(Context);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("MM: Failed to initialize core dump device.\n");
|
||||||
|
return(Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize the MDL. */
|
||||||
|
Mdl->Next = NULL;
|
||||||
|
Mdl->Size = sizeof(MDL) + sizeof(PVOID);
|
||||||
|
Mdl->MdlFlags = MDL_SOURCE_IS_NONPAGED_POOL;
|
||||||
|
Mdl->Process = NULL;
|
||||||
|
Mdl->MappedSystemVa = MmCoreDumpPageFrame;
|
||||||
|
Mdl->StartVa = NULL;
|
||||||
|
Mdl->ByteCount = PAGESIZE;
|
||||||
|
Mdl->ByteOffset = 0;
|
||||||
|
MdlMap = (PULONG)(Mdl + 1);
|
||||||
|
|
||||||
|
/* Dump the header. */
|
||||||
|
MdlMap[0] = MmGetPhysicalAddress(MmCoreDumpPageFrame).u.LowPart;
|
||||||
|
Status = MmCoreDumpDeviceFuncs.DeviceWrite(Context,
|
||||||
|
MmCoreDumpBlockMap[NextOffset],
|
||||||
|
Mdl);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("MM: Failed to write core dump header\n.");
|
||||||
|
}
|
||||||
|
NextOffset++;
|
||||||
|
DbgPrint(".");
|
||||||
|
|
||||||
|
/* Write out the kernel mode stack of the faulting thread. */
|
||||||
|
for (i = 0; i < (StackSize / PAGESIZE); i++)
|
||||||
|
{
|
||||||
|
Mdl->MappedSystemVa = (PVOID)(Thread->Tcb.StackLimit + (i * PAGESIZE));
|
||||||
|
MdlMap[0] = MmGetPhysicalAddress(Mdl->MappedSystemVa).u.LowPart;
|
||||||
|
Status =
|
||||||
|
MmCoreDumpDeviceFuncs.DeviceWrite(Context,
|
||||||
|
MmCoreDumpBlockMap[NextOffset],
|
||||||
|
Mdl);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("MM: Failed to write page to core dump.\n");
|
||||||
|
return(Status);
|
||||||
|
}
|
||||||
|
DbgPrint(".");
|
||||||
|
NextOffset++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write out the contents of physical memory. */
|
||||||
|
if (MmCoreDumpType == MM_CORE_DUMP_TYPE_FULL)
|
||||||
|
{
|
||||||
|
for (i = 0; i < MmStats.NrTotalPages; i++)
|
||||||
|
{
|
||||||
|
LARGE_INTEGER PhysicalAddress;
|
||||||
|
PhysicalAddress.QuadPart = i * PAGESIZE;
|
||||||
|
MdlMap[0] = i * PAGESIZE;
|
||||||
|
MmCreateVirtualMappingForKernel(MmCoreDumpPageFrame,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
PhysicalAddress);
|
||||||
|
Status =
|
||||||
|
MmCoreDumpDeviceFuncs.DeviceWrite(Context,
|
||||||
|
MmCoreDumpBlockMap[NextOffset],
|
||||||
|
Mdl);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("MM: Failed to write page to core dump.\n");
|
||||||
|
return(Status);
|
||||||
|
}
|
||||||
|
DbgPrint(".");
|
||||||
|
NextOffset++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DbgPrint("\n");
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
NtCreatePagingFile(IN PUNICODE_STRING FileName,
|
NtCreatePagingFile(IN PUNICODE_STRING FileName,
|
||||||
|
@ -443,12 +569,11 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtClose(FileHandle);
|
|
||||||
|
|
||||||
PagingFile = ExAllocatePool(NonPagedPool, sizeof(*PagingFile));
|
PagingFile = ExAllocatePool(NonPagedPool, sizeof(*PagingFile));
|
||||||
if (PagingFile == NULL)
|
if (PagingFile == NULL)
|
||||||
{
|
{
|
||||||
ObDereferenceObject(FileObject);
|
ObDereferenceObject(FileObject);
|
||||||
|
NtClose(FileHandle);
|
||||||
return(STATUS_NO_MEMORY);
|
return(STATUS_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,6 +593,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
|
||||||
{
|
{
|
||||||
ExFreePool(PagingFile);
|
ExFreePool(PagingFile);
|
||||||
ObDereferenceObject(FileObject);
|
ObDereferenceObject(FileObject);
|
||||||
|
NtClose(FileHandle);
|
||||||
return(STATUS_NO_MEMORY);
|
return(STATUS_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,6 +610,57 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
|
||||||
MiPagingFileCount++;
|
MiPagingFileCount++;
|
||||||
KeReleaseSpinLock(&PagingFileListLock, oldIrql);
|
KeReleaseSpinLock(&PagingFileListLock, oldIrql);
|
||||||
|
|
||||||
|
/* Check whether this pagefile can be a crash dump target. */
|
||||||
|
if (PagingFile->CurrentSize.QuadPart >= MmCoreDumpSize &&
|
||||||
|
MmCoreDumpBlockMap != NULL)
|
||||||
|
{
|
||||||
|
MmCoreDumpBlockMap =
|
||||||
|
ExAllocatePool(NonPagedPool,
|
||||||
|
(MmCoreDumpSize / PAGESIZE) * sizeof(ULONG));
|
||||||
|
if (MmCoreDumpBlockMap == NULL)
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to allocate block map.\n");
|
||||||
|
NtClose(FileHandle);
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
Status = ZwFsControlFile(FileHandle,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatus,
|
||||||
|
FSCTL_GET_DUMP_BLOCK_MAP,
|
||||||
|
&MmCoreDumpSize,
|
||||||
|
sizeof(ULONG),
|
||||||
|
MmCoreDumpBlockMap,
|
||||||
|
(MmCoreDumpSize / PAGESIZE) * sizeof(ULONG));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to get dump block map (Status %X)\n", Status);
|
||||||
|
NtClose(FileHandle);
|
||||||
|
ExFreePool(MmCoreDumpBlockMap);
|
||||||
|
MmCoreDumpBlockMap = NULL;
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
Status = ZwDeviceIoControlFile(FileHandle,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatus,
|
||||||
|
IOCTL_GET_DUMP_POINTERS,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
&MmCoreDumpDeviceFuncs,
|
||||||
|
sizeof(MmCoreDumpDeviceFuncs));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to get dump block map (Status %X)\n", Status);
|
||||||
|
NtClose(FileHandle);
|
||||||
|
ExFreePool(MmCoreDumpBlockMap);
|
||||||
|
MmCoreDumpBlockMap = NULL;
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NtClose(FileHandle);
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: object.c,v 1.51 2002/06/20 21:31:39 ekohl Exp $
|
/* $Id: object.c,v 1.52 2002/07/17 21:04:56 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -321,7 +321,10 @@ ObCreateObject(OUT PHANDLE Handle,
|
||||||
}
|
}
|
||||||
RtlFreeUnicodeString( &RemainingPath );
|
RtlFreeUnicodeString( &RemainingPath );
|
||||||
|
|
||||||
|
if (Object != NULL)
|
||||||
|
{
|
||||||
*Object = HEADER_TO_BODY(Header);
|
*Object = HEADER_TO_BODY(Header);
|
||||||
|
}
|
||||||
|
|
||||||
if (Handle != NULL)
|
if (Handle != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: process.c,v 1.85 2002/07/13 12:44:08 chorns Exp $
|
/* $Id: process.c,v 1.86 2002/07/17 21:04:56 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -194,7 +194,6 @@ PiKillMostProcesses(VOID)
|
||||||
VOID
|
VOID
|
||||||
PsInitProcessManagment(VOID)
|
PsInitProcessManagment(VOID)
|
||||||
{
|
{
|
||||||
|
|
||||||
PKPROCESS KProcess;
|
PKPROCESS KProcess;
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -970,7 +969,6 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
||||||
|
|
||||||
case ProcessImageFileName:
|
case ProcessImageFileName:
|
||||||
memcpy(Process->ImageFileName, ProcessInformation, 8);
|
memcpy(Process->ImageFileName, ProcessInformation, 8);
|
||||||
// DPRINT1("Process->ImageFileName %.8s\n", Process->ImageFileName);
|
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -996,6 +994,11 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
||||||
case ProcessWow64Information:
|
case ProcessWow64Information:
|
||||||
default:
|
default:
|
||||||
Status = STATUS_INVALID_INFO_CLASS;
|
Status = STATUS_INVALID_INFO_CLASS;
|
||||||
|
|
||||||
|
case ProcessDesktop:
|
||||||
|
Process->Win32Desktop = *(PHANDLE)ProcessInformation;
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
return(Status);
|
return(Status);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: winlogon.c,v 1.9 2002/06/11 22:09:03 dwelch Exp $
|
/* $Id: winlogon.c,v 1.10 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -216,6 +216,7 @@ WinMain(HINSTANCE hInstance,
|
||||||
CHAR Password[255];
|
CHAR Password[255];
|
||||||
BOOL Success;
|
BOOL Success;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: Create a security descriptor with
|
* FIXME: Create a security descriptor with
|
||||||
|
@ -225,8 +226,8 @@ WinMain(HINSTANCE hInstance,
|
||||||
/*
|
/*
|
||||||
* Create the interactive window station
|
* Create the interactive window station
|
||||||
*/
|
*/
|
||||||
InteractiveWindowStation = CreateWindowStationW(
|
InteractiveWindowStation =
|
||||||
L"WinSta0", 0, GENERIC_ALL, NULL);
|
CreateWindowStationW(L"WinSta0", 0, GENERIC_ALL, NULL);
|
||||||
if (InteractiveWindowStation == NULL)
|
if (InteractiveWindowStation == NULL)
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to create window station (0x%X)\n", GetLastError());
|
DbgPrint("Failed to create window station (0x%X)\n", GetLastError());
|
||||||
|
@ -242,46 +243,53 @@ WinMain(HINSTANCE hInstance,
|
||||||
/*
|
/*
|
||||||
* Create the application desktop
|
* Create the application desktop
|
||||||
*/
|
*/
|
||||||
ApplicationDesktop = CreateDesktopW(
|
ApplicationDesktop =
|
||||||
L"Default",
|
CreateDesktopW(L"Default",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
0, /* FIXME: Set some flags */
|
0, /* FIXME: Set some flags */
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
NULL); /* FIXME: Create security descriptor (access to all) */
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the winlogon desktop
|
* Create the winlogon desktop
|
||||||
*/
|
*/
|
||||||
WinlogonDesktop = CreateDesktopW(
|
WinlogonDesktop = CreateDesktopW(L"Winlogon",
|
||||||
L"Winlogon",
|
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
0, /* FIXME: Set some flags */
|
0, /* FIXME: Set some flags */
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
NULL); /* FIXME: Create security descriptor (access for winlogon only) */
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the screen saver desktop
|
* Create the screen saver desktop
|
||||||
*/
|
*/
|
||||||
ScreenSaverDesktop = CreateDesktopW(
|
ScreenSaverDesktop = CreateDesktopW(L"Screen-Saver",
|
||||||
L"Screen-Saver",
|
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
0, /* FIXME: Set some flags */
|
0, /* FIXME: Set some flags */
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
NULL); /* FIXME: Create security descriptor (access to all) */
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Switch to winlogon desktop
|
* Switch to winlogon desktop
|
||||||
*/
|
*/
|
||||||
Success = SwitchDesktop(WinlogonDesktop);
|
/* FIXME: Do start up in the application desktop for now. */
|
||||||
|
Status = NtSetInformationProcess(NtCurrentProcess(),
|
||||||
|
ProcessDesktop,
|
||||||
|
&ApplicationDesktop,
|
||||||
|
sizeof(ApplicationDesktop));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DbgPrint("WL: Cannot set default desktop for winlogon.\n");
|
||||||
|
}
|
||||||
|
SetThreadDesktop(ApplicationDesktop);
|
||||||
|
Success = SwitchDesktop(ApplicationDesktop);
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
DbgPrint("Cannot switch to Winlogon desktop (0x%X)\n", GetLastError());
|
DbgPrint("Cannot switch to Winlogon desktop (0x%X)\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
SetConsoleTitle( "Winlogon" );
|
SetConsoleTitle( "Winlogon" );
|
||||||
/* start system processes (services.exe & lsass.exe) */
|
/* start system processes (services.exe & lsass.exe) */
|
||||||
|
|
|
@ -8,9 +8,15 @@ W32kCallWindowProc(WNDPROC Proc,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam);
|
LPARAM lParam);
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
W32kSendNCCREATEMessage(HWND Wnd, CREATESTRUCT* CreateStruct);
|
W32kCallTrampolineWindowProc(WNDPROC Proc,
|
||||||
|
HWND Wnd,
|
||||||
|
UINT Message,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam);
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
W32kSendCREATEMessage(HWND Wnd, CREATESTRUCT* CreateStruct);
|
W32kSendNCCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct);
|
||||||
|
LRESULT STDCALL
|
||||||
|
W32kSendCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct);
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
W32kCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
|
W32kCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
|
@ -20,5 +26,7 @@ W32kCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, RECT Rect1,
|
W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, RECT Rect1,
|
||||||
RECT Rect2, RECT Rect3, PWINDOWPOS Pos);
|
RECT Rect2, RECT Rect3, PWINDOWPOS Pos);
|
||||||
|
LRESULT STDCALL
|
||||||
|
W32kSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo);
|
||||||
|
|
||||||
#endif /* __SUBSYS_WIN32K_INCLUDE_CALLBACK_H */
|
#endif /* __SUBSYS_WIN32K_INCLUDE_CALLBACK_H */
|
||||||
|
|
|
@ -33,6 +33,9 @@ ClassReferenceClassByAtom(PWNDCLASS_OBJECT *Class,
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
|
ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
|
||||||
LPWSTR ClassNameOrAtom);
|
LPWSTR ClassNameOrAtom);
|
||||||
|
PWNDCLASS_OBJECT
|
||||||
|
W32kCreateClass(LPWNDCLASSEX lpwcx,
|
||||||
|
BOOL bUnicodeClass);
|
||||||
|
|
||||||
#endif /* __WIN32K_CLASS_H */
|
#endif /* __WIN32K_CLASS_H */
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,10 @@ typedef struct _USER_MESSAGE_QUEUE
|
||||||
BOOLEAN PaintPosted;
|
BOOLEAN PaintPosted;
|
||||||
/* Count of paints pending. */
|
/* Count of paints pending. */
|
||||||
ULONG PaintCount;
|
ULONG PaintCount;
|
||||||
|
/* Current active window for this queue. */
|
||||||
|
HWND ActiveWindow;
|
||||||
|
/* Current capture window for this queue. */
|
||||||
|
HWND CaptureWindow;
|
||||||
} USER_MESSAGE_QUEUE, *PUSER_MESSAGE_QUEUE;
|
} USER_MESSAGE_QUEUE, *PUSER_MESSAGE_QUEUE;
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -103,6 +107,12 @@ MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue);
|
||||||
VOID
|
VOID
|
||||||
MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
|
MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
|
||||||
PUSER_SENT_MESSAGE_NOTIFY NotifyMessage);
|
PUSER_SENT_MESSAGE_NOTIFY NotifyMessage);
|
||||||
|
LRESULT STDCALL
|
||||||
|
W32kSendMessage(HWND hWnd,
|
||||||
|
UINT Msg,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam,
|
||||||
|
BOOL KernelMessage);
|
||||||
|
|
||||||
#define MAKE_LONG(x, y) ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))
|
#define MAKE_LONG(x, y) ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <include/class.h>
|
#include <include/class.h>
|
||||||
#include <include/msgqueue.h>
|
#include <include/msgqueue.h>
|
||||||
|
#include <include/winsta.h>
|
||||||
|
|
||||||
typedef struct _INTERNALPOS
|
typedef struct _INTERNALPOS
|
||||||
{
|
{
|
||||||
|
@ -91,6 +92,18 @@ PWINDOW_OBJECT
|
||||||
W32kGetWindowObject(HWND hWnd);
|
W32kGetWindowObject(HWND hWnd);
|
||||||
VOID
|
VOID
|
||||||
W32kReleaseWindowObject(PWINDOW_OBJECT Window);
|
W32kReleaseWindowObject(PWINDOW_OBJECT Window);
|
||||||
|
HWND STDCALL
|
||||||
|
W32kCreateDesktopWindow(PWINSTATION_OBJECT WindowStation,
|
||||||
|
PWNDCLASS_OBJECT DesktopClass,
|
||||||
|
ULONG Width, ULONG Height);
|
||||||
|
BOOL
|
||||||
|
W32kIsDesktopWindow(HWND hWnd);
|
||||||
|
HWND
|
||||||
|
W32kGetActiveWindow(VOID);
|
||||||
|
BOOL
|
||||||
|
W32kIsWindowVisible(HWND Wnd);
|
||||||
|
BOOL
|
||||||
|
W32kIsChildWindow(HWND Parent, HWND Child);
|
||||||
|
|
||||||
#endif /* __WIN32K_WINDOW_H */
|
#endif /* __WIN32K_WINDOW_H */
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,10 @@ ValidateDesktopHandle(HDESK Desktop,
|
||||||
KPROCESSOR_MODE AccessMode,
|
KPROCESSOR_MODE AccessMode,
|
||||||
ACCESS_MASK DesiredAccess,
|
ACCESS_MASK DesiredAccess,
|
||||||
PDESKTOP_OBJECT *Object);
|
PDESKTOP_OBJECT *Object);
|
||||||
|
LRESULT CALLBACK
|
||||||
|
W32kDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
PDESKTOP_OBJECT
|
||||||
|
W32kGetActiveDesktop(VOID);
|
||||||
|
|
||||||
#endif /* __WIN32K_WINSTA_H */
|
#endif /* __WIN32K_WINSTA_H */
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: callback.c,v 1.5 2002/07/04 19:56:37 dwelch Exp $
|
/* $Id: callback.c,v 1.6 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -95,7 +95,7 @@ W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect,
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
W32kSendCREATEMessage(HWND Wnd, CREATESTRUCT* CreateStruct)
|
W32kSendCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct)
|
||||||
{
|
{
|
||||||
SENDCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments;
|
SENDCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments;
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
|
@ -120,7 +120,7 @@ W32kSendCREATEMessage(HWND Wnd, CREATESTRUCT* CreateStruct)
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
W32kSendNCCREATEMessage(HWND Wnd, CREATESTRUCT* CreateStruct)
|
W32kSendNCCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct)
|
||||||
{
|
{
|
||||||
SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments;
|
SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments;
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
|
@ -157,6 +157,11 @@ W32kCallWindowProc(WNDPROC Proc,
|
||||||
PVOID ResultPointer;
|
PVOID ResultPointer;
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
|
|
||||||
|
if (W32kIsDesktopWindow(Wnd))
|
||||||
|
{
|
||||||
|
return(W32kDesktopWindowProc(Wnd, Message, wParam, lParam));
|
||||||
|
}
|
||||||
|
|
||||||
Arguments.Proc = Proc;
|
Arguments.Proc = Proc;
|
||||||
Arguments.Wnd = Wnd;
|
Arguments.Wnd = Wnd;
|
||||||
Arguments.Msg = Message;
|
Arguments.Msg = Message;
|
||||||
|
@ -176,4 +181,65 @@ W32kCallWindowProc(WNDPROC Proc,
|
||||||
return(Result);
|
return(Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT STDCALL
|
||||||
|
W32kSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo)
|
||||||
|
{
|
||||||
|
SENDGETMINMAXINFO_CALLBACK_ARGUMENTS Arguments;
|
||||||
|
SENDGETMINMAXINFO_CALLBACK_RESULT Result;
|
||||||
|
NTSTATUS Status;
|
||||||
|
PVOID ResultPointer;
|
||||||
|
ULONG ResultLength;
|
||||||
|
|
||||||
|
Arguments.Wnd = Wnd;
|
||||||
|
Arguments.MinMaxInfo = *MinMaxInfo;
|
||||||
|
ResultPointer = &Result;
|
||||||
|
ResultLength = sizeof(Result);
|
||||||
|
Status = NtW32Call(USER32_CALLBACK_SENDGETMINMAXINFO,
|
||||||
|
&Arguments,
|
||||||
|
sizeof(SENDGETMINMAXINFO_CALLBACK_ARGUMENTS),
|
||||||
|
&ResultPointer,
|
||||||
|
&ResultLength);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
return(Result.Result);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT STDCALL
|
||||||
|
W32kCallTrampolineWindowProc(WNDPROC Proc,
|
||||||
|
HWND Wnd,
|
||||||
|
UINT Message,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (Message)
|
||||||
|
{
|
||||||
|
case WM_NCCREATE:
|
||||||
|
return(W32kSendNCCREATEMessage(Wnd, (CREATESTRUCTW*)lParam));
|
||||||
|
|
||||||
|
case WM_CREATE:
|
||||||
|
return(W32kSendCREATEMessage(Wnd, (CREATESTRUCTW*)lParam));
|
||||||
|
|
||||||
|
case WM_GETMINMAXINFO:
|
||||||
|
return(W32kSendGETMINMAXINFOMessage(Wnd, (MINMAXINFO*)lParam));
|
||||||
|
|
||||||
|
case WM_NCCALCSIZE:
|
||||||
|
{
|
||||||
|
if (wParam)
|
||||||
|
{
|
||||||
|
return(W32kSendNCCALCSIZEMessage(Wnd, TRUE, NULL,
|
||||||
|
(NCCALCSIZE_PARAMS*)lParam));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(W32kSendNCCALCSIZEMessage(Wnd, FALSE, (RECT*)lParam, NULL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return(W32kCallWindowProc(Proc, Wnd, Message, wParam, lParam));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: class.c,v 1.8 2002/07/04 19:56:37 dwelch Exp $
|
/* $Id: class.c,v 1.9 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -164,6 +164,37 @@ NtUserGetWOWClass(DWORD Unknown0,
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PWNDCLASS_OBJECT
|
||||||
|
W32kCreateClass(LPWNDCLASSEX lpwcx,
|
||||||
|
BOOL bUnicodeClass)
|
||||||
|
{
|
||||||
|
PWNDCLASS_OBJECT ClassObject;
|
||||||
|
WORD objectSize;
|
||||||
|
LPTSTR namePtr;
|
||||||
|
|
||||||
|
objectSize = sizeof(WNDCLASS_OBJECT) +
|
||||||
|
(lpwcx->lpszMenuName != 0 ? ((wcslen (lpwcx->lpszMenuName) + 1) * 2) : 0) +
|
||||||
|
((wcslen (lpwcx->lpszClassName) + 1) * 2);
|
||||||
|
ClassObject = ObmCreateObject(NULL, NULL, otClass, objectSize);
|
||||||
|
if (ClassObject == 0)
|
||||||
|
{
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassObject->Class = *lpwcx;
|
||||||
|
ClassObject->Unicode = bUnicodeClass;
|
||||||
|
namePtr = (LPTSTR)(((PCHAR)ClassObject) + sizeof (WNDCLASS_OBJECT));
|
||||||
|
if (lpwcx->lpszMenuName != 0)
|
||||||
|
{
|
||||||
|
ClassObject->Class.lpszMenuName = namePtr;
|
||||||
|
wcscpy (namePtr, lpwcx->lpszMenuName);
|
||||||
|
namePtr += wcslen (lpwcx->lpszMenuName + 1);
|
||||||
|
}
|
||||||
|
ClassObject->Class.lpszClassName = namePtr;
|
||||||
|
wcscpy (namePtr, lpwcx->lpszClassName);
|
||||||
|
return(ClassObject);
|
||||||
|
}
|
||||||
|
|
||||||
RTL_ATOM STDCALL
|
RTL_ATOM STDCALL
|
||||||
NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
||||||
BOOL bUnicodeClass,
|
BOOL bUnicodeClass,
|
||||||
|
@ -186,8 +217,6 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
||||||
PWNDCLASS_OBJECT ClassObject;
|
PWNDCLASS_OBJECT ClassObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
RTL_ATOM Atom;
|
RTL_ATOM Atom;
|
||||||
WORD objectSize;
|
|
||||||
LPTSTR namePtr;
|
|
||||||
|
|
||||||
W32kGuiCheck();
|
W32kGuiCheck();
|
||||||
|
|
||||||
|
@ -217,32 +246,15 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
|
||||||
|
|
||||||
return((RTL_ATOM)0);
|
return((RTL_ATOM)0);
|
||||||
}
|
}
|
||||||
|
ClassObject = W32kCreateClass(lpwcx, bUnicodeClass);
|
||||||
objectSize = sizeof(WNDCLASS_OBJECT) +
|
if (ClassObject == NULL)
|
||||||
(lpwcx->lpszMenuName != 0 ? ((wcslen (lpwcx->lpszMenuName) + 1) * 2) : 0) +
|
|
||||||
((wcslen (lpwcx->lpszClassName) + 1) * 2);
|
|
||||||
ClassObject = ObmCreateObject(NULL, NULL, otClass, objectSize);
|
|
||||||
if (ClassObject == 0)
|
|
||||||
{
|
{
|
||||||
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
|
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
DPRINT("Failed creating window class object\n");
|
DPRINT("Failed creating window class object\n");
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
|
||||||
return((RTL_ATOM)0);
|
return((RTL_ATOM)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassObject->Class = *lpwcx;
|
|
||||||
ClassObject->Unicode = bUnicodeClass;
|
|
||||||
namePtr = (LPTSTR)(((PCHAR)ClassObject) + sizeof (WNDCLASS_OBJECT));
|
|
||||||
if (lpwcx->lpszMenuName != 0)
|
|
||||||
{
|
|
||||||
ClassObject->Class.lpszMenuName = namePtr;
|
|
||||||
wcscpy (namePtr, lpwcx->lpszMenuName);
|
|
||||||
namePtr += wcslen (lpwcx->lpszMenuName + 1);
|
|
||||||
}
|
|
||||||
ClassObject->Class.lpszClassName = namePtr;
|
|
||||||
wcscpy (namePtr, lpwcx->lpszClassName);
|
|
||||||
ExAcquireFastMutex(&PsGetWin32Process()->ClassListLock);
|
ExAcquireFastMutex(&PsGetWin32Process()->ClassListLock);
|
||||||
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
|
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
|
||||||
ExReleaseFastMutex(&PsGetWin32Process()->ClassListLock);
|
ExReleaseFastMutex(&PsGetWin32Process()->ClassListLock);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: guicheck.c,v 1.5 2002/07/04 19:56:37 dwelch Exp $
|
/* $Id: guicheck.c,v 1.6 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -68,7 +68,7 @@ W32kGuiCheck(VOID)
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
ExDesktopObjectType,
|
ExDesktopObjectType,
|
||||||
UserMode,
|
UserMode,
|
||||||
&PsGetWin32Thread()->Desktop,
|
(PVOID*)&PsGetWin32Thread()->Desktop,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: message.c,v 1.7 2002/07/04 19:56:37 dwelch Exp $
|
/* $Id: message.c,v 1.8 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -231,7 +231,6 @@ NtUserPeekMessage(LPMSG lpMsg,
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
BOOLEAN Present;
|
BOOLEAN Present;
|
||||||
PUSER_MESSAGE Message;
|
PUSER_MESSAGE Message;
|
||||||
NTSTATUS Status;
|
|
||||||
BOOLEAN RemoveMessages;
|
BOOLEAN RemoveMessages;
|
||||||
|
|
||||||
/* Initialize the thread's win32 state if necessary. */
|
/* Initialize the thread's win32 state if necessary. */
|
||||||
|
@ -325,10 +324,11 @@ NtUserQuerySendMessage(DWORD Unknown0)
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
NtUserSendMessage(HWND hWnd,
|
W32kSendMessage(HWND hWnd,
|
||||||
UINT Msg,
|
UINT Msg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam,
|
||||||
|
BOOL KernelMessage)
|
||||||
{
|
{
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -351,10 +351,19 @@ NtUserSendMessage(HWND hWnd,
|
||||||
/* FIXME: Check for an exiting window. */
|
/* FIXME: Check for an exiting window. */
|
||||||
|
|
||||||
if (Window->MessageQueue == PsGetWin32Thread()->MessageQueue)
|
if (Window->MessageQueue == PsGetWin32Thread()->MessageQueue)
|
||||||
|
{
|
||||||
|
if (KernelMessage)
|
||||||
|
{
|
||||||
|
Result = W32kCallTrampolineWindowProc(NULL, hWnd, Msg, wParam,
|
||||||
|
lParam);
|
||||||
|
return(Result);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Result = W32kCallWindowProc(NULL, hWnd, Msg, wParam, lParam);
|
Result = W32kCallWindowProc(NULL, hWnd, Msg, wParam, lParam);
|
||||||
return(Result);
|
return(Result);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PUSER_SENT_MESSAGE Message;
|
PUSER_SENT_MESSAGE Message;
|
||||||
|
@ -391,6 +400,15 @@ NtUserSendMessage(HWND hWnd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT STDCALL
|
||||||
|
NtUserSendMessage(HWND hWnd,
|
||||||
|
UINT Msg,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
return(W32kSendMessage(hWnd, Msg, wParam, lParam, FALSE));
|
||||||
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserSendMessageCallback(HWND hWnd,
|
NtUserSendMessageCallback(HWND hWnd,
|
||||||
UINT Msg,
|
UINT Msg,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: msgqueue.c,v 1.4 2002/07/04 19:56:37 dwelch Exp $
|
/* $Id: msgqueue.c,v 1.5 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -138,6 +138,7 @@ MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
|
||||||
ExAcquireFastMutex(&MessageQueue->Lock);
|
ExAcquireFastMutex(&MessageQueue->Lock);
|
||||||
if (IsListEmpty(&MessageQueue->SentMessagesListHead))
|
if (IsListEmpty(&MessageQueue->SentMessagesListHead))
|
||||||
{
|
{
|
||||||
|
ExReleaseFastMutex(&MessageQueue->Lock);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
Entry = RemoveHeadList(&MessageQueue->SentMessagesListHead);
|
Entry = RemoveHeadList(&MessageQueue->SentMessagesListHead);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: windc.c,v 1.1 2002/07/04 20:12:27 dwelch Exp $
|
/* $Id: windc.c,v 1.2 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -18,16 +18,205 @@
|
||||||
#include <include/error.h>
|
#include <include/error.h>
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
#include <include/msgqueue.h>
|
#include <include/msgqueue.h>
|
||||||
|
#include <include/window.h>
|
||||||
|
#include <include/rect.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
BOOL STATIC
|
||||||
|
DceGetVisRect(PWINDOW_OBJECT Window, BOOL ClientArea, RECT* Rect)
|
||||||
|
{
|
||||||
|
if (ClientArea)
|
||||||
|
{
|
||||||
|
*Rect = Window->ClientRect;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*Rect = Window->WindowRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Window->Style & WS_VISIBLE)
|
||||||
|
{
|
||||||
|
INT XOffset = Rect->left;
|
||||||
|
INT YOffset = Rect->top;
|
||||||
|
|
||||||
|
while ((Window = Window->Parent) != NULL)
|
||||||
|
{
|
||||||
|
if ((Window->Style & (WS_ICONIC | WS_VISIBLE)) != WS_VISIBLE)
|
||||||
|
{
|
||||||
|
W32kSetEmptyRect(Rect);
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
XOffset += Window->ClientRect.left;
|
||||||
|
YOffset += Window->ClientRect.top;
|
||||||
|
W32kOffsetRect(Rect, Window->ClientRect.left,
|
||||||
|
Window->ClientRect.top);
|
||||||
|
if (Window->ClientRect.left >= Window->ClientRect.right ||
|
||||||
|
Window->ClientRect.top >= Window->ClientRect.bottom ||
|
||||||
|
Rect->left >= Window->ClientRect.right ||
|
||||||
|
Rect->right <= Window->ClientRect.left ||
|
||||||
|
Rect->top >= Window->ClientRect.bottom ||
|
||||||
|
Rect->bottom <= Window->ClientRect.top)
|
||||||
|
{
|
||||||
|
W32kSetEmptyRect(Rect);
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
Rect->left = max(Rect->left, Window->ClientRect.left);
|
||||||
|
Rect->right = min(Rect->right, Window->ClientRect.right);
|
||||||
|
Rect->top = max(Rect->top, Window->ClientRect.top);
|
||||||
|
Rect->bottom = min(Rect->bottom, Window->ClientRect.bottom);
|
||||||
|
}
|
||||||
|
W32kOffsetRect(Rect, -XOffset, -YOffset);
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
W32kSetEmptyRect(Rect);
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
DceAddClipRects(PWINDOW_OBJECT Parent, PWINDOW_OBJECT End,
|
||||||
|
HRGN ClipRgn, PRECT Rect, INT XOffset, INT YOffset)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY ChildListEntry;
|
||||||
|
PWINDOW_OBJECT Child;
|
||||||
|
RECT Rect1;
|
||||||
|
|
||||||
|
ChildListEntry = Parent->ChildrenListHead.Flink;
|
||||||
|
while (ChildListEntry != &Parent->ChildrenListHead)
|
||||||
|
{
|
||||||
|
Child = CONTAINING_RECORD(ChildListEntry, WINDOW_OBJECT,
|
||||||
|
SiblingListEntry);
|
||||||
|
if (Child == End)
|
||||||
|
{
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
if (Child->Style & WS_VISIBLE)
|
||||||
|
{
|
||||||
|
Rect1.left = Child->WindowRect.left + XOffset;
|
||||||
|
Rect1.top = Child->WindowRect.top + YOffset;
|
||||||
|
Rect1.right = Child->WindowRect.right + XOffset;
|
||||||
|
Rect1.bottom = Child->WindowRect.bottom + YOffset;
|
||||||
|
|
||||||
|
if (W32kIntersectRect(&Rect1, &Rect1, Rect))
|
||||||
|
{
|
||||||
|
W32kUnionRectWithRgn(ClipRgn, &Rect1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChildListEntry = ChildListEntry->Flink;
|
||||||
|
}
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
HRGN
|
HRGN
|
||||||
DceGetVisRgn(HWND hWnd, ULONG Flags, HWND hWndChild, ULONG CFlags)
|
DceGetVisRgn(HWND hWnd, ULONG Flags, HWND hWndChild, ULONG CFlags)
|
||||||
{
|
{
|
||||||
|
PWINDOW_OBJECT Window;
|
||||||
|
PWINDOW_OBJECT Child;
|
||||||
|
HRGN VisRgn;
|
||||||
|
RECT Rect;
|
||||||
|
|
||||||
|
Window = W32kGetWindowObject(hWnd);
|
||||||
|
Child = W32kGetWindowObject(hWndChild);
|
||||||
|
|
||||||
|
if (Window != NULL && DceGetVisRect(Window, !(Flags & DCX_WINDOW), &Rect))
|
||||||
|
{
|
||||||
|
if ((VisRgn = W32kCreateRectRgnIndirect(&Rect)) != NULL)
|
||||||
|
{
|
||||||
|
HRGN ClipRgn = W32kCreateRectRgn(0, 0, 0, 0);
|
||||||
|
INT XOffset, YOffset;
|
||||||
|
|
||||||
|
if (ClipRgn != NULL)
|
||||||
|
{
|
||||||
|
if (Flags & DCX_CLIPCHILDREN &&
|
||||||
|
!IsListEmpty(&Window->ChildrenListHead))
|
||||||
|
{
|
||||||
|
if (Flags & DCX_WINDOW)
|
||||||
|
{
|
||||||
|
XOffset = Window->ClientRect.left -
|
||||||
|
Window->WindowRect.left;
|
||||||
|
YOffset = Window->ClientRect.top -
|
||||||
|
Window->WindowRect.top;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XOffset = YOffset = 0;
|
||||||
|
}
|
||||||
|
DceAddClipRects(Window, NULL, ClipRgn, &Rect,
|
||||||
|
XOffset, YOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CFlags & DCX_CLIPCHILDREN && Child &&
|
||||||
|
!IsListEmpty(&Child->ChildrenListHead))
|
||||||
|
{
|
||||||
|
if (Flags & DCX_WINDOW)
|
||||||
|
{
|
||||||
|
XOffset = Window->ClientRect.left -
|
||||||
|
Window->WindowRect.left;
|
||||||
|
YOffset = Window->ClientRect.top -
|
||||||
|
Window->WindowRect.top;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XOffset = YOffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
XOffset += Child->ClientRect.left;
|
||||||
|
YOffset += Child->ClientRect.top;
|
||||||
|
|
||||||
|
DceAddClipRects(Child, NULL, ClipRgn, &Rect,
|
||||||
|
XOffset, YOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Flags & DCX_WINDOW)
|
||||||
|
{
|
||||||
|
XOffset = -Window->WindowRect.left;
|
||||||
|
YOffset = -Window->WindowRect.top;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XOffset = -Window->ClientRect.left;
|
||||||
|
YOffset = -Window->ClientRect.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Flags & DCX_CLIPSIBLINGS && Window->Parent != NULL)
|
||||||
|
{
|
||||||
|
DceAddClipRects(Window->Parent, Window, ClipRgn,
|
||||||
|
&Rect, XOffset, YOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (Window->Style & WS_CHILD)
|
||||||
|
{
|
||||||
|
Window = Window->Parent;
|
||||||
|
XOffset -= Window->ClientRect.left;
|
||||||
|
YOffset -= Window->ClientRect.top;
|
||||||
|
if (Window->Style & WS_CLIPSIBLINGS &&
|
||||||
|
Window->Parent != NULL)
|
||||||
|
{
|
||||||
|
DceAddClipRects(Window->Parent, Window, ClipRgn,
|
||||||
|
&Rect, XOffset, YOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
W32kCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
|
||||||
|
W32kDeleteObject(ClipRgn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
W32kDeleteObject(VisRgn);
|
||||||
|
VisRgn = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VisRgn = W32kCreateRectRgn(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
W32kReleaseWindowObject(Window);
|
||||||
|
W32kReleaseWindowObject(Child);
|
||||||
|
return(VisRgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: window.c,v 1.8 2002/07/04 19:56:37 dwelch Exp $
|
/* $Id: window.c,v 1.9 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -21,12 +21,70 @@
|
||||||
#include <include/winpos.h>
|
#include <include/winpos.h>
|
||||||
#include <include/callback.h>
|
#include <include/callback.h>
|
||||||
#include <include/msgqueue.h>
|
#include <include/msgqueue.h>
|
||||||
|
#include <include/rect.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
//#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
W32kSetFocusWindow(HWND hWnd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
W32kIsChildWindow(HWND Parent, HWND Child)
|
||||||
|
{
|
||||||
|
PWINDOW_OBJECT BaseWindow = W32kGetWindowObject(Child);
|
||||||
|
PWINDOW_OBJECT Window = BaseWindow;
|
||||||
|
while (Window != NULL && Window->Style & WS_CHILD)
|
||||||
|
{
|
||||||
|
if (Window->Self == Parent)
|
||||||
|
{
|
||||||
|
W32kReleaseWindowObject(BaseWindow);
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
Window = Window->Parent;
|
||||||
|
}
|
||||||
|
W32kReleaseWindowObject(BaseWindow);
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
W32kIsWindowVisible(HWND Wnd)
|
||||||
|
{
|
||||||
|
PWINDOW_OBJECT BaseWindow = W32kGetWindowObject(Wnd);
|
||||||
|
PWINDOW_OBJECT Window = BaseWindow;
|
||||||
|
BOOLEAN Result = FALSE;
|
||||||
|
while (Window != NULL && Window->Style & WS_CHILD)
|
||||||
|
{
|
||||||
|
if (!(Window->Style & WS_VISIBLE))
|
||||||
|
{
|
||||||
|
W32kReleaseWindowObject(BaseWindow);
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
Window = Window->Parent;
|
||||||
|
}
|
||||||
|
if (Window != NULL && Window->Style & WS_VISIBLE)
|
||||||
|
{
|
||||||
|
Result = TRUE;
|
||||||
|
}
|
||||||
|
W32kReleaseWindowObject(BaseWindow);
|
||||||
|
return(Result);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
W32kIsDesktopWindow(HWND hWnd)
|
||||||
|
{
|
||||||
|
PWINDOW_OBJECT WindowObject;
|
||||||
|
BOOL IsDesktop;
|
||||||
|
WindowObject = W32kGetWindowObject(hWnd);
|
||||||
|
IsDesktop = WindowObject->Parent == NULL;
|
||||||
|
W32kReleaseWindowObject(WindowObject);
|
||||||
|
return(IsDesktop);
|
||||||
|
}
|
||||||
|
|
||||||
PWINDOW_OBJECT
|
PWINDOW_OBJECT
|
||||||
W32kGetWindowObject(HWND hWnd)
|
W32kGetWindowObject(HWND hWnd)
|
||||||
{
|
{
|
||||||
|
@ -54,16 +112,52 @@ W32kReleaseWindowObject(PWINDOW_OBJECT Window)
|
||||||
VOID
|
VOID
|
||||||
W32kGetClientRect(PWINDOW_OBJECT WindowObject, PRECT Rect)
|
W32kGetClientRect(PWINDOW_OBJECT WindowObject, PRECT Rect)
|
||||||
{
|
{
|
||||||
|
Rect->left = Rect->bottom = 0;
|
||||||
|
Rect->right = WindowObject->ClientRect.right - WindowObject->ClientRect.left;
|
||||||
|
Rect->top = WindowObject->ClientRect.bottom - WindowObject->ClientRect.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND
|
HWND
|
||||||
W32kGetActiveWindow(VOID)
|
W32kGetActiveWindow(VOID)
|
||||||
{
|
{
|
||||||
|
PUSER_MESSAGE_QUEUE Queue;
|
||||||
|
Queue = (PUSER_MESSAGE_QUEUE)W32kGetActiveDesktop()->ActiveMessageQueue;
|
||||||
|
if (Queue == NULL)
|
||||||
|
{
|
||||||
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(Queue->ActiveWindow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HWND
|
||||||
|
W32kGetFocusWindow(VOID)
|
||||||
|
{
|
||||||
|
PUSER_MESSAGE_QUEUE Queue;
|
||||||
|
Queue = (PUSER_MESSAGE_QUEUE)W32kGetActiveDesktop()->ActiveMessageQueue;
|
||||||
|
if (Queue == NULL)
|
||||||
|
{
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(Queue->FocusWindow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WNDPROC
|
WNDPROC
|
||||||
W32kGetWindowProc(HWND Wnd)
|
W32kGetWindowProc(HWND Wnd)
|
||||||
{
|
{
|
||||||
|
PWINDOW_OBJECT WindowObject;
|
||||||
|
WNDPROC WndProc;
|
||||||
|
|
||||||
|
WindowObject = W32kGetWindowObject(Wnd);
|
||||||
|
WndProc = WindowObject->Class->Class.lpfnWndProc;
|
||||||
|
W32kReleaseWindowObject(Wnd);
|
||||||
|
return(WndProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -100,6 +194,57 @@ NtUserChildWindowFromPointEx(HWND Parent,
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWND STDCALL
|
||||||
|
W32kCreateDesktopWindow(PWINSTATION_OBJECT WindowStation,
|
||||||
|
PWNDCLASS_OBJECT DesktopClass,
|
||||||
|
ULONG Width, ULONG Height)
|
||||||
|
{
|
||||||
|
PWSTR WindowName;
|
||||||
|
HWND Handle;
|
||||||
|
PWINDOW_OBJECT WindowObject;
|
||||||
|
|
||||||
|
/* Create the window object. */
|
||||||
|
WindowObject = (PWINDOW_OBJECT)ObmCreateObject(WindowStation->HandleTable,
|
||||||
|
&Handle,
|
||||||
|
otWindow,
|
||||||
|
sizeof(WINDOW_OBJECT));
|
||||||
|
if (!WindowObject)
|
||||||
|
{
|
||||||
|
return((HWND)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fill out the structure describing it.
|
||||||
|
*/
|
||||||
|
WindowObject->Class = DesktopClass;
|
||||||
|
WindowObject->ExStyle = 0;
|
||||||
|
WindowObject->Style = WS_VISIBLE;
|
||||||
|
WindowObject->x = 0;
|
||||||
|
WindowObject->y = 0;
|
||||||
|
WindowObject->Width = Width;
|
||||||
|
WindowObject->Height = Height;
|
||||||
|
WindowObject->ParentHandle = NULL;
|
||||||
|
WindowObject->Parent = NULL;
|
||||||
|
WindowObject->Menu = NULL;
|
||||||
|
WindowObject->Instance = NULL;
|
||||||
|
WindowObject->Parameters = NULL;
|
||||||
|
WindowObject->Self = Handle;
|
||||||
|
WindowObject->MessageQueue = NULL;
|
||||||
|
WindowObject->ExtraData = NULL;
|
||||||
|
WindowObject->ExtraDataSize = 0;
|
||||||
|
WindowObject->WindowRect.left = 0;
|
||||||
|
WindowObject->WindowRect.top = 0;
|
||||||
|
WindowObject->WindowRect.right = Width;
|
||||||
|
WindowObject->WindowRect.bottom = Height;
|
||||||
|
WindowObject->ClientRect = WindowObject->WindowRect;
|
||||||
|
|
||||||
|
WindowName = ExAllocatePool(NonPagedPool, sizeof(L"DESKTOP"));
|
||||||
|
wcscpy(WindowName, L"DESKTOP");
|
||||||
|
RtlInitUnicodeString(&WindowObject->WindowName, WindowName);
|
||||||
|
|
||||||
|
return(Handle);
|
||||||
|
}
|
||||||
|
|
||||||
HWND STDCALL
|
HWND STDCALL
|
||||||
NtUserCreateWindowEx(DWORD dwExStyle,
|
NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
PUNICODE_STRING lpClassName,
|
PUNICODE_STRING lpClassName,
|
||||||
|
@ -118,11 +263,12 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
PWNDCLASS_OBJECT ClassObject;
|
PWNDCLASS_OBJECT ClassObject;
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
|
PWINDOW_OBJECT ParentWindow;
|
||||||
UNICODE_STRING WindowName;
|
UNICODE_STRING WindowName;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
POINT MaxSize, MaxPos, MinTrack, MaxTrack;
|
POINT MaxSize, MaxPos, MinTrack, MaxTrack;
|
||||||
CREATESTRUCT Cs;
|
CREATESTRUCTW Cs;
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
|
|
||||||
DPRINT("NtUserCreateWindowEx\n");
|
DPRINT("NtUserCreateWindowEx\n");
|
||||||
|
@ -136,7 +282,15 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
return((HWND)0);
|
return((HWND)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Validate the parent window. */
|
if (hWndParent != NULL)
|
||||||
|
{
|
||||||
|
ParentWindow = W32kGetWindowObject(hWndParent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hWndParent = PsGetWin32Thread()->Desktop->DesktopWindow;
|
||||||
|
ParentWindow = W32kGetWindowObject(hWndParent);
|
||||||
|
}
|
||||||
|
|
||||||
/* Check the class. */
|
/* Check the class. */
|
||||||
Status = ClassReferenceClassByNameOrAtom(&ClassObject, lpClassName->Buffer);
|
Status = ClassReferenceClassByNameOrAtom(&ClassObject, lpClassName->Buffer);
|
||||||
|
@ -187,14 +341,13 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
WindowObject->y = y;
|
WindowObject->y = y;
|
||||||
WindowObject->Width = nWidth;
|
WindowObject->Width = nWidth;
|
||||||
WindowObject->Height = nHeight;
|
WindowObject->Height = nHeight;
|
||||||
WindowObject->Parent = hWndParent;
|
WindowObject->ParentHandle = hWndParent;
|
||||||
WindowObject->Menu = hMenu;
|
WindowObject->Menu = hMenu;
|
||||||
WindowObject->Instance = hInstance;
|
WindowObject->Instance = hInstance;
|
||||||
WindowObject->Parameters = lpParam;
|
WindowObject->Parameters = lpParam;
|
||||||
WindowObject->Self = Handle;
|
WindowObject->Self = Handle;
|
||||||
WindowObject->MessageQueue = PsGetWin32Thread()->MessageQueue;
|
WindowObject->MessageQueue = PsGetWin32Thread()->MessageQueue;
|
||||||
|
WindowObject->Parent = ParentWindow;
|
||||||
/* FIXME: Add the window parent. */
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&WindowObject->WindowName, WindowName.Buffer);
|
RtlInitUnicodeString(&WindowObject->WindowName, WindowName.Buffer);
|
||||||
RtlFreeUnicodeString(&WindowName);
|
RtlFreeUnicodeString(&WindowName);
|
||||||
|
@ -229,7 +382,12 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
&WindowObject->ListEntry);
|
&WindowObject->ListEntry);
|
||||||
ExReleaseFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock);
|
ExReleaseFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock);
|
||||||
|
|
||||||
/* FIXME: Insert the window into the desktop window list. */
|
/*
|
||||||
|
* Insert the window into the list of windows associated with the thread's
|
||||||
|
* desktop.
|
||||||
|
*/
|
||||||
|
InsertTailList(&PsGetWin32Thread()->Desktop->WindowListHead,
|
||||||
|
&WindowObject->DesktopListEntry);
|
||||||
|
|
||||||
/* FIXME: Maybe allocate a DCE for this window. */
|
/* FIXME: Maybe allocate a DCE for this window. */
|
||||||
|
|
||||||
|
@ -342,8 +500,6 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
NewPos.right, NewPos.bottom, SwFlag);
|
NewPos.right, NewPos.bottom, SwFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Need to set up parent window. */
|
|
||||||
#if 0
|
|
||||||
/* Notify the parent window of a new child. */
|
/* Notify the parent window of a new child. */
|
||||||
if ((WindowObject->Style & WS_CHILD) ||
|
if ((WindowObject->Style & WS_CHILD) ||
|
||||||
(!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY)))
|
(!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY)))
|
||||||
|
@ -354,7 +510,6 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
MAKEWPARAM(WM_CREATE, WindowObject->IDMenu),
|
MAKEWPARAM(WM_CREATE, WindowObject->IDMenu),
|
||||||
(LPARAM)WindowObject->Self);
|
(LPARAM)WindowObject->Self);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (dwStyle & WS_VISIBLE)
|
if (dwStyle & WS_VISIBLE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: winpos.c,v 1.2 2002/07/04 19:56:37 dwelch Exp $
|
/* $Id: winpos.c,v 1.3 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -35,6 +35,19 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
#define HAS_DLGFRAME(Style, ExStyle) \
|
||||||
|
(((ExStyle) & WS_EX_DLGMODALFRAME) || \
|
||||||
|
(((Style) & WS_DLGFRAME) && !((Style) & WS_BORDER)))
|
||||||
|
|
||||||
|
#define HAS_THICKFRAME(Style, ExStyle) \
|
||||||
|
(((Style) & WS_THICKFRAME) && \
|
||||||
|
!((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
POINT STATIC
|
POINT STATIC
|
||||||
WinPosFindIconPos(HWND hWnd, POINT Pos)
|
WinPosFindIconPos(HWND hWnd, POINT Pos)
|
||||||
{
|
{
|
||||||
|
@ -223,6 +236,62 @@ UINT
|
||||||
WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT* MaxPos,
|
WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT* MaxPos,
|
||||||
POINT* MinTrack, POINT* MaxTrack)
|
POINT* MinTrack, POINT* MaxTrack)
|
||||||
{
|
{
|
||||||
|
MINMAXINFO MinMax;
|
||||||
|
INT XInc, YInc;
|
||||||
|
INTERNALPOS* Pos;
|
||||||
|
|
||||||
|
/* Get default values. */
|
||||||
|
MinMax.ptMaxSize.x = NtUserGetSystemMetrics(SM_CXSCREEN);
|
||||||
|
MinMax.ptMaxSize.y = NtUserGetSystemMetrics(SM_CYSCREEN);
|
||||||
|
MinMax.ptMinTrackSize.x = NtUserGetSystemMetrics(SM_CXMINTRACK);
|
||||||
|
MinMax.ptMinTrackSize.y = NtUserGetSystemMetrics(SM_CYMINTRACK);
|
||||||
|
MinMax.ptMaxTrackSize.x = NtUserGetSystemMetrics(SM_CXSCREEN);
|
||||||
|
MinMax.ptMaxTrackSize.y = NtUserGetSystemMetrics(SM_CYSCREEN);
|
||||||
|
|
||||||
|
if (HAS_DLGFRAME(Window->Style, Window->ExStyle))
|
||||||
|
{
|
||||||
|
XInc = NtUserGetSystemMetrics(SM_CXDLGFRAME);
|
||||||
|
YInc = NtUserGetSystemMetrics(SM_CYDLGFRAME);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XInc = YInc = 0;
|
||||||
|
if (HAS_THICKFRAME(Window->Style, Window->ExStyle))
|
||||||
|
{
|
||||||
|
XInc += NtUserGetSystemMetrics(SM_CXFRAME);
|
||||||
|
YInc += NtUserGetSystemMetrics(SM_CYFRAME);
|
||||||
|
}
|
||||||
|
if (Window->Style & WS_BORDER)
|
||||||
|
{
|
||||||
|
XInc += NtUserGetSystemMetrics(SM_CXBORDER);
|
||||||
|
YInc += NtUserGetSystemMetrics(SM_CYBORDER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MinMax.ptMaxSize.x += 2 * XInc;
|
||||||
|
MinMax.ptMaxSize.y += 2 * YInc;
|
||||||
|
|
||||||
|
Pos = Window->InternalPos;
|
||||||
|
if (Pos != NULL)
|
||||||
|
{
|
||||||
|
MinMax.ptMaxPosition = Pos->MaxPos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MinMax.ptMaxPosition.x -= XInc;
|
||||||
|
MinMax.ptMaxPosition.y -= YInc;
|
||||||
|
}
|
||||||
|
|
||||||
|
W32kSendMessage(Window->Self, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax, TRUE);
|
||||||
|
|
||||||
|
MinMax.ptMaxTrackSize.x = max(MinMax.ptMaxTrackSize.x,
|
||||||
|
MinMax.ptMinTrackSize.x);
|
||||||
|
MinMax.ptMaxTrackSize.y = max(MinMax.ptMaxTrackSize.y,
|
||||||
|
MinMax.ptMinTrackSize.y);
|
||||||
|
|
||||||
|
if (MaxSize) *MaxSize = MinMax.ptMaxSize;
|
||||||
|
if (MaxPos) *MaxPos = MinMax.ptMaxPosition;
|
||||||
|
if (MinTrack) *MinTrack = MinMax.ptMinTrackSize;
|
||||||
|
if (MaxTrack) *MaxTrack = MinMax.ptMaxTrackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STATIC
|
BOOL STATIC
|
||||||
|
@ -288,7 +357,11 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
|
||||||
|
|
||||||
/* FIXME: Get current active window from active queue. */
|
/* FIXME: Get current active window from active queue. */
|
||||||
|
|
||||||
/* FIXME: Check if the window is for a desktop. */
|
/* Check if the window is for a desktop. */
|
||||||
|
if (Wnd == PsGetWin32Thread()->Desktop->DesktopWindow)
|
||||||
|
{
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
Status =
|
Status =
|
||||||
ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
|
ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
|
||||||
|
@ -557,7 +630,7 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Window->Style & WS_CHILD &&
|
if (Window->Style & WS_CHILD &&
|
||||||
/* !IsWindowVisible(WindowObject->Parent->Self) && */
|
!W32kIsWindowVisible(Window->Parent->Self) &&
|
||||||
(Swp & (SWP_NOSIZE | SWP_NOMOVE)) == (SWP_NOSIZE | SWP_NOMOVE))
|
(Swp & (SWP_NOSIZE | SWP_NOMOVE)) == (SWP_NOSIZE | SWP_NOMOVE))
|
||||||
{
|
{
|
||||||
if (Cmd == SW_HIDE)
|
if (Cmd == SW_HIDE)
|
||||||
|
@ -583,10 +656,24 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
|
||||||
if (Cmd == SW_HIDE)
|
if (Cmd == SW_HIDE)
|
||||||
{
|
{
|
||||||
/* Hide the window. */
|
/* Hide the window. */
|
||||||
|
if (Wnd == W32kGetActiveWindow())
|
||||||
|
{
|
||||||
|
WinPosActivateOtherWindow(Window);
|
||||||
|
}
|
||||||
|
/* Revert focus to parent. */
|
||||||
|
if (Wnd == W32kGetFocusWindow() ||
|
||||||
|
W32kIsChildWindow(Wnd, W32kGetFocusWindow()))
|
||||||
|
{
|
||||||
|
W32kSetFocusWindow(Window->Parent->Self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FIXME: Check for window destruction. */
|
/* FIXME: Check for window destruction. */
|
||||||
/* FIXME: Show title for minimized windows. */
|
/* Show title for minimized windows. */
|
||||||
|
if (Window->Style & WS_MINIMIZE)
|
||||||
|
{
|
||||||
|
WinPosShowIconTitle(Window, TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Window->Flags & WINDOWOBJECT_NEED_SIZE)
|
if (Window->Flags & WINDOWOBJECT_NEED_SIZE)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: winsta.c,v 1.4 2002/07/04 19:56:37 dwelch Exp $
|
/* $Id: winsta.c,v 1.5 2002/07/17 21:04:57 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -14,18 +14,42 @@
|
||||||
* the first USER32/GDI32 call not related
|
* the first USER32/GDI32 call not related
|
||||||
* to window station/desktop handling
|
* to window station/desktop handling
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
|
#include <include/guicheck.h>
|
||||||
|
#include <napi/win32.h>
|
||||||
|
#include <include/class.h>
|
||||||
|
#include <include/window.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
//#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
#define WINSTA_ROOT_NAME L"\\Windows\\WindowStations"
|
#define WINSTA_ROOT_NAME L"\\Windows\\WindowStations"
|
||||||
|
|
||||||
|
LRESULT CALLBACK
|
||||||
|
W32kDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
HDESK InputDesktop; /* Currently active desktop */
|
STATIC PWNDCLASS_OBJECT DesktopWindowClass;
|
||||||
|
|
||||||
|
/* Currently active desktop */
|
||||||
|
STATIC HDESK InputDesktopHandle = NULL;
|
||||||
|
STATIC PDESKTOP_OBJECT InputDesktop = NULL;
|
||||||
|
STATIC PWINSTATION_OBJECT InputWindowStation = NULL;
|
||||||
|
|
||||||
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
PDESKTOP_OBJECT
|
||||||
|
W32kGetActiveDesktop(VOID)
|
||||||
|
{
|
||||||
|
return(InputDesktop);
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
InitWindowStationImpl(VOID)
|
InitWindowStationImpl(VOID)
|
||||||
|
@ -34,6 +58,7 @@ InitWindowStationImpl(VOID)
|
||||||
HANDLE WindowStationsDirectory;
|
HANDLE WindowStationsDirectory;
|
||||||
UNICODE_STRING UnicodeString;
|
UNICODE_STRING UnicodeString;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
WNDCLASSEX wcx;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the '\Windows\WindowStations' directory
|
* Create the '\Windows\WindowStations' directory
|
||||||
|
@ -57,7 +82,19 @@ InitWindowStationImpl(VOID)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
/*
|
||||||
|
* Create the desktop window class
|
||||||
|
*/
|
||||||
|
wcx.style = 0;
|
||||||
|
wcx.lpfnWndProc = W32kDesktopWindowProc;
|
||||||
|
wcx.cbClsExtra = wcx.cbWndExtra = 0;
|
||||||
|
wcx.hInstance = wcx.hIcon = wcx.hCursor = NULL;
|
||||||
|
wcx.hbrBackground = NULL;
|
||||||
|
wcx.lpszMenuName = NULL;
|
||||||
|
wcx.lpszClassName = L"DesktopWindowClass";
|
||||||
|
DesktopWindowClass = W32kCreateClass(&wcx, TRUE);
|
||||||
|
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -475,10 +512,8 @@ NtUserCloseDesktop(
|
||||||
* Handle to the new desktop that can be closed with NtUserCloseDesktop()
|
* Handle to the new desktop that can be closed with NtUserCloseDesktop()
|
||||||
* Zero on failure
|
* Zero on failure
|
||||||
*/
|
*/
|
||||||
HDESK
|
HDESK STDCALL
|
||||||
STDCALL
|
NtUserCreateDesktop(PUNICODE_STRING lpszDesktopName,
|
||||||
NtUserCreateDesktop(
|
|
||||||
PUNICODE_STRING lpszDesktopName,
|
|
||||||
DWORD dwFlags,
|
DWORD dwFlags,
|
||||||
ACCESS_MASK dwDesiredAccess,
|
ACCESS_MASK dwDesiredAccess,
|
||||||
LPSECURITY_ATTRIBUTES lpSecurity,
|
LPSECURITY_ATTRIBUTES lpSecurity,
|
||||||
|
@ -492,15 +527,15 @@ NtUserCreateDesktop(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HDESK Desktop;
|
HDESK Desktop;
|
||||||
|
|
||||||
Status = ValidateWindowStationHandle(
|
Status = ValidateWindowStationHandle(hWindowStation,
|
||||||
hWindowStation,
|
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Failed validation of window station handle (0x%X)\n", hWindowStation);
|
DPRINT("Failed validation of window station handle (0x%X)\n",
|
||||||
return (HDESK)0;
|
hWindowStation);
|
||||||
|
return((HDESK)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscpy(NameBuffer, WINSTA_ROOT_NAME);
|
wcscpy(NameBuffer, WINSTA_ROOT_NAME);
|
||||||
|
@ -515,15 +550,12 @@ NtUserCreateDesktop(
|
||||||
DPRINT("Trying to open desktop (%wZ)\n", &DesktopName);
|
DPRINT("Trying to open desktop (%wZ)\n", &DesktopName);
|
||||||
|
|
||||||
/* Initialize ObjectAttributes for the desktop object */
|
/* Initialize ObjectAttributes for the desktop object */
|
||||||
InitializeObjectAttributes(
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&ObjectAttributes,
|
|
||||||
&DesktopName,
|
&DesktopName,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
Status = ObOpenObjectByName(&ObjectAttributes,
|
||||||
Status = ObOpenObjectByName(
|
|
||||||
&ObjectAttributes,
|
|
||||||
ExDesktopObjectType,
|
ExDesktopObjectType,
|
||||||
NULL,
|
NULL,
|
||||||
UserMode,
|
UserMode,
|
||||||
|
@ -533,13 +565,12 @@ NtUserCreateDesktop(
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Successfully opened desktop (%wZ)\n", &DesktopName);
|
DPRINT("Successfully opened desktop (%wZ)\n", &DesktopName);
|
||||||
return (HDESK)Desktop;
|
return((HDESK)Desktop);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Status for open operation (0x%X)\n", Status);
|
DPRINT("Status for open operation (0x%X)\n", Status);
|
||||||
|
|
||||||
Status = ObCreateObject(
|
Status = ObCreateObject(&Desktop,
|
||||||
&Desktop,
|
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
ExDesktopObjectType,
|
ExDesktopObjectType,
|
||||||
|
@ -548,10 +579,18 @@ NtUserCreateDesktop(
|
||||||
{
|
{
|
||||||
DPRINT("Failed creating desktop (%wZ)\n", &DesktopName);
|
DPRINT("Failed creating desktop (%wZ)\n", &DesktopName);
|
||||||
SetLastNtError(STATUS_UNSUCCESSFUL);
|
SetLastNtError(STATUS_UNSUCCESSFUL);
|
||||||
return (HDESK)0;
|
return((HDESK)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (HDESK)Desktop;
|
/* Initialize some local (to win32k) desktop state. */
|
||||||
|
DesktopObject->ActiveMessageQueue = NULL;
|
||||||
|
InitializeListHead(&DesktopObject->WindowListHead);
|
||||||
|
DesktopObject->DesktopWindow =
|
||||||
|
W32kCreateDesktopWindow(DesktopObject->WindowStation,
|
||||||
|
DesktopWindowClass,
|
||||||
|
640, 480);
|
||||||
|
|
||||||
|
return((HDESK)Desktop);
|
||||||
}
|
}
|
||||||
|
|
||||||
HDESK STDCALL
|
HDESK STDCALL
|
||||||
|
@ -703,32 +742,56 @@ NtUserOpenInputDesktop(
|
||||||
return (HDESK)0;
|
return (HDESK)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL STDCALL
|
||||||
STDCALL
|
NtUserPaintDesktop(HDC hDC)
|
||||||
NtUserPaintDesktop(
|
|
||||||
HDC hDC)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
NtUserResolveDesktopForWOW(DWORD Unknown0)
|
||||||
NtUserResolveDesktopForWOW(
|
|
||||||
DWORD Unknown0)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserSetThreadDesktop(HDESK hDesktop)
|
NtUserSetThreadDesktop(HDESK hDesktop)
|
||||||
{
|
{
|
||||||
|
PDESKTOP_OBJECT DesktopObject;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Initialize the Win32 state if necessary. */
|
||||||
|
W32kGuiCheck();
|
||||||
|
|
||||||
|
/* Validate the new desktop. */
|
||||||
|
Status = ValidateDesktopHandle(hDesktop,
|
||||||
|
KernelMode,
|
||||||
|
0,
|
||||||
|
&DesktopObject);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for setting the same desktop as before. */
|
||||||
|
if (DesktopObject == PsGetWin32Thread()->Desktop)
|
||||||
|
{
|
||||||
|
ObDereferenceObject(DesktopObject);
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: Should check here to see if the thread has any windows. */
|
||||||
|
|
||||||
|
ObDereferenceObject(PsGetWin32Thread()->Desktop);
|
||||||
|
PsGetWin32Thread()->Desktop = DesktopObject;
|
||||||
|
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION:
|
* FUNCTION:
|
||||||
* Sets the current input (interactive) desktop
|
* Sets the current input (interactive) desktop
|
||||||
|
@ -737,34 +800,56 @@ NtUserSetThreadDesktop(HDESK hDesktop)
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
* Status
|
* Status
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL STDCALL
|
||||||
STDCALL
|
NtUserSwitchDesktop(HDESK hDesktop)
|
||||||
NtUserSwitchDesktop(
|
|
||||||
HDESK hDesktop)
|
|
||||||
{
|
{
|
||||||
PDESKTOP_OBJECT Object;
|
PDESKTOP_OBJECT DesktopObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("About to switch desktop (0x%X)\n", hDesktop);
|
DPRINT("About to switch desktop (0x%X)\n", hDesktop);
|
||||||
|
|
||||||
Status = ValidateDesktopHandle(
|
Status = ValidateDesktopHandle(hDesktop,
|
||||||
hDesktop,
|
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&Object);
|
&DesktopObject);
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
|
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObDereferenceObject(Object);
|
|
||||||
|
|
||||||
/* FIXME: Fail if the desktop belong to an invisible window station */
|
/* FIXME: Fail if the desktop belong to an invisible window station */
|
||||||
/* FIXME: Fail if the process is associated with a secured
|
/* FIXME: Fail if the process is associated with a secured
|
||||||
desktop such as Winlogon or Screen-Saver */
|
desktop such as Winlogon or Screen-Saver */
|
||||||
|
|
||||||
/* FIXME: Connect to input device */
|
/* FIXME: Connect to input device */
|
||||||
return TRUE;
|
|
||||||
|
/* Set the active desktop in the desktop's window station. */
|
||||||
|
DesktopObject->WindowStation->ActiveDesktop = DesktopObject;
|
||||||
|
|
||||||
|
/* Set the global state. */
|
||||||
|
InputDesktopHandle = hDesktop;
|
||||||
|
InputDesktop = DesktopObject;
|
||||||
|
InputWindowStation = DesktopObject->WindowStation;
|
||||||
|
|
||||||
|
ObDereferenceObject(DesktopObject);
|
||||||
|
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK
|
||||||
|
W32kDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
|
case WM_CREATE:
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
case WM_NCCREATE:
|
||||||
|
return(1);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -20,6 +20,11 @@ W32kCropRgn(HRGN hDest, HRGN hSrc, const RECT* Rect, const POINT* Point)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRGN STDCALL
|
||||||
|
W32kUnionRectWithRgn(HRGN hDest, const RECT* Rect)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
W32kCombineRgn(HRGN hDest,
|
W32kCombineRgn(HRGN hDest,
|
||||||
HRGN hSrc1,
|
HRGN hSrc1,
|
||||||
|
|
Loading…
Reference in a new issue