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.

233 lines
7.0 KiB

  1. ;/*
  2. ; * Microsoft Confidential
  3. ; * Copyright (C) Microsoft Corporation 1991
  4. ; * All Rights Reserved.
  5. ; */
  6. ;========================================================
  7. COMMENT #
  8. DEVICE.ASM
  9. =================================================
  10. Device driver to activate the version table in
  11. MS-DOS 5.0. Upon initialization the driver will
  12. set the DWORD PTR in the DOS data area at offset
  13. 05dh to point to the version table in the device
  14. driver and also calculates the minimum install
  15. size needed to include only the valid entries
  16. in the default version table.
  17. ================================================
  18. johnhe - 12/30/90
  19. END COMMENT #
  20. ; =======================================================
  21. INCLUDE VERSIONA.INC
  22. CMD EQU 2 ; Command field offset in packet
  23. STATUS EQU 3 ; Return status field offset
  24. DEV_LEN EQU 14 ; Device length field offset
  25. DOS_TABLE EQU 5dh ; Lie table ptr offset in dos data
  26. TABLE_LEN EQU 2048 ; Max size of lie table
  27. ; ====================================================================
  28. A_DEVICE SEGMENT BYTE PUBLIC 'CODE'
  29. ASSUME CS:A_DEVICE, DS:NOTHING, ES:NOTHING
  30. PUBLIC ENTRY
  31. PUBLIC DeviceInit
  32. ; ====================================================================
  33. DeviceHeader:
  34. dw -1,-1
  35. dw 1000000000000000b; Device attributes (character device)
  36. dw Strategy ; Device strategy entry offset
  37. dw Entry ; Device entry offset
  38. db 'SETVERXX'
  39. ExtendedHeader: ; Extended header is used by the
  40. ; SETVER.EXE program to determine
  41. ; where the version table is located
  42. ; within the .EXE file
  43. VerMinor db 0 ; Version 1.0 of Setver
  44. VerMajor db 1 ;
  45. TableOffset dd OFFSET VerList ; Offset of table from device start
  46. TableLength dw TABLE_LEN ; Max table size
  47. PtrSave dd (?) ; Address of device packet
  48. ; ====================================================================
  49. ; ====================================================================
  50. StratProc PROC FAR
  51. Strategy:
  52. mov WORD PTR CS:[PtrSave],BX ; Save device packet for
  53. mov WORD PTR CS:[PtrSave][2],ES ; use on call to dev entry
  54. ret
  55. StratProc ENDP
  56. ; ====================================================================
  57. ; ====================================================================
  58. Entry PROC FAR ; Device driver entry location
  59. push BX
  60. push DS
  61. lds BX,[PtrSave] ; DS:BX --> Cmd structure
  62. mov AL,DS:[BX].CMD ; AL == command from sysinit
  63. cbw
  64. or AX,AX ; Check for init function zero
  65. jnz CmdError ; If not init then error
  66. jmp DeviceInit ; Jmp to initialize device
  67. CmdError:
  68. mov AL,3 ; Return invalid function code
  69. mov AH,10000001b ; Signal error in AH
  70. SetStatus:
  71. mov [BX].Status,AX ; Copy status to packet
  72. pop DS
  73. pop BX
  74. ret
  75. Entry ENDP
  76. ; ====================================================================
  77. ; ====================================================================
  78. SIG db 'PCMN'
  79. TblLen dw TABLE_LEN
  80. ; ====================================================================
  81. ; ====================================================================
  82. ; NTVDM commented out unsupported drivers\apps 19-Aug-1992 Jonle
  83. if 0
  84. db 10,"WIN200.BIN" ,3,40 ; windows 2.x
  85. db 10,"WIN100.BIN" ,3,40 ; win 1.x
  86. db 11,"WINWORD.EXE" ,4,10 ; winword 1.0
  87. db 9, "EXCEL.EXE" ,4,10 ; excel 2.x
  88. db 11,"HITACHI.SYS" ,4,00 ; CDROMS
  89. db 10,"MSCDEX.EXE" ,4,00 ; CDROMS
  90. db 10,"REDIR4.EXE" ,4,00 ; Banyan networks
  91. db 7, "NET.EXE" ,4,00 ; 3+ Open
  92. db 7, "NET.COM" ,3,30 ; IBM PCLP
  93. db 12,"NETWKSTA.EXE" ,4,00 ; 3+ Open
  94. db 12,"DXMA0MOD.SYS" ,3,30 ; Token ring
  95. db 7, "BAN.EXE" ,4,00 ; Banyan
  96. db 7, "BAN.COM" ,4,00 ; Banyan
  97. db 11,"MSREDIR.EXE" ,4,00 ; LanMan
  98. db 9, "METRO.EXE" ,3,31 ; Lotus Metro
  99. db 12,"IBMCACHE.SYS" ,3,40 ; IBM CHACHE Program
  100. db 11,"REDIR40.EXE" ,4,00 ; IBM PCLP 1.3/4 redirector
  101. db 6, "DD.EXE" ,4,01 ; Laplink III software
  102. db 6, "DD.BIN" ,4,01 ; Laplink III software
  103. db 7, "LL3.EXE" ,4,01 ; Laplink III software
  104. db 9, "REDIR.EXE" ,4,00 ; DOS 4 redir
  105. db 9, "SYQ55.SYS" ,4,00 ; Removable SCSII drive from Syquest
  106. db 12,"SSTDRIVE.SYS" ,4,00 ; Columbia SCSI driver
  107. db 8, "ZDRV.SYS" ,4,01 ; Unisys CD-ROM B#4734
  108. db 8, "ZFMT.SYS" ,4,01 ; Unisys CD-ROM B#4734
  109. db 11,"TOPSRDR.EXE" ,4,00 ; TOPS redir Bug 5968
  110. endif
  111. public VerList
  112. VerList db 11,"WINWORD.EXE" ,4,10 ; winword 1.0
  113. db 9, "EXCEL.EXE" ,4,10 ; excel 2.x
  114. db 9, "METRO.EXE" ,3,31 ; Lotus Metro
  115. db 6, "DD.EXE" ,4,01 ; Laplink III software
  116. db 6, "DD.BIN" ,4,01 ; Laplink III software
  117. db 7, "LL3.EXE" ,4,01 ; Laplink III software
  118. db (TABLE_LEN - ($ - VerList)) dup (0)
  119. db 0
  120. ; ====================================================================
  121. ; Device initialization function first determines minimum size the
  122. ; driver needs to be and then sets the DWORD PTR in the DOS data area
  123. ; to the location of the version table.
  124. ; ====================================================================
  125. DeviceInit:
  126. push BX
  127. push CX
  128. mov AH,30h ; Get version
  129. int 21h
  130. pop CX
  131. pop BX
  132. cmp AX,expected_version
  133. je SetupScan
  134. xor AX,AX ; Set end of device to 0
  135. jmp SHORT SetDevEnd
  136. SetupScan:
  137. push SI
  138. push DS
  139. mov AX,CS
  140. mov DS,AX
  141. mov SI, OFFSET VerList ; DS:SI --> Version table
  142. xor AX,AX ; Clear high byte of AX
  143. ScanLoop:
  144. lodsb ; Grab the name length
  145. or AX,AX ; Test for end of the table
  146. jz FoundEnd
  147. inc AX ; Add 2 bytes for the version number
  148. inc AX
  149. add SI,AX ; Make SI so it points to next entry
  150. jmp SHORT ScanLoop
  151. FoundEnd:
  152. mov AX,SI ; AX == Offset of end of table
  153. inc AX ; Need 1 zero byte at end of table
  154. pop DS
  155. pop SI
  156. SetTablePtr:
  157. push BX
  158. push ES
  159. push AX ; Save end of device offset
  160. mov AH,52h ; Get the DOS data segment
  161. int 21h
  162. pop AX ; Restore end of device offset to AX
  163. cli ; Safety measure when altering DOSdata
  164. mov WORD PTR ES:[DOS_TABLE], OFFSET VerList ; Offset of lie table
  165. mov WORD PTR ES:[DOS_TABLE][2],CS ; Segment of lie table
  166. sti
  167. pop ES
  168. pop BX
  169. SetDevEnd:
  170. mov WORD PTR DS:[BX].DEV_LEN,AX ; Set end of driver @ end of list
  171. mov DS:[BX].DEV_LEN[2],CS ; Set device segment
  172. mov AH,00000001b ; Normal status return
  173. jmp SetStatus ; End of init code
  174. ; ====================================================================
  175. A_DEVICE ENDS
  176. ; ====================================================================
  177. END