- Fix CM SEH by public demand.

svn path=/trunk/; revision=34059
This commit is contained in:
Aleksey Bragin 2008-06-23 12:45:27 +00:00
parent 832844b9fb
commit 3a0ed2c825

View file

@ -34,11 +34,11 @@ NtCreateKey(OUT PHANDLE KeyHandle,
PAGED_CODE();
DPRINT("NtCreateKey(OB 0x%wZ)\n", ObjectAttributes->ObjectName);
/* Prepare to probe parameters */
_SEH_TRY
/* Check for user-mode caller */
if (PreviousMode == UserMode)
{
/* Check for user-mode caller */
if (PreviousMode == UserMode)
/* Prepare to probe parameters */
_SEH_TRY
{
/* Check if we have a class */
if (Class)
@ -50,32 +50,43 @@ NtCreateKey(OUT PHANDLE KeyHandle,
sizeof(WCHAR));
ParseContext.Class = *Class;
}
/* Probe the key handle */
ProbeForWriteHandle(KeyHandle);
*KeyHandle = NULL;
/* Probe object attributes */
ProbeForRead(ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 4);
}
else
_SEH_HANDLE
{
/* Save the class directly */
if (Class) ParseContext.Class = *Class;
/* Get the error code */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
else
{
/* Save the class directly */
if (Class) ParseContext.Class = *Class;
}
/* Setup the parse context */
ParseContext.CreateOperation = TRUE;
ParseContext.CreateOptions = CreateOptions;
/* Setup the parse context */
ParseContext.CreateOperation = TRUE;
ParseContext.CreateOptions = CreateOptions;
/* Do the create */
Status = ObOpenObjectByName(ObjectAttributes,
CmpKeyObjectType,
PreviousMode,
NULL,
DesiredAccess,
&ParseContext,
&Handle);
/* Do the create */
Status = ObOpenObjectByName(ObjectAttributes,
CmpKeyObjectType,
PreviousMode,
NULL,
DesiredAccess,
&ParseContext,
&Handle);
_SEH_TRY
{
if (NT_SUCCESS(Status)) *KeyHandle = Handle;
/* Return data to user */
@ -105,11 +116,11 @@ NtOpenKey(OUT PHANDLE KeyHandle,
PAGED_CODE();
DPRINT("NtOpenKey(OB 0x%wZ)\n", ObjectAttributes->ObjectName);
/* Prepare to probe parameters */
_SEH_TRY
/* Check for user-mode caller */
if (PreviousMode == UserMode)
{
/* Check for user-mode caller */
if (PreviousMode == UserMode)
/* Prepare to probe parameters */
_SEH_TRY
{
/* Probe the key handle */
ProbeForWriteHandle(KeyHandle);
@ -118,23 +129,36 @@ NtOpenKey(OUT PHANDLE KeyHandle,
/* Probe object attributes */
ProbeForRead(ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 4);
}
_SEH_HANDLE
{
/* Get the status */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
}
/* Just let the object manager handle this */
Status = ObOpenObjectByName(ObjectAttributes,
CmpKeyObjectType,
ExGetPreviousMode(),
NULL,
DesiredAccess,
&ParseContext,
&Handle);
if (NT_SUCCESS(Status)) *KeyHandle = Handle;
}
_SEH_HANDLE
/* Just let the object manager handle this */
Status = ObOpenObjectByName(ObjectAttributes,
CmpKeyObjectType,
ExGetPreviousMode(),
NULL,
DesiredAccess,
&ParseContext,
&Handle);
if (NT_SUCCESS(Status))
{
/* Get the status */
Status = _SEH_GetExceptionCode();
_SEH_TRY
{
*KeyHandle = Handle;
}
_SEH_HANDLE
{
/* Get the status */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
}
_SEH_END;
/* Return status */
return Status;