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.

195 lines
4.3 KiB

  1. page ,132
  2. ;-----------------------------Module-Header-----------------------------;
  3. ; Module Name: DRVR31.ASM - Installable driver code.
  4. ;
  5. ; all this code does is pass any installable driver API on to
  6. ; win 3.1 USER.
  7. ;
  8. ; Created: 28-08-91
  9. ; Author: Todd Laney [ToddLa]
  10. ;
  11. ; Copyright (c) 1984-1991 Microsoft Corporation
  12. ;
  13. ;-----------------------------------------------------------------------;
  14. ?PLM = 1
  15. ?WIN = 0
  16. PMODE = 1
  17. .xlist
  18. include cmacros.inc
  19. include windows.inc
  20. .list
  21. ;
  22. ; these are the USER driver interface functions
  23. ;
  24. externFP OpenDriver ; USER
  25. externFP CloseDriver ; USER
  26. externFP GetDriverModuleHandle ; USER
  27. externFP SendDriverMessage ; USER
  28. externFP DefDriverProc ; USER
  29. ifdef DEBUG
  30. externFP GetModuleFileName ; KERNEL
  31. externFP _dprintf ; COMM.ASM
  32. endif
  33. ; The following structure should be used to access high and low
  34. ; words of a DWORD. This means that "word ptr foo[2]" -> "foo.hi".
  35. LONG struc
  36. lo dw ?
  37. hi dw ?
  38. LONG ends
  39. FARPOINTER struc
  40. off dw ?
  41. sel dw ?
  42. FARPOINTER ends
  43. ifndef SEGNAME
  44. SEGNAME equ <_TEXT>
  45. endif
  46. createSeg %SEGNAME, CodeSeg, word, public, CODE
  47. sBegin CodeSeg
  48. assumes cs,CodeSeg
  49. assumes ds,nothing
  50. assumes es,nothing
  51. ;-----------------------------------------------------------------------;
  52. ;-----------------------------------------------------------------------;
  53. assumes ds,nothing
  54. assumes es,nothing
  55. ifdef DEBUG
  56. szSuccess:
  57. db "MMSYSTEM: DrvOpen(%ls) (%ls)", 13,10,0
  58. szFailed:
  59. db "MMSYSTEM: DrvOpen(%ls) *failed*", 13,10,0
  60. cProc DrvOpen, <FAR, PUBLIC, PASCAL, LOADDS>, <>
  61. ParmD szDriverName
  62. ParmD szSectionName
  63. ParmD dw2
  64. LocalV ach,128
  65. cBegin
  66. cCall OpenDriver, <szDriverName, szSectionName, dw2>
  67. push ax
  68. lea bx,szFailed
  69. or ax,ax
  70. jz DrvOpenFailed
  71. cCall GetDriverModuleHandle, <ax>
  72. lea bx,ach
  73. cCall GetModuleFileName,<ax, ss,bx, 128>
  74. lea bx,szSuccess
  75. DrvOpenFailed:
  76. lea ax,ach
  77. push ss ; ach
  78. push ax
  79. push szDriverName.sel ; szDriverName
  80. push szDriverName.off
  81. push cs ; szFormat
  82. push bx
  83. call _dprintf ; dprintf(szFormat, szDriverName, ach)
  84. add sp,6*2
  85. DrvOpenExit:
  86. pop ax ; return hdrv to caller
  87. DrvOpenExitNow:
  88. cEnd
  89. else ; DEBUG
  90. cProc DrvOpen, <FAR, PUBLIC, PASCAL>, <>
  91. ; ParmD szDriverName
  92. ; ParmD szSectionName
  93. ; ParmD dw2
  94. cBegin nogen
  95. jmp OpenDriver
  96. cEnd nogen
  97. endif ; DEBUG
  98. ;-----------------------------------------------------------------------;
  99. ;-----------------------------------------------------------------------;
  100. assumes ds,nothing
  101. assumes es,nothing
  102. cProc DrvClose, <FAR, PUBLIC, PASCAL>, <>
  103. ; ParmW hDriver
  104. ; ParmD dw1
  105. ; ParmD dw2
  106. cBegin nogen
  107. jmp CloseDriver
  108. cEnd nogen
  109. ;-----------------------------------------------------------------------;
  110. ;-----------------------------------------------------------------------;
  111. assumes ds,nothing
  112. assumes es,nothing
  113. cProc DrvGetModuleHandle, <FAR, PUBLIC, PASCAL>, <>
  114. ; ParmW hDriver
  115. cBegin nogen
  116. jmp GetDriverModuleHandle
  117. cEnd nogen
  118. ;-----------------------------------------------------------------------;
  119. ;-----------------------------------------------------------------------;
  120. assumes ds,nothing
  121. assumes es,nothing
  122. cProc DrvSendMessage, <FAR, PUBLIC, PASCAL>, <>
  123. ; ParmW hDriver
  124. ; ParmW message
  125. ; ParmD dw1
  126. ; ParmD dw2
  127. cBegin nogen
  128. jmp SendDriverMessage
  129. cEnd nogen
  130. ;-----------------------------------------------------------------------;
  131. ;-----------------------------------------------------------------------;
  132. assumes ds,nothing
  133. assumes es,nothing
  134. cProc DrvDefDriverProc, <FAR, PUBLIC, PASCAL>, <>
  135. ; ParmD dwDriver
  136. ; ParmW hDriver
  137. ; ParmW message
  138. ; ParmD dw1
  139. ; ParmD dw2
  140. cBegin nogen
  141. jmp DefDriverProc
  142. cEnd nogen
  143. sEnd
  144. end