From 449a2042e79d79b046443ff640acfbdc2d0fbdbe Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Fri, 2 Jun 2006 14:08:22 +0000 Subject: [PATCH] forgot header in last commit bug report(1455) & patch by w3seek svn path=/trunk/; revision=22178 --- reactos/include/reactos/probe.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reactos/include/reactos/probe.h b/reactos/include/reactos/probe.h index 742b4a096c5..04e83369ab6 100644 --- a/reactos/include/reactos/probe.h +++ b/reactos/include/reactos/probe.h @@ -74,6 +74,15 @@ VOID NTAPI W32kRaiseStatus(NTSTATUS Status); #define ProbeForReadUlargeInteger(Ptr) ProbeForReadGenericType(Ptr, ULARGE_INTEGER, __emptyULargeInteger) #define ProbeForReadUnicodeString(Ptr) ProbeForReadGenericType(Ptr, UNICODE_STRING, __emptyUnicodeString) +#define ProbeAndZeroHandle(Ptr) \ + do { \ + if ((ULONG_PTR)(Ptr) + sizeof(HANDLE) - 1 < (ULONG_PTR)(Ptr) || \ + (ULONG_PTR)(Ptr) + sizeof(HANDLE) - 1 >= (ULONG_PTR)MmUserProbeAddress) { \ + RtlRaiseStatus (STATUS_ACCESS_VIOLATION); \ + } \ + *(volatile HANDLE *)(Ptr) = NULL; \ + } while (0) + /* * Inlined Probing Macros */