- Use InterlockedExchangePointer instead of InterlockedExchange for a pointer.
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 11 May 2008 22:23:45 +0000 (22:23 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 11 May 2008 22:23:45 +0000 (22:23 +0000)
- Don't cast a DWORD to HANDLE directly
- ViewSize param of MmMapViewOfSection is SIZE_T, not ULONG

svn path=/trunk/; revision=33454

reactos/subsystems/win32/win32k/ntuser/desktop.c

index 709d396..4ac6e11 100644 (file)
@@ -542,12 +542,12 @@ IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
          return;
       }
       IntReferenceMessageQueue(NewQueue);
-      InterlockedExchange((LONG*)&NewQueue->Desktop, (LONG)pdo);
+      (void)InterlockedExchangePointer((PVOID*)&NewQueue->Desktop, pdo);
    }
-   Old = (PUSER_MESSAGE_QUEUE)InterlockedExchange((LONG*)&pdo->ActiveMessageQueue, (LONG)NewQueue);
+   Old = (PUSER_MESSAGE_QUEUE)InterlockedExchangePointer((PVOID*)&pdo->ActiveMessageQueue, NewQueue);
    if(Old != NULL)
    {
-      InterlockedExchange((LONG*)&Old->Desktop, 0);
+      (void)InterlockedExchangePointer((PVOID*)&Old->Desktop, 0);
       IntDereferenceMessageQueue(Old);
    }
 }
@@ -1660,7 +1660,7 @@ NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
       RETURN(0);
    }
 
-   Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);
+   Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)dwThreadId, &Thread);
    if(!NT_SUCCESS(Status))
    {
       SetLastWin32Error(ERROR_INVALID_PARAMETER);
@@ -1774,7 +1774,7 @@ IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
     PW32THREADINFO ti;
     PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next;
     PVOID UserBase = NULL;
-    ULONG ViewSize = 0;
+    SIZE_T ViewSize = 0;
     LARGE_INTEGER Offset;
     NTSTATUS Status;