A pointer is not a handle. A handle is not a pointer. At least in most cases. Defining STRICT in win32k revealed horrible things...

svn path=/trunk/; revision=56478
This commit is contained in:
Timo Kreuzer 2012-05-02 19:29:33 +00:00
parent bbbd338d81
commit e0f1c20325
16 changed files with 77 additions and 74 deletions

View file

@ -165,7 +165,7 @@ EngRealizeBrush(
psurfRealize = SURFACE_ShareLockSurface(hbmpRealize); psurfRealize = SURFACE_ShareLockSurface(hbmpRealize);
/* Already delete the pattern bitmap (will be kept until dereferenced) */ /* Already delete the pattern bitmap (will be kept until dereferenced) */
EngDeleteSurface(hbmpRealize); EngDeleteSurface((HSURF)hbmpRealize);
if (!psurfRealize) if (!psurfRealize)
{ {

View file

@ -477,11 +477,11 @@ EngSetPointerShape(
failure: failure:
/* Cleanup surfaces */ /* Cleanup surfaces */
if (hbmMask) EngDeleteSurface(hbmMask); if (hbmMask) EngDeleteSurface((HSURF)hbmMask);
if (psurfMask) SURFACE_ShareUnlockSurface(psurfMask); if (psurfMask) SURFACE_ShareUnlockSurface(psurfMask);
if (hbmColor) EngDeleteSurface(hbmColor); if (hbmColor) EngDeleteSurface((HSURF)hbmColor);
if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor); if (psurfColor) SURFACE_ShareUnlockSurface(psurfColor);
if (hbmSave) EngDeleteSurface(hbmSave); if (hbmSave) EngDeleteSurface((HSURF)hbmSave);
if (psurfSave) SURFACE_ShareUnlockSurface(psurfSave); if (psurfSave) SURFACE_ShareUnlockSurface(psurfSave);
return SPS_ERROR; return SPS_ERROR;

View file

@ -832,7 +832,7 @@ NtGdiGetDhpdev(
for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext) for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
{ {
/* Compare with the given HDEV */ /* Compare with the given HDEV */
if (ppdev == hdev) if (ppdev == (PPDEVOBJ)hdev)
{ {
/* Found the PDEV! Get it's dhpdev and break */ /* Found the PDEV! Get it's dhpdev and break */
dhpdev = ppdev->dhpdev; dhpdev = ppdev->dhpdev;

View file

@ -138,7 +138,7 @@ NtGdiAlphaBlend(
DPRINT("Locking DCs\n"); DPRINT("Locking DCs\n");
ahDC[0] = hDCDest; ahDC[0] = hDCDest;
ahDC[1] = hDCSrc ; ahDC[1] = hDCSrc ;
if (!GDIOBJ_bLockMultipleObjects(2, ahDC, apObj, GDIObjType_DC_TYPE)) if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
{ {
DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc); DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc);
EngSetLastError(ERROR_INVALID_HANDLE); EngSetLastError(ERROR_INVALID_HANDLE);
@ -286,7 +286,7 @@ NtGdiTransparentBlt(
DPRINT("Locking DCs\n"); DPRINT("Locking DCs\n");
ahDC[0] = hdcDst; ahDC[0] = hdcDst;
ahDC[1] = hdcSrc ; ahDC[1] = hdcSrc ;
if (!GDIOBJ_bLockMultipleObjects(2, ahDC, apObj, GDIObjType_DC_TYPE)) if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
{ {
DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hdcDst, hdcSrc); DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hdcDst, hdcSrc);
EngSetLastError(ERROR_INVALID_HANDLE); EngSetLastError(ERROR_INVALID_HANDLE);
@ -440,7 +440,7 @@ NtGdiMaskBlt(
DPRINT("Locking DCs\n"); DPRINT("Locking DCs\n");
ahDC[0] = hdcDest; ahDC[0] = hdcDest;
ahDC[1] = UsesSource ? hdcSrc : NULL; ahDC[1] = UsesSource ? hdcSrc : NULL;
if (!GDIOBJ_bLockMultipleObjects(2, ahDC, apObj, GDIObjType_DC_TYPE)) if (!GDIOBJ_bLockMultipleObjects(2, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
{ {
DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hdcDest, hdcSrc); DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hdcDest, hdcSrc);
EngSetLastError(ERROR_INVALID_HANDLE); EngSetLastError(ERROR_INVALID_HANDLE);
@ -635,7 +635,7 @@ GreStretchBltMask(
ahDC[0] = hDCDest; ahDC[0] = hDCDest;
ahDC[1] = UsesSource ? hDCSrc : NULL; ahDC[1] = UsesSource ? hDCSrc : NULL;
ahDC[2] = UsesMask ? hDCMask : NULL; ahDC[2] = UsesMask ? hDCMask : NULL;
if (!GDIOBJ_bLockMultipleObjects(3, ahDC, apObj, GDIObjType_DC_TYPE)) if (!GDIOBJ_bLockMultipleObjects(3, (HGDIOBJ*)ahDC, apObj, GDIObjType_DC_TYPE))
{ {
DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc); DPRINT1("Invalid dc handle (dest=0x%08x, src=0x%08x) passed to NtGdiAlphaBlend\n", hDCDest, hDCSrc);
EngSetLastError(ERROR_INVALID_HANDLE); EngSetLastError(ERROR_INVALID_HANDLE);

View file

@ -3346,7 +3346,7 @@ NtGdiCombineRgn(
ahrgn[0] = hrgnDst; ahrgn[0] = hrgnDst;
ahrgn[1] = hrgnSrc1; ahrgn[1] = hrgnSrc1;
ahrgn[2] = iMode != RGN_COPY ? hrgnSrc2 : NULL; ahrgn[2] = iMode != RGN_COPY ? hrgnSrc2 : NULL;
if (!GDIOBJ_bLockMultipleObjects(3, ahrgn, (PVOID*)aprgn, GDIObjType_RGN_TYPE)) if (!GDIOBJ_bLockMultipleObjects(3, (HGDIOBJ*)ahrgn, (PVOID*)aprgn, GDIObjType_RGN_TYPE))
{ {
DPRINT1("NtGdiCombineRgn: %p, %p, %p, %d\n", DPRINT1("NtGdiCombineRgn: %p, %p, %p, %d\n",
hrgnDst, hrgnSrc1, hrgnSrc2, iMode); hrgnDst, hrgnSrc1, hrgnSrc2, iMode);

View file

@ -11,6 +11,7 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#define _NO_COM #define _NO_COM
#define STRICT
/* DDK/NDK/SDK headers */ /* DDK/NDK/SDK headers */
#undef NTDDI_VERSION #undef NTDDI_VERSION

View file

@ -533,7 +533,7 @@ DxEngLockHdev(HDEV hDev)
DPRINT1("hDev : 0x%08lx\n",hDev); DPRINT1("hDev : 0x%08lx\n",hDev);
Resource = ppdev->hsemDevLock; Resource = (PERESOURCE)ppdev->hsemDevLock;
if (Resource) if (Resource)
{ {
@ -564,7 +564,7 @@ APIENTRY
DxEngUnlockHdev(HDEV hDev) DxEngUnlockHdev(HDEV hDev)
{ {
PPDEVOBJ ppdev = (PPDEVOBJ)hDev; PPDEVOBJ ppdev = (PPDEVOBJ)hDev;
PERESOURCE Resource = ppdev->hsemDevLock; PERESOURCE Resource = (PERESOURCE)ppdev->hsemDevLock;
DPRINT1("ReactX Calling : DxEngUnlockHdev \n"); DPRINT1("ReactX Calling : DxEngUnlockHdev \n");
@ -674,7 +674,7 @@ BOOLEAN
APIENTRY APIENTRY
DxEngIsHdevLockedByCurrentThread(HDEV hDev) DxEngIsHdevLockedByCurrentThread(HDEV hDev)
{ // Based on EngIsSemaphoreOwnedByCurrentThread w/o the Ex call. { // Based on EngIsSemaphoreOwnedByCurrentThread w/o the Ex call.
PERESOURCE pSem = ((PPDEVOBJ)hDev)->hsemDevLock; PERESOURCE pSem = (PERESOURCE)(((PPDEVOBJ)hDev)->hsemDevLock);
return pSem->OwnerEntry.OwnerThread == (ERESOURCE_THREAD)PsGetCurrentThread(); return pSem->OwnerEntry.OwnerThread == (ERESOURCE_THREAD)PsGetCurrentThread();
} }

View file

@ -164,7 +164,8 @@ BOOL FASTCALL co_UserHideCaret(PWND Window OPTIONAL)
if(ThreadQueue->CaretInfo->Visible) if(ThreadQueue->CaretInfo->Visible)
{ {
IntKillTimer(ThreadQueue->CaretInfo->hWnd, IDCARETTIMER, TRUE); PWND pwnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
IntKillTimer(pwnd, IDCARETTIMER, TRUE);
co_IntHideCaret(ThreadQueue->CaretInfo); co_IntHideCaret(ThreadQueue->CaretInfo);
ThreadQueue->CaretInfo->Visible = 0; ThreadQueue->CaretInfo->Visible = 0;
@ -247,7 +248,8 @@ NtUserCreateCaret(
if (ThreadQueue->CaretInfo->Visible) if (ThreadQueue->CaretInfo->Visible)
{ {
IntKillTimer(hWnd, IDCARETTIMER, TRUE); PWND pwnd = UserGetWindowObject(hWnd);
IntKillTimer(pwnd, IDCARETTIMER, TRUE);
co_IntHideCaret(ThreadQueue->CaretInfo); co_IntHideCaret(ThreadQueue->CaretInfo);
} }

View file

@ -15,7 +15,7 @@ REGISTER_SYSCLASS DefaultServerClasses[] =
CS_GLOBALCLASS|CS_DBLCLKS, CS_GLOBALCLASS|CS_DBLCLKS,
NULL, NULL,
0, 0,
IDC_ARROW, (HICON)IDC_ARROW,
(HBRUSH)(COLOR_BACKGROUND + 1), (HBRUSH)(COLOR_BACKGROUND + 1),
FNID_DESKTOP, FNID_DESKTOP,
ICLS_DESKTOP ICLS_DESKTOP
@ -24,7 +24,7 @@ REGISTER_SYSCLASS DefaultServerClasses[] =
CS_VREDRAW|CS_HREDRAW|CS_SAVEBITS, CS_VREDRAW|CS_HREDRAW|CS_SAVEBITS,
NULL, // Use User32 procs NULL, // Use User32 procs
sizeof(LONG), sizeof(LONG),
IDC_ARROW, (HICON)IDC_ARROW,
NULL, NULL,
FNID_SWITCH, FNID_SWITCH,
ICLS_SWITCH ICLS_SWITCH
@ -33,7 +33,7 @@ REGISTER_SYSCLASS DefaultServerClasses[] =
CS_DBLCLKS|CS_SAVEBITS, CS_DBLCLKS|CS_SAVEBITS,
NULL, // Use User32 procs NULL, // Use User32 procs
sizeof(LONG), sizeof(LONG),
IDC_ARROW, (HICON)IDC_ARROW,
(HBRUSH)(COLOR_MENU + 1), (HBRUSH)(COLOR_MENU + 1),
FNID_MENU, FNID_MENU,
ICLS_MENU ICLS_MENU
@ -42,7 +42,7 @@ REGISTER_SYSCLASS DefaultServerClasses[] =
CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW|CS_PARENTDC, CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW|CS_PARENTDC,
NULL, // Use User32 procs NULL, // Use User32 procs
sizeof(SBWND)-sizeof(WND), sizeof(SBWND)-sizeof(WND),
IDC_ARROW, (HICON)IDC_ARROW,
NULL, NULL,
FNID_SCROLLBAR, FNID_SCROLLBAR,
ICLS_SCROLLBAR ICLS_SCROLLBAR
@ -51,7 +51,7 @@ REGISTER_SYSCLASS DefaultServerClasses[] =
0, 0,
NULL, // Use User32 procs NULL, // Use User32 procs
0, 0,
IDC_ARROW, (HICON)IDC_ARROW,
0, 0,
FNID_ICONTITLE, FNID_ICONTITLE,
ICLS_ICONTITLE ICLS_ICONTITLE
@ -60,7 +60,7 @@ REGISTER_SYSCLASS DefaultServerClasses[] =
CS_GLOBALCLASS, CS_GLOBALCLASS,
NULL, // Use User32 procs NULL, // Use User32 procs
0, 0,
IDC_ARROW, (HICON)IDC_ARROW,
NULL, NULL,
FNID_MESSAGEWND, FNID_MESSAGEWND,
ICLS_HWNDMESSAGE ICLS_HWNDMESSAGE

View file

@ -173,7 +173,7 @@ IntSynthesizeDib(PWINSTATION_OBJECT pWinStaObj, HBITMAP hBm)
{ {
pMemObj->cbData = sizeof(BITMAPINFOHEADER) + bi.bmiHeader.biSizeImage; pMemObj->cbData = sizeof(BITMAPINFOHEADER) + bi.bmiHeader.biSizeImage;
memcpy(pMemObj->Data, &bi, sizeof(BITMAPINFOHEADER)); memcpy(pMemObj->Data, &bi, sizeof(BITMAPINFOHEADER));
NtGdiGetDIBitsInternal(hdc, pMemObj->Data, 0, bm.bmHeight, (LPBYTE)pMemObj->Data + sizeof(BITMAPINFOHEADER), &bi, DIB_RGB_COLORS, 0, 0); NtGdiGetDIBitsInternal(hdc, hBm, 0, bm.bmHeight, (LPBYTE)pMemObj->Data + sizeof(BITMAPINFOHEADER), &bi, DIB_RGB_COLORS, 0, 0);
IntAddFormatedData(pWinStaObj, CF_DIB, hMem, TRUE, TRUE); IntAddFormatedData(pWinStaObj, CF_DIB, hMem, TRUE, TRUE);
} }

View file

@ -1355,7 +1355,7 @@ NtUserOpenInputDesktop(
dwDesiredAccess, dwDesiredAccess,
ExDesktopObjectType, ExDesktopObjectType,
UserMode, UserMode,
&hdesk); (PHANDLE)&hdesk);
ObDereferenceObject(pdesk); ObDereferenceObject(pdesk);

View file

@ -1570,7 +1570,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
} }
ObDereferenceObject(WinStaObj); ObDereferenceObject(WinStaObj);
Hook = UserCreateObject(gHandleTable, NULL, &Handle, otHook, sizeof(HOOK)); Hook = UserCreateObject(gHandleTable, NULL, (PHANDLE)&Handle, otHook, sizeof(HOOK));
if (!Hook) if (!Hook)
{ {

View file

@ -750,7 +750,7 @@ cleanup:
if (hbm) if (hbm)
GreDeleteObject(hbm); GreDeleteObject(hbm);
if (hdc) if (hdc)
UserReleaseDC(hWnd, hdc, FALSE); UserReleaseDC(pWnd, hdc, FALSE);
} }
/* /*

View file

@ -33,7 +33,7 @@ RegOpenKey(
NULL); NULL);
/* Open the key */ /* Open the key */
Status = ZwOpenKey(&hkey, KEY_READ, &ObjectAttributes); Status = ZwOpenKey((PHANDLE)&hkey, KEY_READ, &ObjectAttributes);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
*phkey = hkey; *phkey = hkey;
@ -198,7 +198,7 @@ RegReadUserSetting(
NULL); NULL);
/* Open the key */ /* Open the key */
Status = ZwOpenKey(&hkey, KEY_READ, &ObjectAttributes); Status = ZwOpenKey((PHANDLE)&hkey, KEY_READ, &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return FALSE; return FALSE;
@ -305,7 +305,7 @@ RegWriteUserSetting(
NULL); NULL);
/* Open or create the key */ /* Open or create the key */
Status = ZwCreateKey(&hkey, Status = ZwCreateKey((PHANDLE)&hkey,
KEY_READ | KEY_WRITE, KEY_READ | KEY_WRITE,
&ObjectAttributes, &ObjectAttributes,
0, 0,

View file

@ -117,7 +117,7 @@ UserSetCursor(
/* Get the screen DC */ /* Get the screen DC */
if(!(hdcScreen = IntGetScreenDC())) if(!(hdcScreen = IntGetScreenDC()))
{ {
return (HCURSOR)0; return NULL;
} }
OldCursor = MessageQueue->CursorObject; OldCursor = MessageQueue->CursorObject;
@ -1727,8 +1727,8 @@ co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
3: handle to the window whose messages are to be retrieved. 3: handle to the window whose messages are to be retrieved.
*/ */
if ( ( !Window || // 1 if ( ( !Window || // 1
( Window == HWND_BOTTOM && CurrentMessage->Msg.hwnd == NULL ) || // 2 ( Window->head.h == HWND_BOTTOM && CurrentMessage->Msg.hwnd == NULL ) || // 2
( Window != HWND_BOTTOM && Window->head.h == CurrentMessage->Msg.hwnd ) ) && // 3 ( Window->head.h != HWND_BOTTOM && Window->head.h == CurrentMessage->Msg.hwnd ) ) && // 3
( ( ( MsgFilterLow == 0 && MsgFilterHigh == 0 ) && CurrentMessage->QS_Flags & QSflags ) || ( ( ( MsgFilterLow == 0 && MsgFilterHigh == 0 ) && CurrentMessage->QS_Flags & QSflags ) ||
( MsgFilterLow <= CurrentMessage->Msg.message && MsgFilterHigh >= CurrentMessage->Msg.message ) ) ) ( MsgFilterLow <= CurrentMessage->Msg.message && MsgFilterHigh >= CurrentMessage->Msg.message ) ) )
{ {
@ -1790,8 +1790,8 @@ MsqPeekMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
3: handle to the window whose messages are to be retrieved. 3: handle to the window whose messages are to be retrieved.
*/ */
if ( ( !Window || // 1 if ( ( !Window || // 1
( Window == HWND_BOTTOM && CurrentMessage->Msg.hwnd == NULL ) || // 2 ( Window->head.h == HWND_BOTTOM && CurrentMessage->Msg.hwnd == NULL ) || // 2
( Window != HWND_BOTTOM && Window->head.h == CurrentMessage->Msg.hwnd ) ) && // 3 ( Window->head.h != HWND_BOTTOM && Window->head.h == CurrentMessage->Msg.hwnd ) ) && // 3
( ( ( MsgFilterLow == 0 && MsgFilterHigh == 0 ) && CurrentMessage->QS_Flags & QSflags ) || ( ( ( MsgFilterLow == 0 && MsgFilterHigh == 0 ) && CurrentMessage->QS_Flags & QSflags ) ||
( MsgFilterLow <= CurrentMessage->Msg.message && MsgFilterHigh >= CurrentMessage->Msg.message ) ) ) ( MsgFilterLow <= CurrentMessage->Msg.message && MsgFilterHigh >= CurrentMessage->Msg.message ) ) )
{ {

View file

@ -665,7 +665,7 @@ NtUserCallHwndParam(
switch (Routine) switch (Routine)
{ {
case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER: case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER:
return IntKillTimer(hWnd, (UINT_PTR)Param, TRUE); return IntKillTimer(UserGetWindowObject(hWnd), (UINT_PTR)Param, TRUE);
case HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID: case HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID:
{ {