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.

95 lines
3.7 KiB

4 years ago
  1. /********************************** module *********************************/
  2. /* */
  3. /* disasm */
  4. /* disassembler for CodeView */
  5. /* */
  6. /***************************************************************************/
  7. /* */
  8. /* @ Purpose: To disassemble one 80x86 instruction at address loc and */
  9. /* return the resulting string in dst. */
  10. /* */
  11. /* @ Functions included: */
  12. /* */
  13. /* void DIdisasm(ADDR *loc, int option,char *dst, struct ea *ea) */
  14. /* */
  15. /* */
  16. /* @ Author: Gerd Immeyer @ Version: */
  17. /* */
  18. /* @ Creation Date: 10.19.89 @ Modification Date: */
  19. /* */
  20. /* 27-Oct-1992 BobDay Gutted most of the code since it was duplicated */
  21. /* in 86DIS.C */
  22. /* */
  23. /***************************************************************************/
  24. #include "ntsdp.h"
  25. #include "ntreg.h"
  26. #include <stddef.h>
  27. #include <string.h>
  28. // internal function definitions
  29. BOOLEAN disasm(PADDR, PUCHAR, BOOLEAN);
  30. void OutputHexString(char **, char *, int);
  31. void OutputHexValue(char **, char *, int, int);
  32. void OutputHexCode(char **, char *, int);
  33. void OutputString(char **, char *);
  34. void OutputSymbol(char **, char *, int, int);
  35. void GetNextOffset(PADDR, BOOLEAN);
  36. void OutputHexAddr(PUCHAR *, PADDR);
  37. USHORT GetSegRegValue(int);
  38. /**** disasm - disassemble an 80x86/80x87 instruction
  39. *
  40. * Input:
  41. * pOffset = pointer to offset to start disassembly
  42. * fEAout = if set, include EA (effective address)
  43. *
  44. * Output:
  45. * pOffset = pointer to offset of next instruction
  46. * pchDst = pointer to result string
  47. *
  48. ***************************************************************************/
  49. BOOLEAN disasm (PADDR paddr, PUCHAR pchDst, BOOLEAN fEAout)
  50. {
  51. return( X86disasm(paddr, pchDst, fEAout) );
  52. }
  53. // DIdoModrm() now exists in 86DIS.C
  54. // OutputHexValue() now exists in 86DIS.C
  55. // OutputHexString() now exists in 86DIS.C
  56. // OutputHexCode() now exists in 86DIS.C
  57. // OutputString() no longer exists. It was renamed to X86OutputString in 86DIS.C
  58. // OutputSymbol() now exists in 86DIS.C
  59. /*** GetNextOffset - compute offset for trace or step
  60. *
  61. * Purpose:
  62. * From a limited disassembly of the instruction pointed
  63. * by the FIR register, compute the offset of the next
  64. * instruction for either a trace or step operation.
  65. *
  66. * Input:
  67. * fStep - TRUE if step offset returned - FALSE for trace offset
  68. *
  69. * Returns:
  70. * step or trace offset if input is TRUE or FALSE, respectively
  71. * -1 returned for trace flag to be used
  72. *
  73. *************************************************************************/
  74. void GetNextOffset (PADDR pcaddr, BOOLEAN fStep)
  75. {
  76. X86GetNextOffset(pcaddr, fStep);
  77. }
  78. // OutputHexAddr() now exists in 86DIS.C
  79. // GetSegRegValue() now exists in 86DIS.C
  80. void GetReturnAddress (PADDR retaddr)
  81. {
  82. X86GetReturnAddress(retaddr);
  83. }