From ee87f2a4f6734b1e980f42f9d2d2147dfe779d11 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Tue, 16 Jul 2013 19:57:12 +0000 Subject: [PATCH] [DDK] - Fix ExAllocateFromZone. I understand it's deprecated, but it having a broken implementation which can't work at all because the one who coded this function failed to understand basic algorithms of linked lists is nonsense. svn path=/trunk/; revision=59494 --- reactos/include/ddk/ntddk.h | 3 ++- reactos/include/xdk/exfuncs.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/include/ddk/ntddk.h b/reactos/include/ddk/ntddk.h index 870566d73ca..961b0ca8066 100644 --- a/reactos/include/ddk/ntddk.h +++ b/reactos/include/ddk/ntddk.h @@ -3350,9 +3350,10 @@ static __inline PVOID ExAllocateFromZone( IN PZONE_HEADER Zone) { + PVOID Result = (PVOID)Zone->FreeList.Next; if (Zone->FreeList.Next) Zone->FreeList.Next = Zone->FreeList.Next->Next; - return (PVOID) Zone->FreeList.Next; + return Result; } static __inline PVOID diff --git a/reactos/include/xdk/exfuncs.h b/reactos/include/xdk/exfuncs.h index df3338f8175..a60908fbe76 100644 --- a/reactos/include/xdk/exfuncs.h +++ b/reactos/include/xdk/exfuncs.h @@ -276,9 +276,10 @@ static __inline PVOID ExAllocateFromZone( IN PZONE_HEADER Zone) { + PVOID Result = (PVOID)Zone->FreeList.Next; if (Zone->FreeList.Next) Zone->FreeList.Next = Zone->FreeList.Next->Next; - return (PVOID) Zone->FreeList.Next; + return Result; } static __inline PVOID