Windows NT 4.0 source code leak
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.

121 lines
2.0 KiB

4 years ago
  1. //++
  2. //
  3. // Copyright (c) 1990 Microsoft Corporation
  4. //
  5. // Module Name:
  6. //
  7. // debug3.c
  8. //
  9. // Abstract:
  10. //
  11. // This module implements architecture specific functions to support debugging NT.
  12. //
  13. // Author:
  14. //
  15. // Steven R. Wood (stevewo) 3-Aug-1989
  16. //
  17. // Environment:
  18. //
  19. // Any mode.
  20. //
  21. // Revision History:
  22. //
  23. //--
  24. #include "stdarg.h"
  25. #include "stdio.h"
  26. #include "string.h"
  27. #include "ntrtlp.h"
  28. //
  29. // Prototype for local procedure
  30. //
  31. NTSTATUS
  32. DebugService(
  33. ULONG ServiceClass,
  34. PVOID Arg1,
  35. PVOID Arg2
  36. );
  37. VOID _fptrap() {};
  38. NTSTATUS
  39. DebugPrint(
  40. IN PSTRING Output
  41. )
  42. {
  43. return DebugService( BREAKPOINT_PRINT, Output, 0 );
  44. }
  45. ULONG
  46. DebugPrompt(
  47. IN PSTRING Output,
  48. IN PSTRING Input
  49. )
  50. {
  51. return DebugService( BREAKPOINT_PROMPT, Output, Input );
  52. }
  53. VOID
  54. DebugLoadImageSymbols(
  55. IN PSTRING FileName,
  56. IN PKD_SYMBOLS_INFO SymbolInfo
  57. )
  58. {
  59. DebugService( BREAKPOINT_LOAD_SYMBOLS, FileName, SymbolInfo );
  60. }
  61. VOID
  62. DebugUnLoadImageSymbols(
  63. IN PSTRING FileName,
  64. IN PKD_SYMBOLS_INFO SymbolInfo
  65. )
  66. {
  67. DebugService( BREAKPOINT_UNLOAD_SYMBOLS, FileName, SymbolInfo );
  68. }
  69. NTSTATUS
  70. DebugService(
  71. ULONG ServiceClass,
  72. PVOID Arg1,
  73. PVOID Arg2
  74. )
  75. //++
  76. //
  77. // Routine Description:
  78. //
  79. // Allocate an ExceptionRecord, fill in data to allow exception
  80. // dispatch code to do the right thing with the service, and
  81. // call RtlRaiseException (NOT ExRaiseException!!!).
  82. //
  83. // Arguments:
  84. // ServiceClass - which call is to be performed
  85. // Arg1 - generic first argument
  86. // Arg2 - generic second argument
  87. //
  88. // Returns:
  89. // Whatever the exception returns in eax
  90. //
  91. //--
  92. {
  93. NTSTATUS RetValue;
  94. _asm {
  95. mov eax, ServiceClass
  96. mov ecx, Arg1
  97. mov edx, Arg2
  98. int 2dh ; Raise exception
  99. int 3 ; DO NOT REMOVE (See KiDebugService)
  100. mov RetValue, eax
  101. }
  102. return RetValue;
  103. }