[ros-dev] [ros-diffs] [fireball] 34047: - Extend SEH to cover writing result to output arguments. Noticed by Stefan Ginsberg.
Alex Ionescu
ionucu at videotron.ca
Sun Jun 22 19:10:27 CEST 2008
Do you even realize the consequences of running the entire Object
Manager code paths, the parse routine, and the other ~2500 lines of
code associated with these APIs under SEH?
I'd guess not.
On 22-Jun-08, at 9:24 AM, fireball at svn.reactos.org wrote:
> Author: fireball
> Date: Sun Jun 22 11:24:15 2008
> New Revision: 34047
>
> URL: http://svn.reactos.org/svn/reactos?rev=34047&view=rev
> Log:
> - Extend SEH to cover writing result to output arguments. Noticed by
> Stefan Ginsberg.
>
> 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?rev=34047&r1=34046&r2=34047&view=diff
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] Sun Jun 22
> 11:24:15 2008
> @@ -63,6 +63,23 @@
> /* Save the class directly */
> if (Class) ParseContext.Class = *Class;
> }
> +
> + /* Setup the parse context */
> + ParseContext.CreateOperation = TRUE;
> + ParseContext.CreateOptions = CreateOptions;
> +
> + /* Do the create */
> + Status = ObOpenObjectByName(ObjectAttributes,
> + CmpKeyObjectType,
> + PreviousMode,
> + NULL,
> + DesiredAccess,
> + &ParseContext,
> + &Handle);
> + if (NT_SUCCESS(Status)) *KeyHandle = Handle;
> +
> + /* Return data to user */
> + if (Disposition) *Disposition = ParseContext.Disposition;
> }
> _SEH_HANDLE
> {
> @@ -70,24 +87,8 @@
> Status = _SEH_GetExceptionCode();
> }
> _SEH_END;
> - if (!NT_SUCCESS(Status)) return Status;
> -
> - /* Setup the parse context */
> - ParseContext.CreateOperation = TRUE;
> - ParseContext.CreateOptions = CreateOptions;
> -
> - /* Do the create */
> - Status = ObOpenObjectByName(ObjectAttributes,
> - CmpKeyObjectType,
> - PreviousMode,
> - NULL,
> - DesiredAccess,
> - &ParseContext,
> - &Handle);
> - if (NT_SUCCESS(Status)) *KeyHandle = Handle;
> -
> - /* Return data to user */
> - if (Disposition) *Disposition = ParseContext.Disposition;
> +
> + /* Return status */
> return Status;
> }
>
> @@ -109,14 +110,24 @@
> {
> /* Check for user-mode caller */
> if (PreviousMode == UserMode)
> - {
> + {
> /* Probe the key handle */
> ProbeForWriteHandle(KeyHandle);
> *KeyHandle = NULL;
> -
> +
> /* Probe object attributes */
> ProbeForRead(ObjectAttributes,
> sizeof(OBJECT_ATTRIBUTES), 4);
> }
> +
> + /* Just let the object manager handle this */
> + Status = ObOpenObjectByName(ObjectAttributes,
> + CmpKeyObjectType,
> + ExGetPreviousMode(),
> + NULL,
> + DesiredAccess,
> + &ParseContext,
> + &Handle);
> + if (NT_SUCCESS(Status)) *KeyHandle = Handle;
> }
> _SEH_HANDLE
> {
> @@ -124,18 +135,7 @@
> Status = _SEH_GetExceptionCode();
> }
> _SEH_END;
> - if (!NT_SUCCESS(Status)) return Status;
> -
> - /* Just let the object manager handle this */
> - Status = ObOpenObjectByName(ObjectAttributes,
> - CmpKeyObjectType,
> - ExGetPreviousMode(),
> - NULL,
> - DesiredAccess,
> - &ParseContext,
> - &Handle);
> - if (NT_SUCCESS(Status)) *KeyHandle = Handle;
> -
> +
> /* Return status */
> return Status;
> }
>
Best regards,
Alex Ionescu
More information about the Ros-dev
mailing list