mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 15:22:23 +00:00
don't leak a reference to the timer object when copying to the buffer failed in NtQueryTimer() and don't use uninitialized variable in NtSetTimer()
svn path=/trunk/; revision=13556
This commit is contained in:
parent
be2fa40d3e
commit
31a913fde7
1 changed files with 20 additions and 15 deletions
|
@ -483,22 +483,27 @@ NtQueryTimer(IN HANDLE TimerHandle,
|
||||||
/* Check for Success */
|
/* Check for Success */
|
||||||
if(NT_SUCCESS(Status)) {
|
if(NT_SUCCESS(Status)) {
|
||||||
|
|
||||||
/* Return the Basic Information */
|
switch(TimerInformationClass) {
|
||||||
_SEH_TRY {
|
case TimerBasicInformation: {
|
||||||
|
/* Return the Basic Information */
|
||||||
/* FIXME: Interrupt correction based on Interrupt Time */
|
_SEH_TRY {
|
||||||
DPRINT("Returning Information for Timer: %x. Time Remaining: %d\n", Timer, Timer->KeTimer.DueTime.QuadPart);
|
|
||||||
BasicInfo->TimeRemaining.QuadPart = Timer->KeTimer.DueTime.QuadPart;
|
|
||||||
BasicInfo->SignalState = KeReadStateTimer(&Timer->KeTimer);
|
|
||||||
ObDereferenceObject(Timer);
|
|
||||||
|
|
||||||
if(ReturnLength != NULL) {
|
/* FIXME: Interrupt correction based on Interrupt Time */
|
||||||
*ReturnLength = sizeof(TIMER_BASIC_INFORMATION);
|
DPRINT("Returning Information for Timer: %x. Time Remaining: %d\n", Timer, Timer->KeTimer.DueTime.QuadPart);
|
||||||
}
|
BasicInfo->TimeRemaining.QuadPart = Timer->KeTimer.DueTime.QuadPart;
|
||||||
|
BasicInfo->SignalState = KeReadStateTimer(&Timer->KeTimer);
|
||||||
|
|
||||||
|
if(ReturnLength != NULL) {
|
||||||
|
*ReturnLength = sizeof(TIMER_BASIC_INFORMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
} _SEH_HANDLE {
|
||||||
|
Status = _SEH_GetExceptionCode();
|
||||||
|
} _SEH_END;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} _SEH_HANDLE {
|
ObDereferenceObject(Timer);
|
||||||
Status = _SEH_GetExceptionCode();
|
|
||||||
} _SEH_END;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return Status */
|
/* Return Status */
|
||||||
|
@ -517,7 +522,7 @@ NtSetTimer(IN HANDLE TimerHandle,
|
||||||
{
|
{
|
||||||
PETIMER Timer;
|
PETIMER Timer;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
BOOLEAN KillTimer;
|
BOOLEAN KillTimer = FALSE;
|
||||||
BOOLEAN State;
|
BOOLEAN State;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
PETHREAD CurrentThread = PsGetCurrentThread();
|
PETHREAD CurrentThread = PsGetCurrentThread();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue