HalpSetSystemInformation

NTSTATUS __stdcall HalpSetSystemInformation(HAL_SET_INFORMATION_CLASS InformationClass, PVOID Buffer){
  __int64 v2; 
  INT64 *v3; 
  int v4; 
  UINT64 v6; 
  NTSTATUS v7; 
  unsigned __int8 v8; 
  unsigned __int64 v9; 
  unsigned __int8 v10; 
  unsigned __int8 v11; 
  UINT8 v12; 
  v12 = 0;
  v3 = (INT64 *)v2;
  v4 = (int)Buffer;
  switch( InformationClass )
  {
    case HalProfileSourceInterval:
      if( (_DWORD)Buffer == 8 )
        return HalpSetProfileSourceInterval(*(KPROFILE_SOURCE *)v2, (UINT64 *)(v2 + 4));
      return -1073741820;
    case HalProfileSourceInterruptHandler:
      if( (_DWORD)Buffer != 8 )
        return -1073741820;
      if( (HalpFeatureBits & 1) == 0 )
        return -1073741823;
      v7 = 0;
      KeAcquireSpinLockRaiseToDpc(&HalpPerfInterruptHandlerRegistrationLock, (UINT64)Buffer);
      v9 = v11;
      if( qword_140CF4F80 )
      {
        if( (VOID *)qword_140CF4F80 == PsGetCurrentThreadProcessId() )
        {
          HalpPerfInterruptHandler = (__int64(__fastcall *)(_QWORD))*v3;
          if( !HalpPerfInterruptHandler )
            qword_140CF4F80 = 0i64;
        }
        else
        {
          v7 = -1073741823;
        }
      }
      else
      {
        HalpPerfInterruptHandler = (__int64(__fastcall *)(_QWORD))*v3;
        if( HalpPerfInterruptHandler )
          qword_140CF4F80 = (__int64)PsGetCurrentThreadProcessId();
      }
      goto LABEL_45;
    case HalProfileSourceTimerHandler:
      if( (_DWORD)Buffer != 8 )
        return -1073741820;
      v7 = 0;
      KeAcquireSpinLockRaiseToDpc(&HalpPerfInterruptHandlerRegistrationLock, (UINT64)Buffer);
      v9 = v10;
      if( !qword_140CF4F70 )
      {
        HalpTimerSetProfilingHandler(*v3);
        if( HalpTimerGetProfilingHandler() )
          qword_140CF4F70 = (__int64)PsGetCurrentThreadProcessId();
        goto LABEL_45;
      }
      if( (VOID *)qword_140CF4F70 == PsGetCurrentThreadProcessId() )
      {
        HalpTimerSetProfilingHandler(*v3);
        if( !HalpTimerGetProfilingHandler() )
          qword_140CF4F70 = 0i64;
        goto LABEL_45;
      }
      goto LABEL_33;
    case HalSetProcessorTraceInterruptHandler:
      if( !HalpGetCpuInfo(0i64, 0i64, 0i64, &v12) || v12 != 2 )
        return -1073741637;
      if( v4 != 8 )
        return -1073741820;
      if( (HalpFeatureBits & 0x41) != 65 )
        return -1073741637;
      v7 = 0;
      KeAcquireSpinLockRaiseToDpc(&HalpPerfInterruptHandlerRegistrationLock, v6);
      v9 = v8;
      if( !qword_140CF4F78 )
      {
        HalpProcessorTraceInterruptHandler = (__int64(__fastcall *)(_QWORD))*v3;
        if( HalpProcessorTraceInterruptHandler )
          qword_140CF4F78 = (__int64)PsGetCurrentThreadProcessId();
        goto LABEL_45;
      }
      if( (VOID *)qword_140CF4F78 == PsGetCurrentThreadProcessId() )
      {
        HalpProcessorTraceInterruptHandler = (__int64(__fastcall *)(_QWORD))*v3;
        if( !HalpProcessorTraceInterruptHandler )
          qword_140CF4F78 = 0i64;
        goto LABEL_45;
      }
LABEL_33:
      v7 = -1073741823;
LABEL_45:
      KxReleaseSpinLock(&HalpPerfInterruptHandlerRegistrationLock);
      __writecr8(v9);
      return v7;
  }
  if( InformationClass != HalProfileSourceAdd )
  {
    if( InformationClass != HalProfileSourceRemove )
      return HaliSetSystemInformation(InformationClass, Buffer);
    if( (_DWORD)Buffer == 176 )
      return(*((__int64(__fastcall **)())HalpProfileInterface[0] + 11))();
    return -1073741820;
  }
  if( (unsigned int)((_DWORD)Buffer - 192) > 0x1F6 )
    return -1073741820;
  return(*((__int64(__fastcall **)(__int64, _QWORD))HalpProfileInterface[0] + 10))(v2, 0i64);
}

Referenced by:

No references.