#pragma alloc_text(INIT, ExpInitializeProfileImplementation)
#endif
-#define TAG_PROFILE TAG('P', 'r', 'o', 'f')
+#define TAG_PROFILE 'forP'
/* GLOBALS *******************************************************************/
PEPROCESS pProcess;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
OBJECT_ATTRIBUTES ObjectAttributes;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
ULONG Log2 = 0;
- PVOID Segment = NULL;
+ ULONG_PTR Segment = 0;
PAGED_CODE();
/* Easy way out */
if (BufferSize < sizeof(ULONG)) return STATUS_INVALID_PARAMETER_7;
/* This will become a segmented profile object */
- Segment = RangeBase;
+ Segment = (ULONG_PTR)RangeBase;
RangeBase = 0;
/* Recalculate the bucket size */
BufferSize,
sizeof(ULONG));
}
- _SEH2_EXCEPT(ExSystemExceptionFilter())
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- /* Bail out if we failed */
- if(!NT_SUCCESS(Status)) return Status;
}
/* Check if a process was specified */
NTSTATUS Status = STATUS_SUCCESS;
/* Check if we were called from user-mode */
- if(PreviousMode != KernelMode)
+ if (PreviousMode != KernelMode)
{
/* Entry SEH Block */
_SEH2_TRY
ProbeForWriteLargeInteger(PerformanceFrequency);
}
}
- _SEH2_EXCEPT(ExSystemExceptionFilter())
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- /* If the pointers are invalid, bail out */
- if(!NT_SUCCESS(Status)) return Status;
}
/* Enter a new SEH Block */
*PerformanceCounter = KeQueryPerformanceCounter(&PerfFrequency);
/* Return Frequency if requested */
- if(PerformanceFrequency) *PerformanceFrequency = PerfFrequency;
+ if (PerformanceFrequency) *PerformanceFrequency = PerfFrequency;
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
+ /* Get the exception code */
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
MmProbeAndLockPages(Profile->Mdl, PreviousMode, IoWriteAccess);
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
- {
- /* Get the exception code */
- Status = _SEH2_GetExceptionCode();
- }
- _SEH2_END;
-
- /* Fail if we raised an exception */
- if (!NT_SUCCESS(Status))
{
/* Release our lock, free the buffer, dereference and return */
KeReleaseMutex(&ExpProfileMutex, FALSE);
ObDereferenceObject(Profile);
ExFreePool(ProfileObject);
- return Status;
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
+ _SEH2_END;
/* Map the pages */
TempLockedBufferAddress = MmMapLockedPages(Profile->Mdl, KernelMode);
PAGED_CODE();
/* Check if we were called from user-mode */
- if(PreviousMode != KernelMode)
+ if (PreviousMode != KernelMode)
{
/* Enter SEH Block */
_SEH2_TRY
/* Validate interval */
ProbeForWriteUlong(Interval);
}
- _SEH2_EXCEPT(ExSystemExceptionFilter())
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- /* If pointer was invalid, bail out */
- if(!NT_SUCCESS(Status)) return Status;
}
/* Query the Interval */
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
+ /* Get the exception code */
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
/* Return Success */
- return STATUS_SUCCESS;
+ return Status;
}
NTSTATUS