2008-11-30 05:49:18 +00:00
|
|
|
#ifndef __W32K_H
|
|
|
|
#define __W32K_H
|
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Graphics Subsystem
|
|
|
|
* FILE: subsys/win32k/w32k.h
|
|
|
|
* PURPOSE: Main Win32K Header
|
|
|
|
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
|
|
|
#define _NO_COM
|
|
|
|
|
|
|
|
/* DDK/NDK/SDK Headers */
|
|
|
|
#include <ddk/ntddk.h>
|
|
|
|
#include <ddk/ntddmou.h>
|
|
|
|
#include <ddk/ntifs.h>
|
|
|
|
#include <ddk/tvout.h>
|
|
|
|
#include <ndk/ntndk.h>
|
|
|
|
|
|
|
|
/* Win32 Headers */
|
|
|
|
/* FIXME: Defines in winbase.h that we need... */
|
|
|
|
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
|
|
|
|
#define WINBASEAPI
|
|
|
|
#define STARTF_USESIZE 2
|
|
|
|
#define STARTF_USEPOSITION 4
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <windef.h>
|
2009-03-19 01:42:34 +00:00
|
|
|
|
|
|
|
/* Avoid type casting, by defining RECT to RECTL */
|
|
|
|
#define RECT RECTL
|
|
|
|
#define PRECT PRECTL
|
|
|
|
#define LPRECT LPRECTL
|
|
|
|
#define LPCRECT LPCRECTL
|
|
|
|
|
2008-11-30 05:49:18 +00:00
|
|
|
#include <winerror.h>
|
|
|
|
#include <wingdi.h>
|
2009-08-02 20:35:19 +00:00
|
|
|
#define NT_BUILD_ENVIRONMENT
|
2008-11-30 05:49:18 +00:00
|
|
|
#include <winddi.h>
|
|
|
|
#include <winuser.h>
|
|
|
|
#include <prntfont.h>
|
|
|
|
#include <dde.h>
|
|
|
|
#include <wincon.h>
|
|
|
|
#define _NOCSECT_TYPE
|
|
|
|
#include <ddrawi.h>
|
|
|
|
|
|
|
|
/* SEH Support with PSEH */
|
2008-11-30 19:28:11 +00:00
|
|
|
#include <pseh/pseh2.h>
|
2008-11-30 05:49:18 +00:00
|
|
|
|
|
|
|
/* CSRSS Header */
|
|
|
|
#include <csrss/csrss.h>
|
|
|
|
|
|
|
|
/* Public Win32K Headers */
|
|
|
|
#include <win32k/callback.h>
|
|
|
|
#include <win32k/ntusrtyp.h>
|
|
|
|
#include <win32k/ntuser.h>
|
|
|
|
#include <win32k/ntgdityp.h>
|
|
|
|
#include <win32k/ntgdibad.h>
|
|
|
|
#include <ntgdi.h>
|
|
|
|
|
|
|
|
/* Internal Win32K Header */
|
|
|
|
#include "include/win32k.h"
|
|
|
|
|
|
|
|
/* Undocumented stuff */
|
|
|
|
typedef DRIVEROBJ *PDRIVEROBJ;
|
|
|
|
#define WM_SYSTIMER 280
|
|
|
|
#ifndef M_PI
|
|
|
|
#define M_PI 3.14159265358979323846f
|
|
|
|
#define M_PI_2 1.57079632679489661923
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* 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)
|
|
|
|
{
|
2009-07-26 16:17:50 +00:00
|
|
|
PPROCESSINFO W32Process = PsGetCurrentProcessWin32Process();
|
2008-11-30 05:49:18 +00:00
|
|
|
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
|
|
|
|
(ULONG_PTR)W32Process->HeapMappings.UserMapping);
|
|
|
|
}
|
|
|
|
|
2009-01-25 16:13:16 +00:00
|
|
|
#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); \
|
2009-08-15 00:40:09 +00:00
|
|
|
&(elem)->field != (list) && ((&((elem)->field)) != NULL); \
|
2009-01-25 16:13:16 +00:00
|
|
|
(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); \
|
2009-08-15 00:40:09 +00:00
|
|
|
&(cursor)->field != (list) && ((&((cursor)->field)) != NULL); \
|
2009-01-25 16:13:16 +00:00
|
|
|
(cursor) = (cursor2), \
|
|
|
|
(cursor2) = CONTAINING_RECORD((cursor)->field.Flink, type, field))
|
|
|
|
|
2008-11-30 05:49:18 +00:00
|
|
|
#endif /* __W32K_H */
|