From e0cba65fdf32b5fc0e7812287b820b4164fa0ace Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Wed, 20 May 2009 11:08:08 +0000 Subject: [PATCH] - Add check of params for NtGetWriteWatch/NtResetWriteWatch (from Wine) - Set Granularity to PAGE_SIZE Fixes crash in kernel32 virtual test svn path=/trunk/; revision=41015 --- reactos/ntoskrnl/mm/mm.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/reactos/ntoskrnl/mm/mm.c b/reactos/ntoskrnl/mm/mm.c index 65cb16b5956..6bb21351a0a 100644 --- a/reactos/ntoskrnl/mm/mm.c +++ b/reactos/ntoskrnl/mm/mm.c @@ -434,6 +434,9 @@ MmSetAddressRangeModified ( return (FALSE); } +/* + * @unimplemented + */ NTSTATUS NTAPI NtGetWriteWatch(IN HANDLE ProcessHandle, @@ -444,16 +447,42 @@ NtGetWriteWatch(IN HANDLE ProcessHandle, OUT PULONG EntriesInUserAddressArray, OUT PULONG Granularity) { + if (!EntriesInUserAddressArray || !Granularity) + { + return STATUS_ACCESS_VIOLATION; + } + + if (!*EntriesInUserAddressArray || !RegionSize) + { + return STATUS_INVALID_PARAMETER; + } + + if (!UserAddressArray) + { + return STATUS_ACCESS_VIOLATION; + } + + /* HACK: Set granularity to PAGE_SIZE */ + *Granularity = PAGE_SIZE; + UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } +/* + * @unimplemented + */ NTSTATUS NTAPI NtResetWriteWatch(IN HANDLE ProcessHandle, IN PVOID BaseAddress, IN ULONG RegionSize) { + if (!RegionSize) + { + return STATUS_INVALID_PARAMETER; + } + UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; }