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.

90 lines
1.4 KiB

4 years ago
  1. ;;--------------------------------------------------------------------
  2. ;;
  3. ;; Microsoft OS/2 LAN Manager
  4. ;; Copyright(c) Microsoft Corp., 1991
  5. ;;
  6. ;;------------------------------------------------------------------
  7. ;;
  8. ;;Description :
  9. ;;
  10. ;;This file contains functions create thunks for DOS DLLs. Thunks are
  11. ;;needed if the code doesn't support SS!=DS. The thunks load a new
  12. ;;SS and DS, and then copy the parms to the new stack.
  13. ;;
  14. ;;History :
  15. ;;
  16. ;;stevez 07-16-91 First bits into the bucket.
  17. ifndef Stack
  18. cbStack equ 512
  19. else
  20. cbStack equ Stack
  21. endif
  22. .model large, c
  23. .data
  24. myStack dw cbStack/2 dup (?)
  25. oldDS dw 0
  26. .code
  27. thunk Macro Name, cParms
  28. extrn pascal _&Name:far
  29. Name Proc pascal
  30. ; Use DS:Si to point to last argument on the stack.
  31. push si
  32. mov si, sp
  33. add si, 4+cParms*2
  34. ; Set up my own stack Ss:Sp.
  35. mov Cx,@Data
  36. mov ss,Cx
  37. mov sp,offset myStack + cbStack
  38. ; Copy the parms onto the new stack.
  39. std
  40. rept cParms
  41. lodsw
  42. push Ax
  43. endm
  44. cld
  45. ; Save orginal Ds and switch to new DS
  46. mov ss:[oldDs],ds
  47. mov ds,Cx
  48. call _&Name
  49. ; Restore orginal DS and stack (SS:Sp).
  50. mov Cx,[oldDs]
  51. mov Ds,Cx
  52. mov Ss,Cx
  53. lea Sp,[Si-4]
  54. pop si
  55. retf
  56. Name endp
  57. endm
  58. thunk cOpen, 6
  59. thunk cClose, 2
  60. thunk cRead, 2
  61. thunk cWrite, 5
  62. ifdef WRITEREAD
  63. thunk cWriteRead, 6
  64. endif
  65. end