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.

111 lines
3.6 KiB

  1. /*** unasm.h - Unassembler Private Definitions
  2. *
  3. * Copyright (c) 1996,1997 Microsoft Corporation
  4. * Author: Michael Tsang (MikeTs)
  5. * Created 09/05/96
  6. *
  7. * MODIFICATION HISTORY
  8. */
  9. #ifndef _UNASM_H
  10. #define _UNASM_H
  11. #ifdef _UNASM_LIB
  12. //
  13. // Constant definitions
  14. //
  15. #ifndef MODNAME
  16. #define MODNAME "UnAsm"
  17. #endif
  18. // Error codes
  19. #define ASLERR_NONE 0
  20. #define ASLERR_OUT_OF_MEM -1
  21. #define ASLERR_OPEN_FILE -2
  22. #define ASLERR_SEEK_FILE -3
  23. #define ASLERR_READ_FILE -4
  24. #define ASLERR_GET_TABLE -5
  25. #define ASLERR_CHECKSUM -6
  26. #define ASLERR_INVALID_OPCODE -7
  27. #define ASLERR_INTERNAL_ERROR -8
  28. #define ASLERR_NAME_TOO_LONG -9
  29. #define ASLERR_NSOBJ_NOT_FOUND -10
  30. #define ASLERR_INVALID_NAME -11
  31. #define ASLERR_INVALID_ARGTYPE -12
  32. #define ASLERR_INVALID_OBJTYPE -13
  33. #define ASLERR_NSOBJ_EXIST -14
  34. // gdwfASL flags
  35. #define ASLF_UNASM 0x00000001
  36. #define ASLF_GENASM 0x00000002
  37. #define ASLF_GENSRC 0x00000004
  38. //
  39. // Imported data
  40. //
  41. extern DWORD gdwfASL;
  42. extern PNSOBJ gpnsNameSpaceRoot;
  43. extern PNSOBJ gpnsCurrentScope;
  44. extern PNSOBJ gpnsCurrentOwner;
  45. extern PSZ gpszAMLFile;
  46. extern PSZ gpszTabSig;
  47. #endif //ifdef _UNASM_LIB
  48. #ifndef MEMALLOC
  49. #define MEMALLOC malloc
  50. #endif
  51. #ifndef MEMFREE
  52. #define MEMFREE free
  53. #endif
  54. //
  55. // Type definitions
  56. //
  57. typedef int (*PFNPRINT)(PVOID, PSZ, ...);
  58. //
  59. // Local function prototypes
  60. //
  61. int LOCAL UnAsmHeader(PSZ pszAMLName, PDESCRIPTION_HEADER pdh,
  62. PFNPRINT pfnPrint, PVOID pv);
  63. VOID LOCAL DumpBytes(PBYTE pb, DWORD dwLen, PFNPRINT pfnPrint, PVOID pv);
  64. VOID LOCAL DumpCode(PBYTE pbOp, PFNPRINT pfnPrint, PVOID pv);
  65. VOID LOCAL PrintIndent(int iLevel, PFNPRINT pfnPrint, PVOID pv);
  66. BYTE LOCAL FindOpClass(BYTE bOp, POPMAP pOpTable);
  67. PASLTERM LOCAL FindOpTerm(DWORD dwOpcode);
  68. PASLTERM LOCAL FindKeywordTerm(char cKWGroup, BYTE bDate);
  69. int LOCAL UnAsmOpcode(PBYTE *ppbOp, PFNPRINT pfnPrint, PVOID pv);
  70. int LOCAL UnAsmDataObj(PBYTE *ppbOp, PFNPRINT pfnPrint, PVOID pv);
  71. int LOCAL UnAsmNameObj(PBYTE *ppbOp, PFNPRINT pfnPrint, PVOID pv, PNSOBJ *ppns,
  72. char c);
  73. int LOCAL ParseNameTail(PBYTE *ppbOp, PSZ pszBuff, int iLen);
  74. int LOCAL UnAsmTermObj(PASLTERM pterm, PBYTE *ppbOp, PFNPRINT pfnPrint,
  75. PVOID pv);
  76. int LOCAL UnAsmSuperName(PBYTE *ppbOp, PFNPRINT pfnPrint, PVOID pv);
  77. int LOCAL UnAsmArgs(PSZ pszUnAsmArgTypes, PSZ pszArgActions, DWORD dwTermData,
  78. PBYTE *ppbOp, PNSOBJ *ppns, PFNPRINT pfnPrint, PVOID pv);
  79. DWORD LOCAL ParsePackageLen(PBYTE *ppbOp, PBYTE *ppbOpNext);
  80. int LOCAL UnAsmDataList(PBYTE *ppbOp, PBYTE pbEnd, PFNPRINT pfnPrint, PVOID pv);
  81. int LOCAL UnAsmPkgList(PBYTE *ppbOp, PBYTE pbEnd, PFNPRINT pfnPrint, PVOID pv);
  82. int LOCAL UnAsmFieldList(PBYTE *ppbOp, PBYTE pbEnd, PFNPRINT pfnPrint,
  83. PVOID pv);
  84. int LOCAL UnAsmField(PBYTE *ppbOp, PFNPRINT pfnPrint, PVOID pv,
  85. PDWORD pdwBitPos);
  86. int LOCAL CreateObject(PTOKEN ptoken, PSZ pszName, char c, PNSOBJ *ppns);
  87. int LOCAL CreateScopeObj(PSZ pszName, PNSOBJ *ppns);
  88. BYTE LOCAL ComputeDataChkSum(PBYTE pb, DWORD dwLen);
  89. //
  90. // Exported function prototypes
  91. //
  92. int LOCAL UnAsmFile(PSZ pszAMLName, PFNPRINT pfnPrint, PVOID pv);
  93. int LOCAL BuildNameSpace(PSZ pszAMLName, DWORD dwAddr, PBYTE pb);
  94. int LOCAL UnAsmAML(PSZ pszAMLName, DWORD dwAddr, PBYTE pb, PFNPRINT pfnPrint,
  95. PVOID pv);
  96. int LOCAL UnAsmScope(PBYTE *ppbOp, PBYTE pbEnd, PFNPRINT pfnPrint, PVOID pv);
  97. #endif //ifndef _UNASM_H