[ros-diffs] [weiden] 24578: - Some minor Nt stub fixes - Fix compilation with GCC4

weiden at svn.reactos.org weiden at svn.reactos.org
Fri Oct 20 15:19:14 CEST 2006


Author: weiden
Date: Fri Oct 20 17:19:13 2006
New Revision: 24578

URL: http://svn.reactos.org/svn/reactos?rev=24578&view=rev
Log:
- Some minor Nt stub fixes
- Fix compilation with GCC4

Modified:
    trunk/reactos/include/ndk/rtltypes.h
    trunk/reactos/ntoskrnl/dbgk/debug.c
    trunk/reactos/ntoskrnl/ob/obhandle.c
    trunk/reactos/ntoskrnl/ob/oblife.c
    trunk/reactos/subsystems/win32/win32k/objects/dibobj.c

Modified: trunk/reactos/include/ndk/rtltypes.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtltypes.h?rev=24578&r1=24577&r2=24578&view=diff
==============================================================================
--- trunk/reactos/include/ndk/rtltypes.h (original)
+++ trunk/reactos/include/ndk/rtltypes.h Fri Oct 20 17:19:13 2006
@@ -471,6 +471,7 @@
 //
 // 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 @@
     struct _RTL_AVL_TABLE *Table,
     PVOID Buffer
 );
+#endif
 
 //
 // RTL Query Registry callback

Modified: trunk/reactos/ntoskrnl/dbgk/debug.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/dbgk/debug.c?rev=24578&r1=24577&r2=24578&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/dbgk/debug.c (original)
+++ trunk/reactos/ntoskrnl/dbgk/debug.c Fri Oct 20 17:19:13 2006
@@ -793,6 +793,7 @@
             /* Probe the handle */
             ProbeForRead(AppClientId, sizeof(CLIENT_ID), sizeof(ULONG));
             ClientId = *AppClientId;
+            AppClientId = &ClientId;
         }
         _SEH_HANDLE
         {
@@ -838,7 +839,7 @@
 
                 /* Compare process ID */
                 if (DebugEvent->ClientId.UniqueProcess ==
-                    ClientId.UniqueProcess)
+                    AppClientId->UniqueProcess)
                 {
                     /* Check if we already found a match */
                     if (NeedsWake)
@@ -853,7 +854,7 @@
 
                     /* 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 @@
                                        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 @@
     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
         {
@@ -1114,12 +1132,6 @@
 
         /* Query the current time */
         KeQuerySystemTime(&StartTime);
-    }
-
-    /* Check if the call is from user mode */
-    if (PreviousMode == UserMode)
-    {
-        /* FIXME: Probe the state change structure */
     }
 
     /* Get the debug object */
@@ -1268,9 +1280,18 @@
     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;
 }
 

Modified: trunk/reactos/ntoskrnl/ob/obhandle.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev=24578&r1=24577&r2=24578&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obhandle.c (original)
+++ trunk/reactos/ntoskrnl/ob/obhandle.c Fri Oct 20 17:19:13 2006
@@ -147,7 +147,7 @@
     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 @@
     }
 
     /* 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 @@
     }
 
     /* 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__,

Modified: trunk/reactos/ntoskrnl/ob/oblife.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/oblife.c?rev=24578&r1=24577&r2=24578&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/oblife.c (original)
+++ trunk/reactos/ntoskrnl/ob/oblife.c Fri Oct 20 17:19:13 2006
@@ -71,7 +71,7 @@
     }
 
     /* Decrease the total */
-    InterlockedDecrement(&ObjectType->TotalNumberOfObjects);
+    InterlockedDecrement((PLONG)&ObjectType->TotalNumberOfObjects);
 
     /* Check if we have create info */
     if (Header->Flags & OB_FLAG_CREATE_INFO)

Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dibobj.c?rev=24578&r1=24577&r2=24578&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c Fri Oct 20 17:19:13 2006
@@ -724,7 +724,7 @@
   {
     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




More information about the Ros-diffs mailing list