- Check for "!= KernelMode" instead of "== UserMode"

- Use sizeof(ULONG) instead of "4"
- Add some missing comments

svn path=/trunk/; revision=36021
This commit is contained in:
Stefan Ginsberg 2008-09-07 09:25:31 +00:00
parent 26fef2b1c8
commit 3fecdcc23c

View file

@ -35,7 +35,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
DPRINT("NtCreateKey(OB name %wZ)\n", ObjectAttributes->ObjectName); DPRINT("NtCreateKey(OB name %wZ)\n", ObjectAttributes->ObjectName);
/* Check for user-mode caller */ /* Check for user-mode caller */
if (PreviousMode == UserMode) if (PreviousMode != KernelMode)
{ {
/* Prepare to probe parameters */ /* Prepare to probe parameters */
_SEH_TRY _SEH_TRY
@ -56,7 +56,9 @@ NtCreateKey(OUT PHANDLE KeyHandle,
*KeyHandle = NULL; *KeyHandle = NULL;
/* Probe object attributes */ /* Probe object attributes */
ProbeForRead(ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 4); ProbeForRead(ObjectAttributes,
sizeof(OBJECT_ATTRIBUTES),
sizeof(ULONG));
} }
_SEH_HANDLE _SEH_HANDLE
{ {
@ -87,9 +89,8 @@ NtCreateKey(OUT PHANDLE KeyHandle,
_SEH_TRY _SEH_TRY
{ {
if (NT_SUCCESS(Status)) *KeyHandle = Handle;
/* Return data to user */ /* Return data to user */
if (NT_SUCCESS(Status)) *KeyHandle = Handle;
if (Disposition) *Disposition = ParseContext.Disposition; if (Disposition) *Disposition = ParseContext.Disposition;
} }
_SEH_HANDLE _SEH_HANDLE
@ -117,7 +118,7 @@ NtOpenKey(OUT PHANDLE KeyHandle,
DPRINT("NtOpenKey(OB 0x%wZ)\n", ObjectAttributes->ObjectName); DPRINT("NtOpenKey(OB 0x%wZ)\n", ObjectAttributes->ObjectName);
/* Check for user-mode caller */ /* Check for user-mode caller */
if (PreviousMode == UserMode) if (PreviousMode != KernelMode)
{ {
/* Prepare to probe parameters */ /* Prepare to probe parameters */
_SEH_TRY _SEH_TRY
@ -127,7 +128,9 @@ NtOpenKey(OUT PHANDLE KeyHandle,
*KeyHandle = NULL; *KeyHandle = NULL;
/* Probe object attributes */ /* Probe object attributes */
ProbeForRead(ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 4); ProbeForRead(ObjectAttributes,
sizeof(OBJECT_ATTRIBUTES),
sizeof(ULONG));
} }
_SEH_HANDLE _SEH_HANDLE
{ {
@ -147,10 +150,12 @@ NtOpenKey(OUT PHANDLE KeyHandle,
&ParseContext, &ParseContext,
&Handle); &Handle);
/* Only do this if we succeeded */
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
_SEH_TRY _SEH_TRY
{ {
/* Return the handle to caller */
*KeyHandle = Handle; *KeyHandle = Handle;
} }
_SEH_HANDLE _SEH_HANDLE