Author: sginsberg
Date: Sun Sep 7 04:25:31 2008
New Revision: 36021
URL:
http://svn.reactos.org/svn/reactos?rev=36021&view=rev
Log:
- Check for "!= KernelMode" instead of "== UserMode"
- Use sizeof(ULONG) instead of "4"
- Add some missing comments
Modified:
trunk/reactos/ntoskrnl/config/ntapi.c
Modified: trunk/reactos/ntoskrnl/config/ntapi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/ntapi.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] Sun Sep 7 04:25:31 2008
@@ -35,7 +35,7 @@
DPRINT("NtCreateKey(OB name %wZ)\n", ObjectAttributes->ObjectName);
/* Check for user-mode caller */
- if (PreviousMode == UserMode)
+ if (PreviousMode != KernelMode)
{
/* Prepare to probe parameters */
_SEH_TRY
@@ -56,7 +56,9 @@
*KeyHandle = NULL;
/* Probe object attributes */
- ProbeForRead(ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 4);
+ ProbeForRead(ObjectAttributes,
+ sizeof(OBJECT_ATTRIBUTES),
+ sizeof(ULONG));
}
_SEH_HANDLE
{
@@ -87,9 +89,8 @@
_SEH_TRY
{
+ /* Return data to user */
if (NT_SUCCESS(Status)) *KeyHandle = Handle;
-
- /* Return data to user */
if (Disposition) *Disposition = ParseContext.Disposition;
}
_SEH_HANDLE
@@ -117,7 +118,7 @@
DPRINT("NtOpenKey(OB 0x%wZ)\n", ObjectAttributes->ObjectName);
/* Check for user-mode caller */
- if (PreviousMode == UserMode)
+ if (PreviousMode != KernelMode)
{
/* Prepare to probe parameters */
_SEH_TRY
@@ -127,7 +128,9 @@
*KeyHandle = NULL;
/* Probe object attributes */
- ProbeForRead(ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 4);
+ ProbeForRead(ObjectAttributes,
+ sizeof(OBJECT_ATTRIBUTES),
+ sizeof(ULONG));
}
_SEH_HANDLE
{
@@ -147,10 +150,12 @@
&ParseContext,
&Handle);
+ /* Only do this if we succeeded */
if (NT_SUCCESS(Status))
{
_SEH_TRY
{
+ /* Return the handle to caller */
*KeyHandle = Handle;
}
_SEH_HANDLE