[PSDK/NDK]

- Don't include NDK from winnt.h, instead duplicate NtCurrentTeb inline definition between psfuncs.h and winnt.h as it used to be
- remove duplicated _GENERAL_LOOKASIDE_POOL
- Add missing NTKERNELAPI to ObDereferenceObjectDeferDelete

svn path=/trunk/; revision=56318
This commit is contained in:
Timo Kreuzer 2012-04-02 08:28:17 +00:00
parent 9f28638f51
commit 925c587c81
4 changed files with 30 additions and 58 deletions

View File

@ -436,51 +436,7 @@ typedef struct _KPROCESSOR_STATE
CONTEXT ContextFrame;
} KPROCESSOR_STATE, *PKPROCESSOR_STATE;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
typedef struct _GENERAL_LOOKASIDE_POOL
{
union
{
SLIST_HEADER ListHead;
SINGLE_LIST_ENTRY SingleListHead;
};
USHORT Depth;
USHORT MaximumDepth;
ULONG TotalAllocates;
union
{
ULONG AllocateMisses;
ULONG AllocateHits;
};
union
{
ULONG TotalFrees;
ULONG FreeMisses;
};
ULONG FreeHits;
POOL_TYPE Type;
ULONG Tag;
ULONG Size;
union
{
PVOID AllocateEx;
PVOID Allocate;
};
union
{
PVOID FreeEx;
PVOID Free;
};
LIST_ENTRY ListEntry;
ULONG LastTotalAllocates;
union
{
ULONG LastAllocateMisses;
ULONG LastAllocateHits;
};
ULONG Future[2];
} GENERAL_LOOKASIDE_POOL, *PGENERAL_LOOKASIDE_POOL;
#else
#if (NTDDI_VERSION < NTDDI_LONGHORN)
#define GENERAL_LOOKASIDE_POOL PP_LOOKASIDE_LIST
#endif

View File

@ -153,6 +153,7 @@ ObFindHandleForObject(
OUT PHANDLE Handle
);
NTKERNELAPI
VOID
NTAPI
ObDereferenceObjectDeferDelete(

View File

@ -371,7 +371,18 @@ NtCreateThread(
IN BOOLEAN CreateSuspended
);
#include "inline_ntcurrentteb.h"
#ifndef NTOS_MODE_USER
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
{
#if defined(_M_IX86)
return (PTEB)__readfsdword(0x18);
#elif defined (_M_AMD64)
return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
#endif
}
#else
struct _TEB * NtCurrentTeb(void);
#endif
NTSYSCALLAPI
NTSTATUS

View File

@ -5152,12 +5152,19 @@ typedef struct _OBJECT_TYPE_LIST {
} OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
#if defined(_M_IX86)
FORCEINLINE struct _TEB * NtCurrentTeb(void)
{
return (struct _TEB *)__readfsdword(0x18);
}
FORCEINLINE PVOID GetCurrentFiber(VOID)
{
return (PVOID)(ULONG_PTR)__readfsdword(0x10);
}
#elif defined (_M_AMD64)
FORCEINLINE struct _TEB * NtCurrentTeb(void)
{
return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
}
FORCEINLINE PVOID GetCurrentFiber(VOID)
{
#ifdef NONAMELESSUNION
@ -5166,12 +5173,10 @@ FORCEINLINE PVOID GetCurrentFiber(VOID)
return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, FiberData));
#endif
}
#elif defined (_M_ARM)
PVOID WINAPI GetCurrentFiber(VOID);
#elif defined(_M_PPC)
static __inline__ __attribute__((always_inline)) unsigned long __readfsdword_winnt(const unsigned long Offset)
FORCEINLINE unsigned long _read_teb_dword(const unsigned long Offset)
{
unsigned long result;
__asm__("\tadd 7,13,%1\n"
@ -5181,19 +5186,18 @@ static __inline__ __attribute__((always_inline)) unsigned long __readfsdword_win
: "r7");
return result;
}
static __inline__ PVOID GetCurrentFiber(void)
FORCEINLINE struct _TEB * NtCurrentTeb(void)
{
return __readfsdword_winnt(0x10);
return (struct _TEB *)_read_teb_dword(0x18);
}
FORCEINLINE PVOID GetCurrentFiber(void)
{
return _read_teb_dword(0x10);
}
#else
#error Unknown architecture
#endif
#include "inline_ntcurrentteb.h"
static __inline PVOID GetFiberData(void)
{
return *((PVOID *)GetCurrentFiber());