reactos/reactos/subsystems/win32/win32k/w32k.h

146 lines
3.3 KiB
C
Raw Normal View History

#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>
#include <winerror.h>
#include <wingdi.h>
#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 */
#include <pseh/pseh.h>
/* CSRSS Header */
#include <csrss/csrss.h>
/* Helper Header */
#include <reactos/helper.h>
/* Probe and capture */
#include <reactos/probe.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)
{
PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
(ULONG_PTR)W32Process->HeapMappings.UserMapping);
}
#endif /* __W32K_H */