Leaked source code of windows server 2003
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.

70 lines
1.1 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. error.c
  5. Abstract:
  6. This module contains the per-thread errormode code.
  7. Author:
  8. Rob Earhart (earhart) 30-Apr-2002
  9. Environment:
  10. User Mode only
  11. Revision History:
  12. --*/
  13. #include <ntos.h>
  14. #include <nt.h>
  15. #include <ntrtl.h>
  16. #include <nturtl.h>
  17. #include <wow64t.h>
  18. NTSTATUS
  19. NTAPI
  20. RtlSetThreadErrorMode(
  21. IN ULONG NewMode,
  22. OUT PULONG OldMode OPTIONAL
  23. )
  24. {
  25. #if defined(BUILD_WOW6432)
  26. PTEB64 Teb = NtCurrentTeb64();
  27. #else
  28. PTEB Teb = NtCurrentTeb();
  29. #endif
  30. if (NewMode & ~(RTL_ERRORMODE_FAILCRITICALERRORS |
  31. RTL_ERRORMODE_NOGPFAULTERRORBOX |
  32. RTL_ERRORMODE_NOOPENFILEERRORBOX)) {
  33. return STATUS_INVALID_PARAMETER_1;
  34. }
  35. if (OldMode) {
  36. *OldMode = Teb->HardErrorMode;
  37. }
  38. Teb->HardErrorMode = NewMode;
  39. return TRUE;
  40. }
  41. ULONG
  42. NTAPI
  43. RtlGetThreadErrorMode(
  44. VOID
  45. )
  46. {
  47. #if defined(BUILD_WOW6432)
  48. return NtCurrentTeb64()->HardErrorMode;
  49. #else
  50. return NtCurrentTeb()->HardErrorMode;
  51. #endif
  52. }