sync to trunk head (37853) (except rbuild changes)
[reactos.git] / reactos / ntoskrnl / mm / pool.c
index a6fb474..5eddf75 100644 (file)
@@ -27,7 +27,7 @@ EiGetPagedPoolTag(IN PVOID Block);
 ULONG NTAPI
 EiGetNonPagedPoolTag(IN PVOID Block);
 
-static PVOID STDCALL
+static PVOID NTAPI
 EiAllocatePool(POOL_TYPE PoolType,
                ULONG NumberOfBytes,
                ULONG Tag,
@@ -70,7 +70,7 @@ EiAllocatePool(POOL_TYPE PoolType,
 /*
  * @implemented
  */
-PVOID STDCALL
+PVOID NTAPI
 ExAllocatePool (POOL_TYPE PoolType, SIZE_T NumberOfBytes)
 /*
  * FUNCTION: Allocates pool memory of a specified type and returns a pointer
@@ -119,7 +119,7 @@ ExAllocatePool (POOL_TYPE PoolType, SIZE_T NumberOfBytes)
 /*
  * @implemented
  */
-PVOID STDCALL
+PVOID NTAPI
 ExAllocatePoolWithTag (POOL_TYPE PoolType, SIZE_T NumberOfBytes, ULONG Tag)
 {
    PVOID Block;
@@ -147,7 +147,7 @@ ExAllocatePoolWithTag (POOL_TYPE PoolType, SIZE_T NumberOfBytes, ULONG Tag)
 /*
  * @implemented
  */
-PVOID STDCALL
+PVOID NTAPI
 ExAllocatePoolWithQuota (POOL_TYPE PoolType, SIZE_T NumberOfBytes)
 {
    return(ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, TAG_NONE));
@@ -157,7 +157,7 @@ ExAllocatePoolWithQuota (POOL_TYPE PoolType, SIZE_T NumberOfBytes)
  * @implemented
  */
 PVOID
-STDCALL
+NTAPI
 ExAllocatePoolWithTagPriority(
     IN POOL_TYPE PoolType,
     IN SIZE_T NumberOfBytes,
@@ -181,20 +181,6 @@ ExAllocatePoolWithTagPriority(
     return ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);
 }
 
-_SEH_DEFINE_LOCALS(ExQuotaPoolVars)
-{
-    PVOID Block;
-};
-
-_SEH_FILTER(FreeAndGoOn)
-{
-    _SEH_ACCESS_LOCALS(ExQuotaPoolVars);
-
-    /* Couldn't charge, so free the pool and let the caller SEH manage */
-    ExFreePool(_SEH_VAR(Block));
-    return EXCEPTION_CONTINUE_SEARCH;
-}
-
 /*
  * @implemented
  */
@@ -205,13 +191,13 @@ ExAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType,
                             IN ULONG Tag)
 {
     PEPROCESS Process;
-    _SEH_DECLARE_LOCALS(ExQuotaPoolVars);
+    PVOID Block;
 
     /* Allocate the Pool First */
-    _SEH_VAR(Block) = EiAllocatePool(PoolType,
-                                     NumberOfBytes,
-                                     Tag,
-                                     &ExAllocatePoolWithQuotaTag);
+    Block = EiAllocatePool(PoolType,
+                           NumberOfBytes,
+                           Tag,
+                           &ExAllocatePoolWithQuotaTag);
 
     /* "Quota is not charged to the thread for allocations >= PAGE_SIZE" - OSR Docs */
     if (!(NumberOfBytes >= PAGE_SIZE))
@@ -220,23 +206,23 @@ ExAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType,
         Process = PsGetCurrentProcess();
 
         /* PsChargePoolQuota returns an exception, so this needs SEH */
-        _SEH_TRY
+        _SEH2_TRY
         {
             /* FIXME: Is there a way to get the actual Pool size allocated from the pool header? */
             PsChargePoolQuota(Process,
                               PoolType & PAGED_POOL_MASK,
                               NumberOfBytes);
         }
-        _SEH_EXCEPT(FreeAndGoOn)
+        _SEH2_EXCEPT((ExFreePool(Block), EXCEPTION_CONTINUE_SEARCH))
         {
             /* Quota Exceeded and the caller had no SEH! */
             KeBugCheck(STATUS_QUOTA_EXCEEDED);
         }
-        _SEH_END;
+        _SEH2_END;
     }
 
     /* Return the allocated block */
-    return _SEH_VAR(Block);
+    return Block;
 }
 
 /*
@@ -283,7 +269,7 @@ ExFreePoolWithTag(IN PVOID Block, IN ULONG Tag)
  * @unimplemented
  */
 SIZE_T
-STDCALL
+NTAPI
 ExQueryPoolBlockSize (
     IN PVOID PoolBlock,
     OUT PBOOLEAN QuotaCharged
@@ -297,7 +283,7 @@ ExQueryPoolBlockSize (
  * @unimplemented
  */
 PVOID
-STDCALL
+NTAPI
 MmAllocateMappingAddress (
      IN SIZE_T NumberOfBytes,
      IN ULONG PoolTag
@@ -312,7 +298,7 @@ MmAllocateMappingAddress (
  * @unimplemented
  */
 VOID
-STDCALL
+NTAPI
 MmFreeMappingAddress (
      IN PVOID BaseAddress,
      IN ULONG PoolTag
@@ -322,7 +308,7 @@ MmFreeMappingAddress (
 }
 
 BOOLEAN
-STDCALL
+NTAPI
 MiRaisePoolQuota(
     IN POOL_TYPE PoolType,
     IN ULONG CurrentMaxQuota,