From ccd9ed0a4ecaf96edd599c56cd88d2f265b6dccf Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Fri, 20 Oct 2006 13:19:13 +0000 Subject: [PATCH] - Some minor Nt stub fixes - Fix compilation with GCC4 svn path=/trunk/; revision=24578 --- reactos/include/ndk/rtltypes.h | 2 + reactos/ntoskrnl/dbgk/debug.c | 53 +++++++++++++------ reactos/ntoskrnl/ob/obhandle.c | 6 +-- reactos/ntoskrnl/ob/oblife.c | 2 +- .../subsystems/win32/win32k/objects/dibobj.c | 2 +- 5 files changed, 44 insertions(+), 21 deletions(-) diff --git a/reactos/include/ndk/rtltypes.h b/reactos/include/ndk/rtltypes.h index cc9838267c7..4f1e5338da1 100644 --- a/reactos/include/ndk/rtltypes.h +++ b/reactos/include/ndk/rtltypes.h @@ -471,6 +471,7 @@ typedef struct _COMPRESSED_DATA_INFO COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INF // // Routines and callbacks for the RTL AVL/Generic Table package // +#if defined(NTOS_MODE_USER) || (!defined(NTOS_MODE_USER) && !defined(_NTIFS_)) typedef NTSTATUS (NTAPI *PRTL_AVL_MATCH_FUNCTION)( struct _RTL_AVL_TABLE *Table, @@ -515,6 +516,7 @@ typedef VOID struct _RTL_AVL_TABLE *Table, PVOID Buffer ); +#endif // // RTL Query Registry callback diff --git a/reactos/ntoskrnl/dbgk/debug.c b/reactos/ntoskrnl/dbgk/debug.c index f0078176c4b..ebaef713ed3 100644 --- a/reactos/ntoskrnl/dbgk/debug.c +++ b/reactos/ntoskrnl/dbgk/debug.c @@ -793,6 +793,7 @@ NtDebugContinue(IN HANDLE DebugHandle, /* Probe the handle */ ProbeForRead(AppClientId, sizeof(CLIENT_ID), sizeof(ULONG)); ClientId = *AppClientId; + AppClientId = &ClientId; } _SEH_HANDLE { @@ -838,7 +839,7 @@ NtDebugContinue(IN HANDLE DebugHandle, /* Compare process ID */ if (DebugEvent->ClientId.UniqueProcess == - ClientId.UniqueProcess) + AppClientId->UniqueProcess) { /* Check if we already found a match */ if (NeedsWake) @@ -853,7 +854,7 @@ NtDebugContinue(IN HANDLE DebugHandle, /* Compare thread ID and flag */ if ((DebugEvent->ClientId.UniqueThread == - ClientId.UniqueThread) && (DebugEvent->Flags & 1)) + AppClientId->UniqueThread) && (DebugEvent->Flags & 1)) { /* Remove the event from the list */ RemoveEntryList(NextEntry); @@ -1034,7 +1035,19 @@ NtSetInformationDebugObject(IN HANDLE DebugHandle, PreviousMode); /* Return required length to user-mode */ - if (ReturnLength) *ReturnLength = sizeof(*DebugInfo); + if (ReturnLength) + { + _SEH_TRY + { + ProbeForWriteUlong(ReturnLength); + *ReturnLength = sizeof(*DebugInfo); + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } if (!NT_SUCCESS(Status)) return Status; /* Open the Object */ @@ -1096,13 +1109,18 @@ NtWaitForDebugEvent(IN HANDLE DebugHandle, RtlZeroMemory(&WaitStateChange, sizeof(WaitStateChange)); /* Check if we came with a timeout from user mode */ - if ((Timeout) && (PreviousMode != KernelMode)) + if (PreviousMode != KernelMode) { _SEH_TRY { - /* Make a copy on the stack */ - SafeTimeOut = ProbeForReadLargeInteger(Timeout); - Timeout = &SafeTimeOut; + if (Timeout) + { + /* Make a copy on the stack */ + SafeTimeOut = ProbeForReadLargeInteger(Timeout); + Timeout = &SafeTimeOut; + } + + ProbeForWrite(StateChange, sizeof(*StateChange), sizeof(ULONG)); } _SEH_HANDLE { @@ -1116,12 +1134,6 @@ NtWaitForDebugEvent(IN HANDLE DebugHandle, KeQuerySystemTime(&StartTime); } - /* Check if the call is from user mode */ - if (PreviousMode == UserMode) - { - /* FIXME: Probe the state change structure */ - } - /* Get the debug object */ Status = ObReferenceObjectByHandle(DebugHandle, DEBUG_OBJECT_WAIT_STATE_CHANGE, @@ -1268,9 +1280,18 @@ NtWaitForDebugEvent(IN HANDLE DebugHandle, ObDereferenceObject(DebugObject); /* Return our wait state change structure */ - RtlMoveMemory(StateChange, - &WaitStateChange, - sizeof(DBGUI_WAIT_STATE_CHANGE)); + _SEH_TRY + { + RtlCopyMemory(StateChange, + &WaitStateChange, + sizeof(DBGUI_WAIT_STATE_CHANGE)); + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + return Status; } diff --git a/reactos/ntoskrnl/ob/obhandle.c b/reactos/ntoskrnl/ob/obhandle.c index 76807c27e9d..3eac1b8b2e2 100644 --- a/reactos/ntoskrnl/ob/obhandle.c +++ b/reactos/ntoskrnl/ob/obhandle.c @@ -147,7 +147,7 @@ ObpDecrementHandleCount(IN PVOID ObjectBody, ObpDeleteNameCheck(ObjectBody); /* Decrease the total number of handles for this type */ - InterlockedDecrement(&ObjectType->TotalNumberOfHandles); + InterlockedDecrement((PLONG)&ObjectType->TotalNumberOfHandles); OBTRACE(OB_HANDLE_DEBUG, "%s - Decremented count for: %p. HC LC %lx %lx\n", __FUNCTION__, @@ -388,7 +388,7 @@ ObpIncrementHandleCount(IN PVOID Object, } /* Increase total number of handles */ - InterlockedIncrement(&ObjectType->TotalNumberOfHandles); + InterlockedIncrement((PLONG)&ObjectType->TotalNumberOfHandles); OBTRACE(OB_HANDLE_DEBUG, "%s - Incremented count for: %p. Reason: %lx HC LC %lx %lx\n", __FUNCTION__, @@ -494,7 +494,7 @@ ObpIncrementUnnamedHandleCount(IN PVOID Object, } /* Increase total number of handles */ - InterlockedIncrement(&ObjectType->TotalNumberOfHandles); + InterlockedIncrement((PLONG)&ObjectType->TotalNumberOfHandles); OBTRACE(OB_HANDLE_DEBUG, "%s - Incremented count for: %p. UNNAMED HC LC %lx %lx\n", __FUNCTION__, diff --git a/reactos/ntoskrnl/ob/oblife.c b/reactos/ntoskrnl/ob/oblife.c index fb046f01872..37ded7f4833 100644 --- a/reactos/ntoskrnl/ob/oblife.c +++ b/reactos/ntoskrnl/ob/oblife.c @@ -71,7 +71,7 @@ ObpDeallocateObject(IN PVOID Object) } /* Decrease the total */ - InterlockedDecrement(&ObjectType->TotalNumberOfObjects); + InterlockedDecrement((PLONG)&ObjectType->TotalNumberOfObjects); /* Check if we have create info */ if (Header->Flags & OB_FLAG_CREATE_INFO) diff --git a/reactos/subsystems/win32/win32k/objects/dibobj.c b/reactos/subsystems/win32/win32k/objects/dibobj.c index ca3eaa4d891..c638e27f911 100644 --- a/reactos/subsystems/win32/win32k/objects/dibobj.c +++ b/reactos/subsystems/win32/win32k/objects/dibobj.c @@ -724,7 +724,7 @@ IntCreateDIBitmap(PDC Dc, const BITMAPINFOHEADER *header, { if (data->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) { - RGBQUAD *rgb = data->bmiColors; + const RGBQUAD *rgb = data->bmiColors; DWORD col = RGB( rgb->rgbRed, rgb->rgbGreen, rgb->rgbBlue ); // Check if the first color of the colormap is black