mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[win32k]
- Move some definitions to a better place svn path=/trunk/; revision=53474
This commit is contained in:
parent
c019323d0a
commit
a7b384319a
4 changed files with 94 additions and 95 deletions
|
@ -8,6 +8,8 @@ typedef struct _EDRIVEROBJ
|
|||
PVOID reserved;
|
||||
} EDRIVEROBJ, *PEDRIVEROBJ;
|
||||
|
||||
typedef DRIVEROBJ *PDRIVEROBJ;
|
||||
|
||||
/* Cleanup function */
|
||||
BOOL NTAPI DRIVEROBJ_Cleanup(PVOID pObject);
|
||||
|
||||
|
|
|
@ -145,3 +145,21 @@ NTSTATUS FASTCALL
|
|||
IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest,
|
||||
PUNICODE_STRING Source);
|
||||
|
||||
|
||||
#define ROUND_DOWN(n, align) \
|
||||
(((ULONG)n) & ~((align) - 1l))
|
||||
|
||||
#define ROUND_UP(n, align) \
|
||||
ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
|
||||
|
||||
#define LIST_FOR_EACH(elem, list, type, field) \
|
||||
for ((elem) = CONTAINING_RECORD((list)->Flink, type, field); \
|
||||
&(elem)->field != (list) && ((&((elem)->field)) != NULL); \
|
||||
(elem) = CONTAINING_RECORD((elem)->field.Flink, type, field))
|
||||
|
||||
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list, type, field) \
|
||||
for ((cursor) = CONTAINING_RECORD((list)->Flink, type, field), \
|
||||
(cursor2) = CONTAINING_RECORD((cursor)->field.Flink, type, field); \
|
||||
&(cursor)->field != (list) && ((&((cursor)->field)) != NULL); \
|
||||
(cursor) = (cursor2), \
|
||||
(cursor2) = CONTAINING_RECORD((cursor)->field.Flink, type, field))
|
||||
|
|
|
@ -20,4 +20,78 @@ VOID FASTCALL UserLeave(VOID);
|
|||
BOOL FASTCALL UserIsEntered(VOID);
|
||||
BOOL FASTCALL UserIsEnteredExclusive(VOID);
|
||||
|
||||
/* User heap */
|
||||
extern HANDLE GlobalUserHeap;
|
||||
|
||||
PWIN32HEAP
|
||||
UserCreateHeap(OUT PSECTION_OBJECT *SectionObject,
|
||||
IN OUT PVOID *SystemBase,
|
||||
IN SIZE_T HeapSize);
|
||||
|
||||
static __inline PVOID
|
||||
UserHeapAlloc(SIZE_T Bytes)
|
||||
{
|
||||
return RtlAllocateHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
Bytes);
|
||||
}
|
||||
|
||||
static __inline BOOL
|
||||
UserHeapFree(PVOID lpMem)
|
||||
{
|
||||
return RtlFreeHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
lpMem);
|
||||
}
|
||||
|
||||
static __inline PVOID
|
||||
UserHeapReAlloc(PVOID lpMem,
|
||||
SIZE_T Bytes)
|
||||
{
|
||||
#if 0
|
||||
/* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
|
||||
return RtlReAllocateHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
lpMem,
|
||||
Bytes);
|
||||
#else
|
||||
SIZE_T PrevSize;
|
||||
PVOID pNew;
|
||||
|
||||
PrevSize = RtlSizeHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
lpMem);
|
||||
|
||||
if (PrevSize == Bytes)
|
||||
return lpMem;
|
||||
|
||||
pNew = RtlAllocateHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
Bytes);
|
||||
if (pNew != NULL)
|
||||
{
|
||||
if (PrevSize < Bytes)
|
||||
Bytes = PrevSize;
|
||||
|
||||
RtlCopyMemory(pNew,
|
||||
lpMem,
|
||||
Bytes);
|
||||
|
||||
RtlFreeHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
lpMem);
|
||||
}
|
||||
|
||||
return pNew;
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline PVOID
|
||||
UserHeapAddressToUser(PVOID lpMem)
|
||||
{
|
||||
PPROCESSINFO W32Process = PsGetCurrentProcessWin32Process();
|
||||
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
|
||||
(ULONG_PTR)W32Process->HeapMappings.UserMapping);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -84,99 +84,4 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
|
|||
/* Internal Win32K Header */
|
||||
#include "include/win32kp.h"
|
||||
|
||||
/* Undocumented stuff */
|
||||
typedef DRIVEROBJ *PDRIVEROBJ;
|
||||
|
||||
/* User heap */
|
||||
extern HANDLE GlobalUserHeap;
|
||||
|
||||
PWIN32HEAP
|
||||
UserCreateHeap(OUT PSECTION_OBJECT *SectionObject,
|
||||
IN OUT PVOID *SystemBase,
|
||||
IN SIZE_T HeapSize);
|
||||
|
||||
static __inline PVOID
|
||||
UserHeapAlloc(SIZE_T Bytes)
|
||||
{
|
||||
return RtlAllocateHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
Bytes);
|
||||
}
|
||||
|
||||
static __inline BOOL
|
||||
UserHeapFree(PVOID lpMem)
|
||||
{
|
||||
return RtlFreeHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
lpMem);
|
||||
}
|
||||
|
||||
static __inline PVOID
|
||||
UserHeapReAlloc(PVOID lpMem,
|
||||
SIZE_T Bytes)
|
||||
{
|
||||
#if 0
|
||||
/* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
|
||||
return RtlReAllocateHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
lpMem,
|
||||
Bytes);
|
||||
#else
|
||||
SIZE_T PrevSize;
|
||||
PVOID pNew;
|
||||
|
||||
PrevSize = RtlSizeHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
lpMem);
|
||||
|
||||
if (PrevSize == Bytes)
|
||||
return lpMem;
|
||||
|
||||
pNew = RtlAllocateHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
Bytes);
|
||||
if (pNew != NULL)
|
||||
{
|
||||
if (PrevSize < Bytes)
|
||||
Bytes = PrevSize;
|
||||
|
||||
RtlCopyMemory(pNew,
|
||||
lpMem,
|
||||
Bytes);
|
||||
|
||||
RtlFreeHeap(GlobalUserHeap,
|
||||
HEAP_NO_SERIALIZE,
|
||||
lpMem);
|
||||
}
|
||||
|
||||
return pNew;
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline PVOID
|
||||
UserHeapAddressToUser(PVOID lpMem)
|
||||
{
|
||||
PPROCESSINFO W32Process = PsGetCurrentProcessWin32Process();
|
||||
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
|
||||
(ULONG_PTR)W32Process->HeapMappings.UserMapping);
|
||||
}
|
||||
|
||||
#define ROUND_DOWN(n, align) \
|
||||
(((ULONG)n) & ~((align) - 1l))
|
||||
|
||||
#define ROUND_UP(n, align) \
|
||||
ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
|
||||
|
||||
#define LIST_FOR_EACH(elem, list, type, field) \
|
||||
for ((elem) = CONTAINING_RECORD((list)->Flink, type, field); \
|
||||
&(elem)->field != (list) && ((&((elem)->field)) != NULL); \
|
||||
(elem) = CONTAINING_RECORD((elem)->field.Flink, type, field))
|
||||
|
||||
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list, type, field) \
|
||||
for ((cursor) = CONTAINING_RECORD((list)->Flink, type, field), \
|
||||
(cursor2) = CONTAINING_RECORD((cursor)->field.Flink, type, field); \
|
||||
&(cursor)->field != (list) && ((&((cursor)->field)) != NULL); \
|
||||
(cursor) = (cursor2), \
|
||||
(cursor2) = CONTAINING_RECORD((cursor)->field.Flink, type, field))
|
||||
|
||||
#endif /* __W32K_H */
|
||||
|
|
Loading…
Reference in a new issue