From f04772cf3e397a9cc2e3883b28d267c64133e5dc Mon Sep 17 00:00:00 2001 From: Mike Nordell Date: Sat, 21 Aug 2004 20:05:35 +0000 Subject: [PATCH] Make code portable to compilers with SEH. svn path=/trunk/; revision=10639 --- reactos/ntoskrnl/mm/pool.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/pool.c b/reactos/ntoskrnl/mm/pool.c index 46125bcee23..7c38ba16b32 100644 --- a/reactos/ntoskrnl/mm/pool.c +++ b/reactos/ntoskrnl/mm/pool.c @@ -1,4 +1,4 @@ -/* $Id: pool.c,v 1.32 2004/08/15 16:39:08 chorns Exp $ +/* $Id: pool.c,v 1.33 2004/08/21 20:05:35 tamlin Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -201,6 +201,7 @@ ExAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType, Process = PsGetCurrentProcess(); /* PsChargePoolQuota returns an exception, so this needs SEH */ +#if defined(__GNUC__) _SEH_FILTER(FreeAndGoOn) { /* Couldn't charge, so free the pool and let the caller SEH manage */ ExFreePool(Block); @@ -212,6 +213,14 @@ ExAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType, /* Quota Exceeded and the caller had no SEH! */ KeBugCheck(STATUS_QUOTA_EXCEEDED); } _SEH_END; +#else /* assuming all other Win32 compilers understand SEH */ + __try { + PsChargePoolQuota(Process, PoolType, NumberOfBytes); + } + __except (ExFreePool(Block), EXCEPTION_CONTINUE_SEARCH) { + KeBugCheck(STATUS_QUOTA_EXCEEDED); + } +#endif } return Block;