From feee728349395043b9f4a7a649f14174ad6add8f Mon Sep 17 00:00:00 2001 From: "KJK::Hyperion" Date: Sun, 30 Nov 2008 05:49:18 +0000 Subject: [PATCH] modified base/shell/explorer/explorer.rbuild The TDM build of gcc 4.3.2 is affected by PR 27067 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27067), apparently due to a missing MinGW-only patch - work around it in the linker modified dll/directx/ddraw/d3d/DirectD3D_main.c modified dll/directx/ddraw/Ddraw/ddraw_displaymode.c modified dll/directx/ddraw/Ddraw/ddraw_main.c modified dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c modified dll/directx/ddraw/Ddraw/GetCaps.c modified dll/directx/ddraw/Ddraw/GetDeviceIdentifier.c modified dll/directx/ddraw/main.c modified dll/directx/ddraw/Surface/createsurface.c already included in rosdraw.h modified dll/win32/advapi32/misc/trace.c Silence a warning reported by gcc 4.3.2 (possibly incorrectly, but it's just a stub anyway) modified ntoskrnl/include/internal/ntoskrnl.h added ntoskrnl/include/internal/probe.h replaced ntoskrnl/include/ntoskrnl.h added ntoskrnl/include/precomp.h modified ntoskrnl/ntoskrnl-generic.rbuild added subsystems/win32/win32k/pch.h replaced subsystems/win32/win32k/w32k.h modified subsystems/win32/win32k/win32k.rbuild gcc 4.3.2-tdm-1 doesn't like PSEH in precompiled headers. Shuffle things around a bit to remove PSEH from precompiled headers svn path=/trunk/; revision=37757 --- reactos/base/shell/explorer/explorer.rbuild | 1 + reactos/dll/directx/ddraw/Ddraw/GetCaps.c | 4 - .../directx/ddraw/Ddraw/GetDeviceIdentifier.c | 2 - .../directx/ddraw/Ddraw/ddraw_displaymode.c | 3 - reactos/dll/directx/ddraw/Ddraw/ddraw_main.c | 5 - .../ddraw/Ddraw/ddraw_setcooperativelevel.c | 3 - .../dll/directx/ddraw/Surface/createsurface.c | 26 ++-- .../dll/directx/ddraw/d3d/DirectD3D_main.c | 19 +-- reactos/dll/directx/ddraw/main.c | 13 +- reactos/dll/win32/advapi32/misc/trace.c | 2 +- reactos/ntoskrnl/include/internal/ntoskrnl.h | 112 +------------- reactos/ntoskrnl/include/ntoskrnl.h | 101 +----------- reactos/ntoskrnl/include/precomp.h | 100 ++++++++++++ reactos/ntoskrnl/ntoskrnl-generic.rbuild | 2 +- reactos/subsystems/win32/win32k/pch.h | 142 +++++++++++++++++ reactos/subsystems/win32/win32k/w32k.h | 144 +----------------- reactos/subsystems/win32/win32k/win32k.rbuild | 2 +- 17 files changed, 275 insertions(+), 406 deletions(-) create mode 100644 reactos/ntoskrnl/include/precomp.h create mode 100644 reactos/subsystems/win32/win32k/pch.h diff --git a/reactos/base/shell/explorer/explorer.rbuild b/reactos/base/shell/explorer/explorer.rbuild index bdbcf3ad67d..f2f452d6a0f 100644 --- a/reactos/base/shell/explorer/explorer.rbuild +++ b/reactos/base/shell/explorer/explorer.rbuild @@ -63,6 +63,7 @@ explorer.cpp i386-stub-win32.c explorer.rc + --enable-stdcall-fixup explorer-cfg-template.xml diff --git a/reactos/dll/directx/ddraw/Ddraw/GetCaps.c b/reactos/dll/directx/ddraw/Ddraw/GetCaps.c index 21e52b15d38..e9f5cd3b854 100644 --- a/reactos/dll/directx/ddraw/Ddraw/GetCaps.c +++ b/reactos/dll/directx/ddraw/Ddraw/GetCaps.c @@ -20,10 +20,6 @@ #include -/* PSEH for SEH Support */ -#include - - HRESULT WINAPI Main_DirectDraw_GetCaps( LPDDRAWI_DIRECTDRAW_INT This, LPDDCAPS pDriverCaps, LPDDCAPS pHELCaps) diff --git a/reactos/dll/directx/ddraw/Ddraw/GetDeviceIdentifier.c b/reactos/dll/directx/ddraw/Ddraw/GetDeviceIdentifier.c index 5d97a957101..8762a1ff342 100644 --- a/reactos/dll/directx/ddraw/Ddraw/GetDeviceIdentifier.c +++ b/reactos/dll/directx/ddraw/Ddraw/GetDeviceIdentifier.c @@ -21,8 +21,6 @@ #include -/* PSEH for SEH Support */ -#include /* For DirectDraw 4 - 6 */ HRESULT WINAPI Main_DirectDraw_GetDeviceIdentifier(LPDDRAWI_DIRECTDRAW_INT This, diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c index 4fbcf1d4b97..8f3b0130913 100644 --- a/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c @@ -11,9 +11,6 @@ #include "rosdraw.h" -/* PSEH for SEH Support */ -#include - HRESULT WINAPI Main_DirectDraw_EnumDisplayModes(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, LPDDSURFACEDESC pDDSD, LPVOID pContext, LPDDENUMMODESCALLBACK pCallback) diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c index dd9af7c781b..c759e6a38e2 100644 --- a/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c @@ -20,11 +20,6 @@ #include -/* PSEH for SEH Support */ -#include - - - LPDDRAWI_DIRECTDRAW_INT internal_directdraw_int_alloc(LPDDRAWI_DIRECTDRAW_INT This) { diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c index 5872527e978..6e9a241b297 100644 --- a/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c @@ -10,9 +10,6 @@ #include "rosdraw.h" -/* PSEH for SEH Support */ -#include - HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDDRAWI_DIRECTDRAW_INT This, HWND hwnd, DWORD cooplevel) { diff --git a/reactos/dll/directx/ddraw/Surface/createsurface.c b/reactos/dll/directx/ddraw/Surface/createsurface.c index 3a8caef9fc8..bb7ba668112 100644 --- a/reactos/dll/directx/ddraw/Surface/createsurface.c +++ b/reactos/dll/directx/ddraw/Surface/createsurface.c @@ -9,10 +9,6 @@ */ #include "rosdraw.h" -/* PSEH for SEH Support */ -#include - - /* * All parameters must have been checked if they are valid before they are passed to Internal_CreateSurface. * If not please fix the code in the functions which call Internal_CreateSurface. @@ -77,8 +73,8 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD, } /* - * program does not need set the DDSD_LPSURFACE, - * if they forget set it, the ddraw will autoamtic + * program does not need set the DDSD_LPSURFACE, + * if they forget set it, the ddraw will autoamtic * set it for system memory. */ if ( ((pDDSD->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY) == DDSCAPS_SYSTEMMEMORY) && @@ -285,28 +281,28 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD, DxHeapMemFree(slist_gbl); *ppSurf = (LPDDRAWI_DDRAWSURFACE_INT) &slist_int[0]->lpVtbl; - + return DD_OK; cleanup: for(count = 0; count < num_of_surf; count++) { - if (slist_more[count] != NULL) + if (slist_more[count] != NULL) DxHeapMemFree(slist_more[count]); - if (slist_gbl[count] != NULL) + if (slist_gbl[count] != NULL) DxHeapMemFree(slist_gbl[count]); - if (slist_lcl[count] != NULL) + if (slist_lcl[count] != NULL) DxHeapMemFree(slist_lcl[count]); - if (slist_int[count] != NULL) + if (slist_int[count] != NULL) DxHeapMemFree(slist_int[count]); } - if (slist_more != NULL) + if (slist_more != NULL) DxHeapMemFree(slist_more); - if (slist_gbl != NULL) + if (slist_gbl != NULL) DxHeapMemFree(slist_gbl); - if (slist_lcl != NULL) + if (slist_lcl != NULL) DxHeapMemFree(slist_lcl); - if (slist_int != NULL) + if (slist_int != NULL) DxHeapMemFree(slist_int); return ret; diff --git a/reactos/dll/directx/ddraw/d3d/DirectD3D_main.c b/reactos/dll/directx/ddraw/d3d/DirectD3D_main.c index b8384c5d484..f90f33c4a86 100644 --- a/reactos/dll/directx/ddraw/d3d/DirectD3D_main.c +++ b/reactos/dll/directx/ddraw/d3d/DirectD3D_main.c @@ -2,24 +2,21 @@ #include -/* PSEH for SEH Support */ -#include - -HRESULT WINAPI +HRESULT WINAPI Main_D3D_QueryInterface(LPDIRECT3D iface, REFIID riid, LPVOID * ppvObj) { DX_WINDBG_trace(); DX_STUB; } -ULONG WINAPI +ULONG WINAPI Main_D3D_AddRef(LPDIRECT3D iface) { DX_WINDBG_trace(); DX_STUB; } -ULONG WINAPI +ULONG WINAPI Main_D3D_Release(LPDIRECT3D iface) { DX_WINDBG_trace(); @@ -33,35 +30,35 @@ Main_D3D_Initialize(LPDIRECT3D iface, REFIID refiid) DX_STUB; } -HRESULT WINAPI +HRESULT WINAPI Main_D3D_EnumDevices(LPDIRECT3D iface, LPD3DENUMDEVICESCALLBACK Callback, LPVOID Context) { DX_WINDBG_trace(); DX_STUB; } -HRESULT WINAPI +HRESULT WINAPI Main_D3D_CreateLight(LPDIRECT3D iface, LPDIRECT3DLIGHT* Light,IUnknown* pUnkOuter) { DX_WINDBG_trace(); DX_STUB; } -HRESULT WINAPI +HRESULT WINAPI Main_D3D_CreateMaterial(LPDIRECT3D iface,LPDIRECT3DMATERIAL* Direct3DLight,IUnknown* pUnkOuter) { DX_WINDBG_trace(); DX_STUB; } -HRESULT WINAPI +HRESULT WINAPI Main_D3D_CreateViewport(LPDIRECT3D iface, LPDIRECT3DVIEWPORT* Viewport,IUnknown* pUnkOuter) { DX_WINDBG_trace(); DX_STUB; } -HRESULT WINAPI +HRESULT WINAPI Main_D3D_FindDevice(LPDIRECT3D iface, LPD3DFINDDEVICESEARCH D3DDFS, LPD3DFINDDEVICERESULT D3DFDR) { DX_WINDBG_trace(); diff --git a/reactos/dll/directx/ddraw/main.c b/reactos/dll/directx/ddraw/main.c index fd261101bab..293807a1731 100644 --- a/reactos/dll/directx/ddraw/main.c +++ b/reactos/dll/directx/ddraw/main.c @@ -13,9 +13,6 @@ #include "rosdraw.h" HMODULE hDllModule = 0; -/* PSEH for SEH Support */ -#include - CRITICAL_SECTION ddcs; // This function is exported by the dll @@ -26,8 +23,8 @@ typedef struct LPVOID lpContext; } DirectDrawEnumerateProcData; -BOOL -CALLBACK +BOOL +CALLBACK TranslateCallbackA(GUID *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, @@ -180,8 +177,8 @@ DirectDrawCreateEx(LPGUID lpGUID, return retVal; } -HRESULT -WINAPI +HRESULT +WINAPI DirectDrawEnumerateA( LPDDENUMCALLBACKA lpCallback, LPVOID lpContext) { @@ -297,7 +294,7 @@ DirectDrawEnumerateExW(LPDDENUMCALLBACKEXW lpCallback, for more info about this command see msdn documentation - The buffer start with D3DHAL_DP2COMMAND struct afer that follows either one struct or + The buffer start with D3DHAL_DP2COMMAND struct afer that follows either one struct or no struct at at all example for command D3DDP2OP_VIEWPORTINFO diff --git a/reactos/dll/win32/advapi32/misc/trace.c b/reactos/dll/win32/advapi32/misc/trace.c index aa06ffa2484..b8ce76114c8 100644 --- a/reactos/dll/win32/advapi32/misc/trace.c +++ b/reactos/dll/win32/advapi32/misc/trace.c @@ -27,7 +27,7 @@ GetTraceLoggerHandle( ) { DPRINT1("GetTraceLoggerHandle stub()\n"); - return (TRACEHANDLE)INVALID_HANDLE_VALUE; + return HandleToUlong(INVALID_HANDLE_VALUE); /* BUGBUG: should we use HandleToLong instead? */ } diff --git a/reactos/ntoskrnl/include/internal/ntoskrnl.h b/reactos/ntoskrnl/include/internal/ntoskrnl.h index e2dd98fabaa..09f69a7c25a 100644 --- a/reactos/ntoskrnl/include/internal/ntoskrnl.h +++ b/reactos/ntoskrnl/include/internal/ntoskrnl.h @@ -106,117 +106,6 @@ typedef struct _INFORMATION_CLASS_INFO #define IQS(TypeQuery, TypeSet, AlignmentQuery, AlignmentSet, Flags) \ { sizeof(TypeQuery), sizeof(TypeSet), sizeof(AlignmentQuery), sizeof(AlignmentSet), Flags } -static -__inline -NTSTATUS -DefaultSetInfoBufferCheck(ULONG Class, - const INFORMATION_CLASS_INFO *ClassList, - ULONG ClassListEntries, - PVOID Buffer, - ULONG BufferLength, - KPROCESSOR_MODE PreviousMode) -{ - NTSTATUS Status = STATUS_SUCCESS; - - if (Class < ClassListEntries) - { - if (!(ClassList[Class].Flags & ICIF_SET)) - { - Status = STATUS_INVALID_INFO_CLASS; - } - else if (ClassList[Class].RequiredSizeSET > 0 && - BufferLength != ClassList[Class].RequiredSizeSET) - { - if (!(ClassList[Class].Flags & ICIF_SET_SIZE_VARIABLE)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - } - - if (NT_SUCCESS(Status)) - { - if (PreviousMode != KernelMode) - { - _SEH2_TRY - { - ProbeForRead(Buffer, - BufferLength, - ClassList[Class].AlignmentSET); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - } - } - } - else - Status = STATUS_INVALID_INFO_CLASS; - - return Status; -} - -static -__inline -NTSTATUS -DefaultQueryInfoBufferCheck(ULONG Class, - const INFORMATION_CLASS_INFO *ClassList, - ULONG ClassListEntries, - PVOID Buffer, - ULONG BufferLength, - PULONG ReturnLength, - KPROCESSOR_MODE PreviousMode) -{ - NTSTATUS Status = STATUS_SUCCESS; - - if (Class < ClassListEntries) - { - if (!(ClassList[Class].Flags & ICIF_QUERY)) - { - Status = STATUS_INVALID_INFO_CLASS; - } - else if (ClassList[Class].RequiredSizeQUERY > 0 && - BufferLength != ClassList[Class].RequiredSizeQUERY) - { - if (!(ClassList[Class].Flags & ICIF_QUERY_SIZE_VARIABLE)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - } - - if (NT_SUCCESS(Status)) - { - if (PreviousMode != KernelMode) - { - _SEH2_TRY - { - if (Buffer != NULL) - { - ProbeForWrite(Buffer, - BufferLength, - ClassList[Class].AlignmentQUERY); - } - - if (ReturnLength != NULL) - { - ProbeForWriteUlong(ReturnLength); - } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - } - } - } - else - Status = STATUS_INVALID_INFO_CLASS; - - return Status; -} - /* * Use IsPointerOffset to test whether a pointer should be interpreted as an offset * or as a pointer @@ -250,6 +139,7 @@ C_ASSERT(FIELD_OFFSET(KTHREAD, CallbackStack) == KTHREAD_CALLBACK_STACK); C_ASSERT(FIELD_OFFSET(KTHREAD, ApcState.Process) == KTHREAD_APCSTATE_PROCESS); C_ASSERT(FIELD_OFFSET(KPROCESS, DirectoryTableBase) == KPROCESS_DIRECTORY_TABLE_BASE); C_ASSERT(FIELD_OFFSET(KPCR, Tib.ExceptionList) == KPCR_EXCEPTION_LIST); + C_ASSERT(FIELD_OFFSET(KPCR, Self) == KPCR_SELF); #ifdef _M_IX86 C_ASSERT(FIELD_OFFSET(KPCR, IRR) == KPCR_IRR); diff --git a/reactos/ntoskrnl/include/ntoskrnl.h b/reactos/ntoskrnl/include/ntoskrnl.h index f2fc98dd147..f766ea6fe1b 100644 --- a/reactos/ntoskrnl/include/ntoskrnl.h +++ b/reactos/ntoskrnl/include/ntoskrnl.h @@ -1,101 +1,4 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Kernel - * FILE: ntoskrnl/include/ntoskrnl.h - * PURPOSE: Main Kernel Header - * PROGRAMMER: Alex Ionescu (alex@relsoft.net) - */ +#include "precomp.h" -/* INCLUDES ******************************************************************/ - -/* Version Data */ -#undef __MSVCRT__ -#include - -/* DDK/IFS/NDK Headers */ -#ifdef _MSC_VER -#include -#include -#undef DECLSPEC_IMPORT -#define DECLSPEC_IMPORT -#endif -#include -#include -#include -#include -#undef TEXT -#define TEXT(s) L##s -#include - -/* FIXME: Temporary until CC Ros is gone */ -#include -#include - -/* Disk Dump Driver Header */ -#include - -/* C Headers */ -#include -#include -#include -#include -#include - -/* SEH support with PSEH */ -#include -#include - -/* ReactOS Headers */ -#include -#include -#define ExRaiseStatus RtlRaiseStatus +/* Headers that shouldn't be precompiled due to GCC bugs */ #include - -/* SetupLDR Support */ -#include - -/* KD Support */ -#define NOEXTAPI -#include -#include -#include -#ifndef _WINKD_ -#include -#endif - -/* PNP GUIDs */ -#include - -/* Helper Header */ -#include - -/* Internal Headers */ -#include "internal/ntoskrnl.h" -#include "config.h" - -// -// Define the internal versions of external and public global data -// -#define IoFileObjectType _IoFileObjectType -#define PsThreadType _PsThreadType -#define PsProcessType _PsProcessType -#define ExEventObjectType _ExEventObjectType -#define ExSemaphoreObjectType _ExSemaphoreObjectType -#define KdDebuggerEnabled _KdDebuggerEnabled -#define KdDebuggerNotPresent _KdDebuggerNotPresent -#define NlsOemLeadByteInfo _NlsOemLeadByteInfo -extern PUSHORT _NlsOemLeadByteInfo; -#define FsRtlLegalAnsiCharacterArray _FsRtlLegalAnsiCharacterArray -#undef LEGAL_ANSI_CHARACTER_ARRAY -#undef NLS_MB_CODE_PAGE_TAG -#undef NLS_OEM_LEAD_BYTE_INFO -#define LEGAL_ANSI_CHARACTER_ARRAY FsRtlLegalAnsiCharacterArray -#define NLS_MB_CODE_PAGE_TAG NlsMbOemCodePageTag -#define NLS_OEM_LEAD_BYTE_INFO _NlsOemLeadByteInfo -#undef KD_DEBUGGER_ENABLED -#undef KD_DEBUGGER_NOT_PRESENT -#define KD_DEBUGGER_ENABLED KdDebuggerEnabled -#define KD_DEBUGGER_NOT_PRESENT KdDebuggerNotPresent -#define HalDispatchTable _HalDispatchTable -#undef HALDISPATCH -#define HALDISPATCH (&HalDispatchTable) diff --git a/reactos/ntoskrnl/include/precomp.h b/reactos/ntoskrnl/include/precomp.h new file mode 100644 index 00000000000..6225c7facc7 --- /dev/null +++ b/reactos/ntoskrnl/include/precomp.h @@ -0,0 +1,100 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/include/ntoskrnl.h + * PURPOSE: Main Kernel Header + * PROGRAMMER: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES ******************************************************************/ + +/* Version Data */ +#undef __MSVCRT__ +#include + +/* DDK/IFS/NDK Headers */ +#ifdef _MSC_VER +#include +#include +#undef DECLSPEC_IMPORT +#define DECLSPEC_IMPORT +#endif +#include +#include +#include +#include +#undef TEXT +#define TEXT(s) L##s +#include + +/* FIXME: Temporary until CC Ros is gone */ +#include +#include + +/* Disk Dump Driver Header */ +#include + +/* C Headers */ +#include +#include +#include +#include +#include + +/* SEH support with PSEH */ +#include +#include + +/* ReactOS Headers */ +#include +#include + +/* SetupLDR Support */ +#include + +/* KD Support */ +#define NOEXTAPI +#include +#include +#include +#ifndef _WINKD_ +#include +#endif + +/* PNP GUIDs */ +#include + +/* Helper Header */ +#include + +/* Internal Headers */ +#include "internal/ntoskrnl.h" +#include "config.h" + +// +// Define the internal versions of external and public global data +// +#define IoFileObjectType _IoFileObjectType +#define PsThreadType _PsThreadType +#define PsProcessType _PsProcessType +#define ExEventObjectType _ExEventObjectType +#define ExSemaphoreObjectType _ExSemaphoreObjectType +#define KdDebuggerEnabled _KdDebuggerEnabled +#define KdDebuggerNotPresent _KdDebuggerNotPresent +#define NlsOemLeadByteInfo _NlsOemLeadByteInfo +extern PUSHORT _NlsOemLeadByteInfo; +#define FsRtlLegalAnsiCharacterArray _FsRtlLegalAnsiCharacterArray +#undef LEGAL_ANSI_CHARACTER_ARRAY +#undef NLS_MB_CODE_PAGE_TAG +#undef NLS_OEM_LEAD_BYTE_INFO +#define LEGAL_ANSI_CHARACTER_ARRAY FsRtlLegalAnsiCharacterArray +#define NLS_MB_CODE_PAGE_TAG NlsMbOemCodePageTag +#define NLS_OEM_LEAD_BYTE_INFO _NlsOemLeadByteInfo +#undef KD_DEBUGGER_ENABLED +#undef KD_DEBUGGER_NOT_PRESENT +#define KD_DEBUGGER_ENABLED KdDebuggerEnabled +#define KD_DEBUGGER_NOT_PRESENT KdDebuggerNotPresent +#define HalDispatchTable _HalDispatchTable +#undef HALDISPATCH +#define HALDISPATCH (&HalDispatchTable) +#define ExRaiseStatus RtlRaiseStatus diff --git a/reactos/ntoskrnl/ntoskrnl-generic.rbuild b/reactos/ntoskrnl/ntoskrnl-generic.rbuild index 5a11768458f..2f29554d611 100644 --- a/reactos/ntoskrnl/ntoskrnl-generic.rbuild +++ b/reactos/ntoskrnl/ntoskrnl-generic.rbuild @@ -35,7 +35,7 @@ bugcodes diff --git a/reactos/subsystems/win32/win32k/pch.h b/reactos/subsystems/win32/win32k/pch.h new file mode 100644 index 00000000000..66a5c3b58c7 --- /dev/null +++ b/reactos/subsystems/win32/win32k/pch.h @@ -0,0 +1,142 @@ +#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 +#include +#include +#include +#include + +/* 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 +#include +#include +#include +#include +#include +#include +#include +#include +#define _NOCSECT_TYPE +#include + +/* SEH Support with PSEH */ +#include + +/* CSRSS Header */ +#include + +/* Helper Header */ +#include + +/* Public Win32K Headers */ +#include +#include +#include +#include +#include +#include + +/* 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 */ diff --git a/reactos/subsystems/win32/win32k/w32k.h b/reactos/subsystems/win32/win32k/w32k.h index a9cb5613f15..72f41f09f1c 100644 --- a/reactos/subsystems/win32/win32k/w32k.h +++ b/reactos/subsystems/win32/win32k/w32k.h @@ -1,145 +1,5 @@ -#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 -#include -#include -#include -#include - -/* 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 -#include -#include -#include -#include -#include -#include -#include -#include -#define _NOCSECT_TYPE -#include - -/* SEH Support with PSEH */ -#include - -/* CSRSS Header */ -#include - -/* Helper Header */ -#include +#include "pch.h" +/* Headers that shouldn't be precompiled due to GCC bugs */ /* Probe and capture */ #include - -/* Public Win32K Headers */ -#include -#include -#include -#include -#include -#include - -/* 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 */ diff --git a/reactos/subsystems/win32/win32k/win32k.rbuild b/reactos/subsystems/win32/win32k/win32k.rbuild index 0173e4701fa..db036e133d7 100644 --- a/reactos/subsystems/win32/win32k/win32k.rbuild +++ b/reactos/subsystems/win32/win32k/win32k.rbuild @@ -11,7 +11,7 @@ include/reactos/drivers - w32k.h + pch.h dib8gen.c