mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 11:33:31 +08:00
[NTUSER] accelerator.c: Don't use RETURN() macro (#6166)
This commit is contained in:
parent
bbe6b07612
commit
95657698e7
@ -174,8 +174,7 @@ NtUserCopyAcceleratorTable(
|
|||||||
ULONG EntriesCount)
|
ULONG EntriesCount)
|
||||||
{
|
{
|
||||||
PACCELERATOR_TABLE Accel;
|
PACCELERATOR_TABLE Accel;
|
||||||
ULONG Ret;
|
ULONG Ret = 0;
|
||||||
DECLARE_RETURN(int);
|
|
||||||
|
|
||||||
TRACE("Enter NtUserCopyAcceleratorTable\n");
|
TRACE("Enter NtUserCopyAcceleratorTable\n");
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
@ -183,21 +182,20 @@ NtUserCopyAcceleratorTable(
|
|||||||
Accel = UserGetAccelObject(hAccel);
|
Accel = UserGetAccelObject(hAccel);
|
||||||
if (!Accel)
|
if (!Accel)
|
||||||
{
|
{
|
||||||
RETURN(0);
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If Entries is NULL return table size */
|
/* If Entries is NULL return table size */
|
||||||
if (!Entries)
|
if (!Entries)
|
||||||
{
|
{
|
||||||
RETURN(Accel->Count);
|
Ret = Accel->Count;
|
||||||
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't overrun */
|
/* Don't overrun */
|
||||||
if (Accel->Count < EntriesCount)
|
if (Accel->Count < EntriesCount)
|
||||||
EntriesCount = Accel->Count;
|
EntriesCount = Accel->Count;
|
||||||
|
|
||||||
Ret = 0;
|
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
ProbeForWrite(Entries, EntriesCount*sizeof(Entries[0]), 4);
|
ProbeForWrite(Entries, EntriesCount*sizeof(Entries[0]), 4);
|
||||||
@ -216,12 +214,10 @@ NtUserCopyAcceleratorTable(
|
|||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
RETURN(Ret);
|
Exit:
|
||||||
|
TRACE("Leave NtUserCopyAcceleratorTable, ret=%lu\n", Ret);
|
||||||
CLEANUP:
|
|
||||||
TRACE("Leave NtUserCopyAcceleratorTable, ret=%i\n", _ret_);
|
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
HACCEL
|
HACCEL
|
||||||
@ -234,7 +230,7 @@ NtUserCreateAcceleratorTable(
|
|||||||
HACCEL hAccel;
|
HACCEL hAccel;
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
DECLARE_RETURN(HACCEL);
|
HACCEL Ret = NULL;
|
||||||
PTHREADINFO pti;
|
PTHREADINFO pti;
|
||||||
|
|
||||||
TRACE("Enter NtUserCreateAcceleratorTable(Entries %p, EntriesCount %u)\n",
|
TRACE("Enter NtUserCreateAcceleratorTable(Entries %p, EntriesCount %u)\n",
|
||||||
@ -244,7 +240,7 @@ NtUserCreateAcceleratorTable(
|
|||||||
if (!Entries || EntriesCount <= 0)
|
if (!Entries || EntriesCount <= 0)
|
||||||
{
|
{
|
||||||
SetLastNtError(STATUS_INVALID_PARAMETER);
|
SetLastNtError(STATUS_INVALID_PARAMETER);
|
||||||
RETURN( (HACCEL) NULL );
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
pti = PsGetCurrentThreadWin32Thread();
|
||||||
@ -259,7 +255,7 @@ NtUserCreateAcceleratorTable(
|
|||||||
if (Accel == NULL)
|
if (Accel == NULL)
|
||||||
{
|
{
|
||||||
SetLastNtError(STATUS_NO_MEMORY);
|
SetLastNtError(STATUS_NO_MEMORY);
|
||||||
RETURN( (HACCEL) NULL );
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
Accel->Count = EntriesCount;
|
Accel->Count = EntriesCount;
|
||||||
@ -269,7 +265,7 @@ NtUserCreateAcceleratorTable(
|
|||||||
UserDereferenceObject(Accel);
|
UserDereferenceObject(Accel);
|
||||||
UserDeleteObject(hAccel, TYPE_ACCELTABLE);
|
UserDeleteObject(hAccel, TYPE_ACCELTABLE);
|
||||||
SetLastNtError(STATUS_NO_MEMORY);
|
SetLastNtError(STATUS_NO_MEMORY);
|
||||||
RETURN( (HACCEL) NULL);
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
@ -307,7 +303,7 @@ NtUserCreateAcceleratorTable(
|
|||||||
UserDereferenceObject(Accel);
|
UserDereferenceObject(Accel);
|
||||||
UserDeleteObject(hAccel, TYPE_ACCELTABLE);
|
UserDeleteObject(hAccel, TYPE_ACCELTABLE);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
RETURN( (HACCEL) NULL);
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Save HandleTable in a list somewhere so we can clean it up again */
|
/* FIXME: Save HandleTable in a list somewhere so we can clean it up again */
|
||||||
@ -315,13 +311,13 @@ NtUserCreateAcceleratorTable(
|
|||||||
/* Release the extra reference (UserCreateObject added 2 references) */
|
/* Release the extra reference (UserCreateObject added 2 references) */
|
||||||
UserDereferenceObject(Accel);
|
UserDereferenceObject(Accel);
|
||||||
|
|
||||||
RETURN(hAccel);
|
Ret = hAccel;
|
||||||
|
|
||||||
CLEANUP:
|
Exit:
|
||||||
TRACE("Leave NtUserCreateAcceleratorTable(Entries %p, EntriesCount %u) = %p\n",
|
TRACE("Leave NtUserCreateAcceleratorTable(Entries %p, EntriesCount %u) = %p\n",
|
||||||
Entries, EntriesCount, _ret_);
|
Entries, EntriesCount, Ret);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
@ -345,7 +341,7 @@ NtUserDestroyAcceleratorTable(
|
|||||||
HACCEL hAccel)
|
HACCEL hAccel)
|
||||||
{
|
{
|
||||||
PACCELERATOR_TABLE Accel;
|
PACCELERATOR_TABLE Accel;
|
||||||
DECLARE_RETURN(BOOLEAN);
|
BOOLEAN Ret = FALSE;
|
||||||
|
|
||||||
/* FIXME: If the handle table is from a call to LoadAcceleratorTable, decrement it's
|
/* FIXME: If the handle table is from a call to LoadAcceleratorTable, decrement it's
|
||||||
usage count (and return TRUE).
|
usage count (and return TRUE).
|
||||||
@ -355,19 +351,15 @@ NtUserDestroyAcceleratorTable(
|
|||||||
TRACE("NtUserDestroyAcceleratorTable(Table %p)\n", hAccel);
|
TRACE("NtUserDestroyAcceleratorTable(Table %p)\n", hAccel);
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
if (!(Accel = UserGetAccelObject(hAccel)))
|
Accel = UserGetAccelObject(hAccel);
|
||||||
|
if (Accel)
|
||||||
{
|
{
|
||||||
RETURN( FALSE);
|
Ret = UserDestroyAccelTable(Accel);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserDestroyAccelTable(Accel);
|
TRACE("Leave NtUserDestroyAcceleratorTable(Table %p) = %u\n", hAccel, Ret);
|
||||||
|
|
||||||
RETURN( TRUE);
|
|
||||||
|
|
||||||
CLEANUP:
|
|
||||||
TRACE("Leave NtUserDestroyAcceleratorTable(Table %p) = %u\n", hAccel, _ret_);
|
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -382,7 +374,7 @@ NtUserTranslateAccelerator(
|
|||||||
ULONG i;
|
ULONG i;
|
||||||
MSG Message;
|
MSG Message;
|
||||||
USER_REFERENCE_ENTRY AccelRef, WindowRef;
|
USER_REFERENCE_ENTRY AccelRef, WindowRef;
|
||||||
DECLARE_RETURN(int);
|
int Ret = 0;
|
||||||
|
|
||||||
TRACE("NtUserTranslateAccelerator(hWnd %p, hAccel %p, Message %p)\n",
|
TRACE("NtUserTranslateAccelerator(hWnd %p, hAccel %p, Message %p)\n",
|
||||||
hWnd, hAccel, pUnsafeMessage);
|
hWnd, hAccel, pUnsafeMessage);
|
||||||
@ -390,7 +382,7 @@ NtUserTranslateAccelerator(
|
|||||||
|
|
||||||
if (hWnd == NULL)
|
if (hWnd == NULL)
|
||||||
{
|
{
|
||||||
RETURN( 0);
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
@ -401,7 +393,7 @@ NtUserTranslateAccelerator(
|
|||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
SetLastNtError(_SEH2_GetExceptionCode());
|
SetLastNtError(_SEH2_GetExceptionCode());
|
||||||
_SEH2_YIELD(RETURN( 0));
|
_SEH2_YIELD(goto Cleanup);
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
@ -410,13 +402,13 @@ NtUserTranslateAccelerator(
|
|||||||
(Message.message != WM_SYSCHAR) &&
|
(Message.message != WM_SYSCHAR) &&
|
||||||
(Message.message != WM_CHAR))
|
(Message.message != WM_CHAR))
|
||||||
{
|
{
|
||||||
RETURN( 0);
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
Accel = UserGetAccelObject(hAccel);
|
Accel = UserGetAccelObject(hAccel);
|
||||||
if (!Accel)
|
if (!Accel)
|
||||||
{
|
{
|
||||||
RETURN( 0);
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserRefObjectCo(Accel, &AccelRef);
|
UserRefObjectCo(Accel, &AccelRef);
|
||||||
@ -424,7 +416,7 @@ NtUserTranslateAccelerator(
|
|||||||
Window = UserGetWindowObject(hWnd);
|
Window = UserGetWindowObject(hWnd);
|
||||||
if (!Window)
|
if (!Window)
|
||||||
{
|
{
|
||||||
RETURN( 0);
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserRefObjectCo(Window, &WindowRef);
|
UserRefObjectCo(Window, &WindowRef);
|
||||||
@ -435,7 +427,8 @@ NtUserTranslateAccelerator(
|
|||||||
{
|
{
|
||||||
if (co_IntTranslateAccelerator(Window, &Message, &Accel->Table[i]))
|
if (co_IntTranslateAccelerator(Window, &Message, &Accel->Table[i]))
|
||||||
{
|
{
|
||||||
RETURN( 1);
|
Ret = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Undocumented feature... */
|
/* Undocumented feature... */
|
||||||
@ -443,13 +436,11 @@ NtUserTranslateAccelerator(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN( 0);
|
Cleanup:
|
||||||
|
|
||||||
CLEANUP:
|
|
||||||
if (Window) UserDerefObjectCo(Window);
|
if (Window) UserDerefObjectCo(Window);
|
||||||
if (Accel) UserDerefObjectCo(Accel);
|
if (Accel) UserDerefObjectCo(Accel);
|
||||||
|
|
||||||
TRACE("NtUserTranslateAccelerator returns %d\n", _ret_);
|
TRACE("NtUserTranslateAccelerator returns %d\n", Ret);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user