Leaked source code of windows server 2003
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
1.7 KiB

  1. ; DCASM.ASM
  2. ;
  3. ; Created 31-Jul-96 [JonT]
  4. PAGE 60, 255
  5. .MODEL small, pascal
  6. TITLE DCASM.ASM
  7. .386
  8. .DATA
  9. extrn g_dwEntrypoint:DWORD
  10. szName DB 'DCAPVXD ', 0
  11. .CODE
  12. extrn OpenDriver:FAR
  13. extrn CloseDriver:FAR
  14. PUBLIC _OpenDriver
  15. _OpenDriver::
  16. jmp OpenDriver
  17. PUBLIC _CloseDriver
  18. _CloseDriver::
  19. jmp CloseDriver
  20. ; ReturnSel
  21. ; Returns either CS or DS to the C caller
  22. ReturnSel PROC NEAR PASCAL, fCS:WORD
  23. mov ax, ds
  24. cmp fCS, 0
  25. jz RS_Done
  26. mov ax, cs
  27. RS_Done:
  28. ret
  29. ReturnSel ENDP
  30. ; GetVxDEntrypoint
  31. ; Returns device entrypoint in DX:AX or zero on error
  32. GetVxDEntrypoint PROC NEAR PASCAL uses si di
  33. ; Get the entrypoint from the VMM
  34. xor bx, bx
  35. mov ax, 1684h
  36. push ds
  37. pop es
  38. mov di, OFFSET szName
  39. int 2Fh
  40. ; Return entrypoint in EAX
  41. mov dx, es
  42. mov ax, di
  43. ret
  44. GetVxDEntrypoint ENDP
  45. ; SetWin32Event
  46. ; Sets a Win32 event using the VxD
  47. SetWin32Event PROC NEAR PASCAL, pev:DWORD
  48. ; Call the VxD. Note that pev is already a flat pointer
  49. mov ah, 1
  50. mov ecx, pev
  51. call [g_dwEntrypoint]
  52. ret
  53. SetWin32Event ENDP
  54. ; _CloseVxDHandle
  55. ; Calls the VxD to close a VxD handle. This is really torturous
  56. ; since it's just going to call into KERNEL32, but there's no
  57. ; export to do this from ring 3. Go figure.
  58. _CloseVxDHandle PROC FAR PASCAL USES ds, pev:DWORD
  59. mov ax, DGROUP
  60. mov ds, ax
  61. mov ah, 2
  62. mov ecx, pev
  63. call [g_dwEntrypoint]
  64. ret
  65. _CloseVxDHandle ENDP
  66. ; ZeroMemory
  67. ;
  68. ; Since we can't call CRT, does a memset(lp, 0, len)
  69. ZeroMemory PROC NEAR PASCAL USES di, lp:DWORD, len:WORD
  70. les di, lp
  71. xor eax, eax
  72. mov cx, len
  73. shr cx, 2
  74. rep stosd
  75. mov cx, len
  76. and cx, 3
  77. rep stosb
  78. ret
  79. ZeroMemory ENDP
  80. END