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);
/* Already delete the pattern bitmap (will be kept until dereferenced) */
EngDeleteSurface(hbmpRealize);
EngDeleteSurface((HSURF)hbmpRealize);
if (!psurfRealize)
{

View file

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

View file

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

View file

@ -138,7 +138,7 @@ NtGdiAlphaBlend(
DPRINT("Locking DCs\n");
ahDC[0] = hDCDest;
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);
EngSetLastError(ERROR_INVALID_HANDLE);
@ -286,7 +286,7 @@ NtGdiTransparentBlt(
DPRINT("Locking DCs\n");
ahDC[0] = hdcDst;
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);
EngSetLastError(ERROR_INVALID_HANDLE);
@ -440,7 +440,7 @@ NtGdiMaskBlt(
DPRINT("Locking DCs\n");
ahDC[0] = hdcDest;
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);
EngSetLastError(ERROR_INVALID_HANDLE);
@ -635,7 +635,7 @@ GreStretchBltMask(
ahDC[0] = hDCDest;
ahDC[1] = UsesSource ? hDCSrc : 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);
EngSetLastError(ERROR_INVALID_HANDLE);

View file

@ -3346,7 +3346,7 @@ NtGdiCombineRgn(
ahrgn[0] = hrgnDst;
ahrgn[1] = hrgnSrc1;
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",
hrgnDst, hrgnSrc1, hrgnSrc2, iMode);

View file

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

View file

@ -533,7 +533,7 @@ DxEngLockHdev(HDEV hDev)
DPRINT1("hDev : 0x%08lx\n",hDev);
Resource = ppdev->hsemDevLock;
Resource = (PERESOURCE)ppdev->hsemDevLock;
if (Resource)
{
@ -564,7 +564,7 @@ APIENTRY
DxEngUnlockHdev(HDEV hDev)
{
PPDEVOBJ ppdev = (PPDEVOBJ)hDev;
PERESOURCE Resource = ppdev->hsemDevLock;
PERESOURCE Resource = (PERESOURCE)ppdev->hsemDevLock;
DPRINT1("ReactX Calling : DxEngUnlockHdev \n");
@ -674,7 +674,7 @@ BOOLEAN
APIENTRY
DxEngIsHdevLockedByCurrentThread(HDEV hDev)
{ // 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();
}

View file

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

View file

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

View file

@ -173,7 +173,7 @@ IntSynthesizeDib(PWINSTATION_OBJECT pWinStaObj, HBITMAP hBm)
{
pMemObj->cbData = sizeof(BITMAPINFOHEADER) + bi.bmiHeader.biSizeImage;
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);
}

View file

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

View file

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

View file

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

View file

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

View file

@ -117,7 +117,7 @@ UserSetCursor(
/* Get the screen DC */
if(!(hdcScreen = IntGetScreenDC()))
{
return (HCURSOR)0;
return NULL;
}
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.
*/
if ( ( !Window || // 1
( Window == HWND_BOTTOM && CurrentMessage->Msg.hwnd == NULL ) || // 2
( Window != HWND_BOTTOM && Window->head.h == CurrentMessage->Msg.hwnd ) ) && // 3
( Window->head.h == HWND_BOTTOM && CurrentMessage->Msg.hwnd == NULL ) || // 2
( Window->head.h != HWND_BOTTOM && Window->head.h == CurrentMessage->Msg.hwnd ) ) && // 3
( ( ( MsgFilterLow == 0 && MsgFilterHigh == 0 ) && CurrentMessage->QS_Flags & QSflags ) ||
( 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.
*/
if ( ( !Window || // 1
( Window == HWND_BOTTOM && CurrentMessage->Msg.hwnd == NULL ) || // 2
( Window != HWND_BOTTOM && Window->head.h == CurrentMessage->Msg.hwnd ) ) && // 3
( Window->head.h == HWND_BOTTOM && CurrentMessage->Msg.hwnd == NULL ) || // 2
( Window->head.h != HWND_BOTTOM && Window->head.h == CurrentMessage->Msg.hwnd ) ) && // 3
( ( ( MsgFilterLow == 0 && MsgFilterHigh == 0 ) && CurrentMessage->QS_Flags & QSflags ) ||
( MsgFilterLow <= CurrentMessage->Msg.message && MsgFilterHigh >= CurrentMessage->Msg.message ) ) )
{

View file

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