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.

84 lines
2.0 KiB

4 years ago
  1. "\n\
  2. ;\n\
  3. ; Wrap.ASM - i386\n\
  4. ;\n\
  5. ; Copyright(C) 1994 Microsoft Corporation\n\
  6. ; All rights reserved\n\
  7. ;\n\
  8. ; This is the workhorse routine in Wrapper. This routine is jumped\n\
  9. ; to by the ZAPI macros. It calls the __prelude@8 and __postlude@8 routines\n\
  10. ; before and after calling the real API.\n\
  11. ;\n\
  12. \n\
  13. \n\
  14. .386\n\
  15. OPTION CASEMAP:NONE\n\
  16. _TEXT SEGMENT DWORD USE32 PUBLIC 'CODE'\n\
  17. \n\
  18. ASSUME DS:NOTHING, ES:NOTHING, SS:FLAT, FS:NOTHING, GS:NOTHING\n\
  19. \n\
  20. extrn __prelude@8:near\n\
  21. extrn __postlude@8:near\n\
  22. ;\n\
  23. ; _wrapit\n\
  24. ;\n\
  25. ; When _wrapit is hit the stack looks like:\n\
  26. ;\n\
  27. ; -----------\n\
  28. ; EBP->| API ID |\n\
  29. ; -----------\n\
  30. ; +4 ->| Call ESP |\n\
  31. ; -----------\n\
  32. ; +8 ->| Call stack..\n\
  33. \n\
  34. _wrapit:\n\
  35. \n\
  36. ; The Id and ESP simply get passed on\n\
  37. call __prelude@8\n\
  38. \n\
  39. pop edx ; scratch the orignal return address\n\
  40. \n\
  41. ; return from prelude is the address of the routine to\n\
  42. ; call. If not 0 then call it\n\
  43. cmp eax, 0\n\
  44. je _api_done\n\
  45. \n\
  46. call eax\n\
  47. \n\
  48. _api_done: \n\
  49. push eax ; Make room on stack for return address\n\
  50. push esp ; pass pointer to return address\n\
  51. push eax ; pass return value\n\
  52. call __postlude@8\n\
  53. \n\
  54. ret ; continue ....\n\
  55. \n\
  56. \n\
  57. ZAPI MACRO id, APIName\n\
  58. \n\
  59. PUBLIC z&APIName\n\
  60. z&APIName PROC\n\
  61. \n\
  62. push esp ; address of stack\n\
  63. push id ; push the API id\n\
  64. jmp _wrapit ;\n\
  65. \n\
  66. z&APIName ENDP \n\
  67. \n\
  68. ENDM\n\
  69. \n\
  70. \n\
  71. %a ZAPI %i, %A\n\
  72. \n\
  73. PUBLIC _zWrapperNothing@0\n\
  74. _zWrapperNothing@0 PROC\n\
  75. \n\
  76. push esp ; address of stack\n\
  77. push %c ; push the API id\n\
  78. jmp _wrapit ;\n\
  79. \n\
  80. _zWrapperNothing@0 ENDP \n\
  81. \n\
  82. \n\
  83. _TEXT ENDS\n\
  84. END\n"