Author: hyperion
Date: Sun Nov 30 00:00:58 2008
New Revision: 37758
URL:
http://svn.reactos.org/svn/reactos?rev=37758&view=rev
Log:
Left out of the previous commit by mistake
Added:
trunk/reactos/ntoskrnl/include/internal/probe.h (with props)
Modified:
trunk/reactos/ntoskrnl/include/ntoskrnl.h
Added: trunk/reactos/ntoskrnl/include/internal/probe.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/probe.h (added)
+++ trunk/reactos/ntoskrnl/include/internal/probe.h [iso-8859-1] Sun Nov 30 00:00:58 2008
@@ -1,0 +1,468 @@
+#ifndef __INCLUDE_INTERNAL_PROBE_H
+#define __INCLUDE_INTERNAL_PROBE_H
+
+#include <reactos/probe.h>
+
+static
+__inline
+NTSTATUS
+DefaultSetInfoBufferCheck(ULONG Class,
+ const INFORMATION_CLASS_INFO *ClassList,
+ ULONG ClassListEntries,
+ PVOID Buffer,
+ ULONG BufferLength,
+ KPROCESSOR_MODE PreviousMode)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ if (Class < ClassListEntries)
+ {
+ if (!(ClassList[Class].Flags & ICIF_SET))
+ {
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
+ else if (ClassList[Class].RequiredSizeSET > 0 &&
+ BufferLength != ClassList[Class].RequiredSizeSET)
+ {
+ if (!(ClassList[Class].Flags & ICIF_SET_SIZE_VARIABLE))
+ {
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (PreviousMode != KernelMode)
+ {
+ _SEH2_TRY
+ {
+ ProbeForRead(Buffer,
+ BufferLength,
+ ClassList[Class].AlignmentSET);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+ }
+ }
+ }
+ else
+ Status = STATUS_INVALID_INFO_CLASS;
+
+ return Status;
+}
+
+static
+__inline
+NTSTATUS
+DefaultQueryInfoBufferCheck(ULONG Class,
+ const INFORMATION_CLASS_INFO *ClassList,
+ ULONG ClassListEntries,
+ PVOID Buffer,
+ ULONG BufferLength,
+ PULONG ReturnLength,
+ KPROCESSOR_MODE PreviousMode)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ if (Class < ClassListEntries)
+ {
+ if (!(ClassList[Class].Flags & ICIF_QUERY))
+ {
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
+ else if (ClassList[Class].RequiredSizeQUERY > 0 &&
+ BufferLength != ClassList[Class].RequiredSizeQUERY)
+ {
+ if (!(ClassList[Class].Flags & ICIF_QUERY_SIZE_VARIABLE))
+ {
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (PreviousMode != KernelMode)
+ {
+ _SEH2_TRY
+ {
+ if (Buffer != NULL)
+ {
+ ProbeForWrite(Buffer,
+ BufferLength,
+ ClassList[Class].AlignmentQUERY);
+ }
+
+ if (ReturnLength != NULL)
+ {
+ ProbeForWriteUlong(ReturnLength);
+ }
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+ }
+ }
+ }
+ else
+ Status = STATUS_INVALID_INFO_CLASS;
+
+ return Status;
+}
+
+#endif
+#ifndef __INCLUDE_INTERNAL_PROBE_H
+#define __INCLUDE_INTERNAL_PROBE_H
+
+#include <reactos/probe.h>
+
+static
+__inline
+NTSTATUS
+DefaultSetInfoBufferCheck(ULONG Class,
+ const INFORMATION_CLASS_INFO *ClassList,
+ ULONG ClassListEntries,
+ PVOID Buffer,
+ ULONG BufferLength,
+ KPROCESSOR_MODE PreviousMode)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ if (Class < ClassListEntries)
+ {
+ if (!(ClassList[Class].Flags & ICIF_SET))
+ {
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
+ else if (ClassList[Class].RequiredSizeSET > 0 &&
+ BufferLength != ClassList[Class].RequiredSizeSET)
+ {
+ if (!(ClassList[Class].Flags & ICIF_SET_SIZE_VARIABLE))
+ {
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (PreviousMode != KernelMode)
+ {
+ _SEH2_TRY
+ {
+ ProbeForRead(Buffer,
+ BufferLength,
+ ClassList[Class].AlignmentSET);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+ }
+ }
+ }
+ else
+ Status = STATUS_INVALID_INFO_CLASS;
+
+ return Status;
+}
+
+static
+__inline
+NTSTATUS
+DefaultQueryInfoBufferCheck(ULONG Class,
+ const INFORMATION_CLASS_INFO *ClassList,
+ ULONG ClassListEntries,
+ PVOID Buffer,
+ ULONG BufferLength,
+ PULONG ReturnLength,
+ KPROCESSOR_MODE PreviousMode)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ if (Class < ClassListEntries)
+ {
+ if (!(ClassList[Class].Flags & ICIF_QUERY))
+ {
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
+ else if (ClassList[Class].RequiredSizeQUERY > 0 &&
+ BufferLength != ClassList[Class].RequiredSizeQUERY)
+ {
+ if (!(ClassList[Class].Flags & ICIF_QUERY_SIZE_VARIABLE))
+ {
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (PreviousMode != KernelMode)
+ {
+ _SEH2_TRY
+ {
+ if (Buffer != NULL)
+ {
+ ProbeForWrite(Buffer,
+ BufferLength,
+ ClassList[Class].AlignmentQUERY);
+ }
+
+ if (ReturnLength != NULL)
+ {
+ ProbeForWriteUlong(ReturnLength);
+ }
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+ }
+ }
+ }
+ else
+ Status = STATUS_INVALID_INFO_CLASS;
+
+ return Status;
+}
+
+#endif
+#ifndef __INCLUDE_INTERNAL_PROBE_H
+#define __INCLUDE_INTERNAL_PROBE_H
+
+#include <reactos/probe.h>
+
+static
+__inline
+NTSTATUS
+DefaultSetInfoBufferCheck(ULONG Class,
+ const INFORMATION_CLASS_INFO *ClassList,
+ ULONG ClassListEntries,
+ PVOID Buffer,
+ ULONG BufferLength,
+ KPROCESSOR_MODE PreviousMode)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ if (Class < ClassListEntries)
+ {
+ if (!(ClassList[Class].Flags & ICIF_SET))
+ {
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
+ else if (ClassList[Class].RequiredSizeSET > 0 &&
+ BufferLength != ClassList[Class].RequiredSizeSET)
+ {
+ if (!(ClassList[Class].Flags & ICIF_SET_SIZE_VARIABLE))
+ {
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (PreviousMode != KernelMode)
+ {
+ _SEH2_TRY
+ {
+ ProbeForRead(Buffer,
+ BufferLength,
+ ClassList[Class].AlignmentSET);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+ }
+ }
+ }
+ else
+ Status = STATUS_INVALID_INFO_CLASS;
+
+ return Status;
+}
+
+static
+__inline
+NTSTATUS
+DefaultQueryInfoBufferCheck(ULONG Class,
+ const INFORMATION_CLASS_INFO *ClassList,
+ ULONG ClassListEntries,
+ PVOID Buffer,
+ ULONG BufferLength,
+ PULONG ReturnLength,
+ KPROCESSOR_MODE PreviousMode)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ if (Class < ClassListEntries)
+ {
+ if (!(ClassList[Class].Flags & ICIF_QUERY))
+ {
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
+ else if (ClassList[Class].RequiredSizeQUERY > 0 &&
+ BufferLength != ClassList[Class].RequiredSizeQUERY)
+ {
+ if (!(ClassList[Class].Flags & ICIF_QUERY_SIZE_VARIABLE))
+ {
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (PreviousMode != KernelMode)
+ {
+ _SEH2_TRY
+ {
+ if (Buffer != NULL)
+ {
+ ProbeForWrite(Buffer,
+ BufferLength,
+ ClassList[Class].AlignmentQUERY);
+ }
+
+ if (ReturnLength != NULL)
+ {
+ ProbeForWriteUlong(ReturnLength);
+ }
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+ }
+ }
+ }
+ else
+ Status = STATUS_INVALID_INFO_CLASS;
+
+ return Status;
+}
+
+#endif
+#ifndef __INCLUDE_INTERNAL_PROBE_H
+#define __INCLUDE_INTERNAL_PROBE_H
+
+#include <reactos/probe.h>
+
+static
+__inline
+NTSTATUS
+DefaultSetInfoBufferCheck(ULONG Class,
+ const INFORMATION_CLASS_INFO *ClassList,
+ ULONG ClassListEntries,
+ PVOID Buffer,
+ ULONG BufferLength,
+ KPROCESSOR_MODE PreviousMode)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ if (Class < ClassListEntries)
+ {
+ if (!(ClassList[Class].Flags & ICIF_SET))
+ {
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
+ else if (ClassList[Class].RequiredSizeSET > 0 &&
+ BufferLength != ClassList[Class].RequiredSizeSET)
+ {
+ if (!(ClassList[Class].Flags & ICIF_SET_SIZE_VARIABLE))
+ {
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (PreviousMode != KernelMode)
+ {
+ _SEH2_TRY
+ {
+ ProbeForRead(Buffer,
+ BufferLength,
+ ClassList[Class].AlignmentSET);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+ }
+ }
+ }
+ else
+ Status = STATUS_INVALID_INFO_CLASS;
+
+ return Status;
+}
+
+static
+__inline
+NTSTATUS
+DefaultQueryInfoBufferCheck(ULONG Class,
+ const INFORMATION_CLASS_INFO *ClassList,
+ ULONG ClassListEntries,
+ PVOID Buffer,
+ ULONG BufferLength,
+ PULONG ReturnLength,
+ KPROCESSOR_MODE PreviousMode)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ if (Class < ClassListEntries)
+ {
+ if (!(ClassList[Class].Flags & ICIF_QUERY))
+ {
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
+ else if (ClassList[Class].RequiredSizeQUERY > 0 &&
+ BufferLength != ClassList[Class].RequiredSizeQUERY)
+ {
+ if (!(ClassList[Class].Flags & ICIF_QUERY_SIZE_VARIABLE))
+ {
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ if (PreviousMode != KernelMode)
+ {
+ _SEH2_TRY
+ {
+ if (Buffer != NULL)
+ {
+ ProbeForWrite(Buffer,
+ BufferLength,
+ ClassList[Class].AlignmentQUERY);
+ }
+
+ if (ReturnLength != NULL)
+ {
+ ProbeForWriteUlong(ReturnLength);
+ }
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+ }
+ }
+ }
+ else
+ Status = STATUS_INVALID_INFO_CLASS;
+
+ return Status;
+}
+
+#endif
Propchange: trunk/reactos/ntoskrnl/include/internal/probe.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/ntoskrnl.…
==============================================================================
--- trunk/reactos/ntoskrnl/include/ntoskrnl.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/ntoskrnl.h [iso-8859-1] Sun Nov 30 00:00:58 2008
@@ -2,3 +2,4 @@
/* Headers that shouldn't be precompiled due to GCC bugs */
#include <reactos/probe.h>
+#include "internal/probe.h"