Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. ixinfo.c
  5. Abstract:
  6. Author:
  7. Ken Reneris (kenr) 08-Aug-1994
  8. Environment:
  9. Kernel mode only.
  10. Revision History:
  11. --*/
  12. #include "halp.h"
  13. #include "pcmp_nt.inc"
  14. extern ULONG HalpPerfInterruptHandler;
  15. static HANDLE HalpProcessId = NULL;
  16. #ifdef ALLOC_PRAGMA
  17. #pragma alloc_text(PAGE,HalpSetSystemInformation)
  18. #endif
  19. NTSTATUS
  20. HalpSetSystemInformation (
  21. IN HAL_SET_INFORMATION_CLASS InformationClass,
  22. IN ULONG BufferSize,
  23. IN PVOID Buffer
  24. )
  25. {
  26. PAGED_CODE();
  27. switch (InformationClass) {
  28. case HalProfileSourceInterruptHandler:
  29. //
  30. // Set ISR handler for PerfVector
  31. //
  32. if (!(HalpFeatureBits & HAL_PERF_EVENTS)) {
  33. return STATUS_UNSUCCESSFUL;
  34. }
  35. //
  36. // Accept the interrupt handler if no other process
  37. // has already hooked the interrupt or if we are in
  38. // the context of the process that already hooked it.
  39. //
  40. if (HalpProcessId == NULL) {
  41. HalpPerfInterruptHandler = *((PULONG) Buffer);
  42. if (HalpPerfInterruptHandler != 0) {
  43. HalpProcessId = PsGetCurrentProcessId();
  44. }
  45. } else if (HalpProcessId == PsGetCurrentProcessId()) {
  46. HalpPerfInterruptHandler = *((PULONG) Buffer);
  47. if (HalpPerfInterruptHandler == 0) {
  48. HalpProcessId = NULL;
  49. }
  50. } else {
  51. return STATUS_UNSUCCESSFUL;
  52. }
  53. return STATUS_SUCCESS;
  54. }
  55. return HaliSetSystemInformation (InformationClass, BufferSize, Buffer);
  56. }