mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 18:56:48 +00:00
NtUserGetIconInfo: Move lockingunlocking out of SEH, as this is a bad idea. Get rid of RETURN(). Add a comment.
svn path=/trunk/; revision=42490
This commit is contained in:
parent
c136124b2f
commit
7b56dfa270
1 changed files with 21 additions and 29 deletions
|
@ -434,6 +434,7 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo OPTIONAL, BOOL Indirect)
|
||||||
/* Copy bitmaps and size info */
|
/* Copy bitmaps and size info */
|
||||||
if (Indirect)
|
if (Indirect)
|
||||||
{
|
{
|
||||||
|
// FIXME: WTF?
|
||||||
CurIcon->IconInfo.hbmMask = BITMAP_CopyBitmap(CurIcon->IconInfo.hbmMask);
|
CurIcon->IconInfo.hbmMask = BITMAP_CopyBitmap(CurIcon->IconInfo.hbmMask);
|
||||||
CurIcon->IconInfo.hbmColor = BITMAP_CopyBitmap(CurIcon->IconInfo.hbmColor);
|
CurIcon->IconInfo.hbmColor = BITMAP_CopyBitmap(CurIcon->IconInfo.hbmColor);
|
||||||
}
|
}
|
||||||
|
@ -496,10 +497,9 @@ NtUserGetIconInfo(
|
||||||
{
|
{
|
||||||
ICONINFO ii;
|
ICONINFO ii;
|
||||||
PCURICON_OBJECT CurIcon;
|
PCURICON_OBJECT CurIcon;
|
||||||
PWINSTATION_OBJECT WinSta;
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
BOOL Ret = FALSE;
|
BOOL Ret = FALSE;
|
||||||
DECLARE_RETURN(BOOL);
|
DWORD colorBpp = 0;
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetIconInfo\n");
|
DPRINT("Enter NtUserGetIconInfo\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
@ -507,19 +507,12 @@ NtUserGetIconInfo(
|
||||||
if (!IconInfo)
|
if (!IconInfo)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
RETURN(FALSE);
|
goto leave;
|
||||||
}
|
|
||||||
|
|
||||||
WinSta = IntGetWinStaObj();
|
|
||||||
if (WinSta == NULL)
|
|
||||||
{
|
|
||||||
RETURN(FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(CurIcon = UserGetCurIconObject(hCurIcon)))
|
if (!(CurIcon = UserGetCurIconObject(hCurIcon)))
|
||||||
{
|
{
|
||||||
ObDereferenceObject(WinSta);
|
goto leave;
|
||||||
RETURN(FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlCopyMemory(&ii, &CurIcon->IconInfo, sizeof(ICONINFO));
|
RtlCopyMemory(&ii, &CurIcon->IconInfo, sizeof(ICONINFO));
|
||||||
|
@ -528,6 +521,18 @@ NtUserGetIconInfo(
|
||||||
ii.hbmMask = BITMAP_CopyBitmap(CurIcon->IconInfo.hbmMask);
|
ii.hbmMask = BITMAP_CopyBitmap(CurIcon->IconInfo.hbmMask);
|
||||||
ii.hbmColor = BITMAP_CopyBitmap(CurIcon->IconInfo.hbmColor);
|
ii.hbmColor = BITMAP_CopyBitmap(CurIcon->IconInfo.hbmColor);
|
||||||
|
|
||||||
|
if (pbpp)
|
||||||
|
{
|
||||||
|
PSURFACE psurfBmp;
|
||||||
|
|
||||||
|
psurfBmp = SURFACE_LockSurface(CurIcon->IconInfo.hbmColor);
|
||||||
|
if (psurfBmp)
|
||||||
|
{
|
||||||
|
colorBpp = BitsPerFormat(psurfBmp->SurfObj.iBitmapFormat);
|
||||||
|
SURFACE_UnlockSurface(psurfBmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy fields */
|
/* Copy fields */
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
|
@ -536,21 +541,9 @@ NtUserGetIconInfo(
|
||||||
|
|
||||||
if (pbpp)
|
if (pbpp)
|
||||||
{
|
{
|
||||||
PSURFACE psurfBmp;
|
|
||||||
int colorBpp = 0;
|
|
||||||
|
|
||||||
ProbeForWrite(pbpp, sizeof(DWORD), 1);
|
ProbeForWrite(pbpp, sizeof(DWORD), 1);
|
||||||
|
*pbpp = colorBpp;
|
||||||
psurfBmp = SURFACE_LockSurface(CurIcon->IconInfo.hbmColor);
|
|
||||||
if (psurfBmp)
|
|
||||||
{
|
|
||||||
colorBpp = BitsPerFormat(psurfBmp->SurfObj.iBitmapFormat);
|
|
||||||
SURFACE_UnlockSurface(psurfBmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlCopyMemory(pbpp, &colorBpp, sizeof(DWORD));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
|
@ -564,13 +557,12 @@ NtUserGetIconInfo(
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
|
|
||||||
UserDereferenceObject(CurIcon);
|
UserDereferenceObject(CurIcon);
|
||||||
ObDereferenceObject(WinSta);
|
|
||||||
RETURN(Ret);
|
|
||||||
|
|
||||||
CLEANUP:
|
leave:
|
||||||
DPRINT("Leave NtUserGetIconInfo, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetIconInfo, ret=%i\n", Ret);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
|
||||||
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue