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

@ -1,4 +1,4 @@
/* /*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Win32k subsystem * PROJECT: ReactOS Win32k subsystem
* PURPOSE: Caret functions * PURPOSE: Caret functions
@ -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);
} }
@ -478,7 +478,7 @@ BOOL APIENTRY
NtUserCloseClipboard(VOID) NtUserCloseClipboard(VOID)
{ {
BOOL bRet; BOOL bRet;
UserEnterExclusive(); UserEnterExclusive();
bRet = UserCloseClipboard(); bRet = UserCloseClipboard();
UserLeave(); UserLeave();
@ -714,7 +714,7 @@ NtUserGetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats)
pWinStaObj = IntGetWinStaForCbAccess(); pWinStaObj = IntGetWinStaForCbAccess();
if (!pWinStaObj) if (!pWinStaObj)
goto cleanup; goto cleanup;
if (pWinStaObj->pClipBase == NULL) if (pWinStaObj->pClipBase == NULL)
{ {
iRet = 0; iRet = 0;
@ -1002,7 +1002,7 @@ NtUserSetClipboardViewer(HWND hWndNewViewer)
cleanup: cleanup:
if(pWinStaObj) if(pWinStaObj)
ObDereferenceObject(pWinStaObj); ObDereferenceObject(pWinStaObj);
UserLeave(); UserLeave();
return hWndNext; return hWndNext;

View file

@ -237,7 +237,7 @@ IntParseDesktopPath(PEPROCESS Process,
pwstrDesktop = wcschr(DesktopPath->Buffer, L'\\'); pwstrDesktop = wcschr(DesktopPath->Buffer, L'\\');
if(pwstrDesktop != NULL) if(pwstrDesktop != NULL)
{ {
*pwstrDesktop = 0; *pwstrDesktop = 0;
pwstrDesktop++; pwstrDesktop++;
pwstrWinsta = DesktopPath->Buffer; pwstrWinsta = DesktopPath->Buffer;
} }
@ -245,7 +245,7 @@ IntParseDesktopPath(PEPROCESS Process,
{ {
pwstrDesktop = DesktopPath->Buffer; pwstrDesktop = DesktopPath->Buffer;
pwstrWinsta = NULL; pwstrWinsta = NULL;
} }
TRACE("IntParseDesktopPath pwstrWinsta:%S pwstrDesktop:%S\n", pwstrWinsta, pwstrDesktop); TRACE("IntParseDesktopPath pwstrWinsta:%S pwstrDesktop:%S\n", pwstrWinsta, pwstrDesktop);
} }
@ -279,7 +279,7 @@ IntParseDesktopPath(PEPROCESS Process,
if(!pwstrDesktop) if(!pwstrDesktop)
pwstrDesktop = L"Default"; pwstrDesktop = L"Default";
} }
if(*hWinSta == NULL) if(*hWinSta == NULL)
{ {
swprintf(wstrWinstaFullName, L"%wZ\\%ws", &gustrWindowStationsDir, pwstrWinsta); swprintf(wstrWinstaFullName, L"%wZ\\%ws", &gustrWindowStationsDir, pwstrWinsta);
@ -371,7 +371,7 @@ IntValidateDesktopHandle(
(PVOID*)Object, (PVOID*)Object,
NULL); NULL);
TRACE("IntValidateDesktopHandle: handle:0x%x obj:0x%x access:0x%x Status:0x%x\n", TRACE("IntValidateDesktopHandle: handle:0x%x obj:0x%x access:0x%x Status:0x%x\n",
Desktop, *Object, DesiredAccess, Status); Desktop, *Object, DesiredAccess, Status);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -1042,7 +1042,7 @@ NtUserCreateDesktop(
/* /*
* Try to open already existing desktop * Try to open already existing desktop
*/ */
Status = ObOpenObjectByName( Status = ObOpenObjectByName(
ObjectAttributes, ObjectAttributes,
ExDesktopObjectType, ExDesktopObjectType,
@ -1087,7 +1087,7 @@ NtUserCreateDesktop(
KernelMode, KernelMode,
(PVOID)&DesktopObject, (PVOID)&DesktopObject,
NULL); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ERR("Failed to reference desktop object\n"); ERR("Failed to reference desktop object\n");
RETURN(NULL); RETURN(NULL);
@ -1243,7 +1243,7 @@ CLEANUP:
{ {
ExFreePoolWithTag(DesktopName.Buffer, TAG_STRING); ExFreePoolWithTag(DesktopName.Buffer, TAG_STRING);
} }
if (!NoHooks && ptiCurrent) if (!NoHooks && ptiCurrent)
{ {
ptiCurrent->TIF_flags &= ~TIF_DISABLEHOOKS; ptiCurrent->TIF_flags &= ~TIF_DISABLEHOOKS;
ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags; ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
@ -1355,7 +1355,7 @@ NtUserOpenInputDesktop(
dwDesiredAccess, dwDesiredAccess,
ExDesktopObjectType, ExDesktopObjectType,
UserMode, UserMode,
&hdesk); (PHANDLE)&hdesk);
ObDereferenceObject(pdesk); ObDereferenceObject(pdesk);
@ -1818,12 +1818,12 @@ IntSetThreadDesktop(IN HDESK hDesktop,
return FALSE; return FALSE;
} }
} }
pdeskOld = pti->rpdesk; pdeskOld = pti->rpdesk;
hdeskOld = pti->hdesk; hdeskOld = pti->hdesk;
pctiOld = pti->pcti; pctiOld = pti->pcti;
/* do the switch */ /* do the switch */
if(pdesk != NULL) if(pdesk != NULL)
{ {
pti->rpdesk = pdesk; pti->rpdesk = pdesk;
@ -1855,7 +1855,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
pci->pDeskInfo = NULL; pci->pDeskInfo = NULL;
pci->pClientThreadInfo = NULL; pci->pClientThreadInfo = NULL;
} }
/* clean up the old desktop */ /* clean up the old desktop */
if(pdeskOld != NULL) if(pdeskOld != NULL)
{ {

View file

@ -15,7 +15,7 @@ DBG_DEFAULT_CHANNEL(UserHook);
typedef struct _HOOKPACK typedef struct _HOOKPACK
{ {
PHOOK pHk; PHOOK pHk;
LPARAM lParam; LPARAM lParam;
PVOID pHookStructs; PVOID pHookStructs;
} HOOKPACK, *PHOOKPACK; } HOOKPACK, *PHOOKPACK;
@ -42,7 +42,7 @@ IntLoadHookModule(int iHookID, HHOOK hHook, BOOL Unload)
{ {
if(!Unload && !(ppi->W32PF_flags & W32PF_APIHOOKLOADED)) if(!Unload && !(ppi->W32PF_flags & W32PF_APIHOOKLOADED))
{ {
/* A callback in user mode can trigger UserLoadApiHook to be called and /* A callback in user mode can trigger UserLoadApiHook to be called and
as a result IntLoadHookModule will be called recursively. as a result IntLoadHookModule will be called recursively.
To solve this we set the flag that means that the appliaction has To solve this we set the flag that means that the appliaction has
loaded the api hook before the callback and in case of error we remove it */ loaded the api hook before the callback and in case of error we remove it */
@ -80,11 +80,11 @@ IntLoadHookModule(int iHookID, HHOOK hHook, BOOL Unload)
} }
/* /*
IntHookModuleUnloaded: IntHookModuleUnloaded:
Sends a internal message to all threads of the requested desktop Sends a internal message to all threads of the requested desktop
and notifies them that a global hook was destroyed and notifies them that a global hook was destroyed
and an injected module must be unloaded. and an injected module must be unloaded.
As a result, IntLoadHookModule will be called for all the threads that As a result, IntLoadHookModule will be called for all the threads that
will receive the special purpose internal message. will receive the special purpose internal message.
*/ */
BOOL BOOL
@ -106,7 +106,7 @@ IntHookModuleUnloaded(PDESKTOP pdesk, int iHookID, HHOOK hHook)
/* FIXME: Do some more security checks here */ /* FIXME: Do some more security checks here */
/* FIXME: The first check is a reactos specific hack for system threads */ /* FIXME: The first check is a reactos specific hack for system threads */
if(!PsIsSystemProcess(ptiCurrent->ppi->peProcess) && if(!PsIsSystemProcess(ptiCurrent->ppi->peProcess) &&
ptiCurrent->ppi != ppiCsr) ptiCurrent->ppi != ppiCsr)
{ {
if(ptiCurrent->ppi->W32PF_flags & W32PF_APIHOOKLOADED) if(ptiCurrent->ppi->W32PF_flags & W32PF_APIHOOKLOADED)
@ -129,8 +129,8 @@ IntHookModuleUnloaded(PDESKTOP pdesk, int iHookID, HHOOK hHook)
return TRUE; return TRUE;
} }
BOOL BOOL
FASTCALL FASTCALL
UserLoadApiHook() UserLoadApiHook()
{ {
return IntLoadHookModule(WH_APIHOOK, 0, FALSE); return IntLoadHookModule(WH_APIHOOK, 0, FALSE);
@ -436,7 +436,7 @@ co_IntCallDebugHook(PHOOK Hook,
break; break;
case HCBT_ACTIVATE: case HCBT_ACTIVATE:
Size = sizeof(CBTACTIVATESTRUCT); Size = sizeof(CBTACTIVATESTRUCT);
break; break;
case HCBT_CREATEWND: /* Handle ANSI? */ case HCBT_CREATEWND: /* Handle ANSI? */
@ -876,8 +876,8 @@ co_UserCallNextHookEx(PHOOK Hook,
} }
} }
if (!BadChk) if (!BadChk)
{ {
lResult = co_HOOK_CallHookNext(Hook, Code, wParam, (LPARAM)(lParam ? &EventMsg : NULL)); lResult = co_HOOK_CallHookNext(Hook, Code, wParam, (LPARAM)(lParam ? &EventMsg : NULL));
if (lParam) if (lParam)
@ -917,14 +917,14 @@ co_UserCallNextHookEx(PHOOK Hook,
case WH_FOREGROUNDIDLE: case WH_FOREGROUNDIDLE:
case WH_KEYBOARD: case WH_KEYBOARD:
case WH_SHELL: case WH_SHELL:
lResult = co_HOOK_CallHookNext(Hook, Code, wParam, lParam); lResult = co_HOOK_CallHookNext(Hook, Code, wParam, lParam);
break; break;
default: default:
ERR("Unsupported HOOK Id -> %d\n",Hook->HookId); ERR("Unsupported HOOK Id -> %d\n",Hook->HookId);
break; break;
} }
return lResult; return lResult;
} }
PHOOK PHOOK
@ -932,7 +932,7 @@ FASTCALL
IntGetHookObject(HHOOK hHook) IntGetHookObject(HHOOK hHook)
{ {
PHOOK Hook; PHOOK Hook;
if (!hHook) if (!hHook)
{ {
EngSetLastError(ERROR_INVALID_HOOK_HANDLE); EngSetLastError(ERROR_INVALID_HOOK_HANDLE);
@ -1274,7 +1274,7 @@ co_HOOK_CallHooks( INT HookId,
continue; continue;
} }
UserRefObjectCo(Hook, &Ref); UserRefObjectCo(Hook, &Ref);
/* Hook->Thread is null, we hax around this with Hook->head.pti. */ /* Hook->Thread is null, we hax around this with Hook->head.pti. */
ptiHook = Hook->head.pti; ptiHook = Hook->head.pti;
@ -1421,7 +1421,7 @@ CLEANUP:
HHOOK HHOOK
APIENTRY APIENTRY
NtUserSetWindowsHookAW( int idHook, NtUserSetWindowsHookAW( int idHook,
HOOKPROC lpfn, HOOKPROC lpfn,
BOOL Ansi) BOOL Ansi)
{ {
@ -1523,7 +1523,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
RETURN( NULL); RETURN( NULL);
} }
if ( (ptiHook->TIF_flags & (TIF_CSRSSTHREAD|TIF_SYSTEMTHREAD)) && if ( (ptiHook->TIF_flags & (TIF_CSRSSTHREAD|TIF_SYSTEMTHREAD)) &&
(HookId == WH_GETMESSAGE || (HookId == WH_GETMESSAGE ||
HookId == WH_CALLWNDPROC || HookId == WH_CALLWNDPROC ||
HookId == WH_CBT || HookId == WH_CBT ||
@ -1539,7 +1539,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod,
} }
} }
else /* System-global hook */ else /* System-global hook */
{ {
ptiHook = pti; // gptiCurrent; ptiHook = pti; // gptiCurrent;
if ( !Mod && if ( !Mod &&
(HookId == WH_GETMESSAGE || (HookId == WH_GETMESSAGE ||
@ -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;
@ -292,7 +292,7 @@ RegWriteUserSetting(
Status = RtlAppendUnicodeToString(&usKeyName, pwszKeyName); Status = RtlAppendUnicodeToString(&usKeyName, pwszKeyName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("RtlAppendUnicodeToString failed with Status=%lx, buf:%d,%d\n", DPRINT1("RtlAppendUnicodeToString failed with Status=%lx, buf:%d,%d\n",
Status, usKeyName.Length, usKeyName.MaximumLength); Status, usKeyName.Length, usKeyName.MaximumLength);
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;
@ -517,7 +517,7 @@ co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook
if (co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg->message, (LPARAM) &MouseHookData)) if (co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg->message, (LPARAM) &MouseHookData))
return; return;
} }
/* Get the desktop window */ /* Get the desktop window */
pwndDesktop = UserGetDesktopWindow(); pwndDesktop = UserGetDesktopWindow();
if (!pwndDesktop) return; if (!pwndDesktop) return;
@ -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

@ -188,7 +188,7 @@ NtUserCallOneParam(
RtlZeroMemory(psmwp->acvr, count * sizeof(CVR)); RtlZeroMemory(psmwp->acvr, count * sizeof(CVR));
psmwp->bHandle = TRUE; psmwp->bHandle = TRUE;
psmwp->ccvr = 0; // actualCount psmwp->ccvr = 0; // actualCount
psmwp->ccvrAlloc = count; // suggestedCount psmwp->ccvrAlloc = count; // suggestedCount
RETURN((DWORD_PTR)hDwp); RETURN((DWORD_PTR)hDwp);
} }
@ -634,7 +634,7 @@ NtUserCallHwnd(
UserRefObjectCo(Window, &Ref); UserRefObjectCo(Window, &Ref);
HelpId = IntGetProp(Window, gpsi->atomContextHelpIdProp); HelpId = IntGetProp(Window, gpsi->atomContextHelpIdProp);
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
UserLeave(); UserLeave();
return (DWORD)HelpId->Data; return (DWORD)HelpId->Data;
@ -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:
{ {
@ -702,7 +702,7 @@ NtUserCallHwndParam(
UserRefObjectCo(pWnd, &Ref); UserRefObjectCo(pWnd, &Ref);
if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() && if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() &&
pWnd->cbwndExtra == DLGWINDOWEXTRA && pWnd->cbwndExtra == DLGWINDOWEXTRA &&
!(pWnd->state & WNDS_SERVERSIDEWINDOWPROC)) !(pWnd->state & WNDS_SERVERSIDEWINDOWPROC))
{ {
if (Param) if (Param)
@ -716,7 +716,7 @@ NtUserCallHwndParam(
pWnd->state &= ~WNDS_DIALOGWINDOW; pWnd->state &= ~WNDS_DIALOGWINDOW;
} }
} }
UserDerefObjectCo(pWnd); UserDerefObjectCo(pWnd);
UserLeave(); UserLeave();
return 0; return 0;