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.

862 lines
17 KiB

  1. title INT21 - INT 21 handler for scheduler
  2. .xlist
  3. include kernel.inc
  4. include tdb.inc
  5. include pdb.inc
  6. include eems.inc
  7. include kdos.inc
  8. ifdef WOW
  9. include vint.inc
  10. endif
  11. .list
  12. externFP FileCDR_notify
  13. DataBegin
  14. externB PhantArray
  15. externB DOSDrives
  16. externB CurDOSDrive
  17. externW curTDB
  18. DataEnd
  19. assumes DS,NOTHING
  20. sBegin CODE
  21. assumes CS,CODE
  22. ;externNP GrowSFT
  23. externNP PassOnThrough
  24. externNP final_call_for_DOS
  25. externNP real_DOS
  26. externNP MyUpper
  27. externNP Int21Handler
  28. ifdef FE_SB
  29. externNP MyIsDBCSLeadByte ;near call is fine
  30. endif
  31. externFP ResidentFindExeFile
  32. externFP GetModuleHandle
  33. externFP FlushCachedFileHandle
  34. externFP WOWDelFile
  35. public ASSIGNCALL
  36. public NAMETRANS
  37. public DLDRIVECALL1
  38. public DLDRIVECALL2
  39. public XENIXRENAME
  40. public FCBCALL
  41. public PATHDSDXCALL
  42. public PATHDSSICALL
  43. public SetCarryRet
  44. public SetErrorDrvDSDX
  45. ;-----------------------------------------------------------------------;
  46. ; Select_Disk (DOS Call 0Eh) ;
  47. ; ;
  48. ; ;
  49. ; Arguments: ;
  50. ; ;
  51. ; Returns: ;
  52. ; ;
  53. ; Error Returns: ;
  54. ; ;
  55. ; Registers Preserved: ;
  56. ; ;
  57. ; Registers Destroyed: ;
  58. ; ;
  59. ; Calls: ;
  60. ; ;
  61. ; History: ;
  62. ; ;
  63. ; Wed Jan 28, 1987 00:40:48a -by- David N. Weise [dnw] ;
  64. ; Rewrote it. It used to save and restore the current disk inside of ;
  65. ; DOS on task swaps. Now it will restore on demand. ;
  66. ; ;
  67. ; Sat Jan 17, 1987 08:19:27p -by- David N. Weise [davidw] ;
  68. ; Added this nifty comment block. ;
  69. ;-----------------------------------------------------------------------;
  70. assumes ds, nothing
  71. assumes es, nothing
  72. cProc Select_Disk,<PUBLIC,NEAR>
  73. cBegin nogen
  74. SetKernelDS
  75. cmp dl, CurDOSDrive ; Must set if not this!
  76. jne MustSetIt
  77. ; See if it matches saved drive for TDB
  78. cmp [CurTDB], 0 ; See if we have a TDB
  79. je MustSetIt
  80. push es
  81. mov es, [CurTDB]
  82. cmp es:[TDB_sig], TDB_SIGNATURE
  83. jne DeadTDB
  84. push ax
  85. mov al, es:[TDB_Drive]
  86. and al, 7Fh ; Zap save drive flag
  87. cmp al, dl ; Drive the same?
  88. pop ax
  89. pop es
  90. jne MustSetIt ; no, set it
  91. mov al, DOSDrives ; Return number of logical drives
  92. jmp DriveErrorRet ; Well, it really just returns!
  93. DeadTDB:
  94. pop es
  95. MustSetIt:
  96. push dx
  97. inc dx ; A=1
  98. call CheckDriveDL
  99. pop dx
  100. jnc cd_no_drive_check
  101. call SetErrorDLDrv
  102. jmp DriveErrorRet
  103. cEnd nogen
  104. ;-----------------------------------------------------------------------;
  105. ; Change_Dir (DOS Call 3Bh) ;
  106. ; ;
  107. ; ;
  108. ; Arguments: ;
  109. ; ;
  110. ; Returns: ;
  111. ; ;
  112. ; Error Returns: ;
  113. ; ;
  114. ; Registers Preserved: ;
  115. ; ;
  116. ; Registers Destroyed: ;
  117. ; ;
  118. ; Calls: ;
  119. ; ;
  120. ; History: ;
  121. ; ;
  122. ; Wed Jan 28, 1987 00:40:48a -by- David N. Weise [dnw] ;
  123. ; Rewrote it. It used to save and restore the current directory ;
  124. ; on task swaps. Now it will restore on demand. ;
  125. ; ;
  126. ; Sat Jan 17, 1987 08:21:13p -by- David N. Weise [davidw] ;
  127. ; Added this nifty comment block. ;
  128. ;-----------------------------------------------------------------------;
  129. assumes ds, nothing
  130. assumes es, nothing
  131. cProc Change_Dir,<PUBLIC,NEAR>
  132. cBegin nogen
  133. call PathDrvDSDX
  134. jnc cd_no_drive_check ; Drive OK
  135. call SetErrorDrvDSDX
  136. jmp SetCarryRet
  137. cd_no_drive_check:
  138. SetKernelDS
  139. mov ds,CurTDB
  140. UnSetKernelDS
  141. cmp ds:[TDB_sig],TDB_SIGNATURE
  142. jne Change_Dir1
  143. and ds:[TDB_Drive],01111111b ; indicate save needed
  144. Change_Dir1:
  145. jmp PassOnThrough
  146. cEnd nogen
  147. ;-----------------------------------------------------------------------;
  148. ; FileHandleCall (DOS Calls 3Eh,42h,45h,46h,57h,5Ch) ;
  149. ; ;
  150. ; Checks to see if the token in the PDB is 80h. 80h represents a ;
  151. ; file that was closed on a floppy by us in order to prompt for a ;
  152. ; file (see CloseOpenFiles). If the token is 80h then it is set ;
  153. ; to FFh. ;
  154. ; ;
  155. ; Arguments: ;
  156. ; ;
  157. ; Returns: ;
  158. ; ;
  159. ; Error Returns: ;
  160. ; ;
  161. ; Registers Preserved: ;
  162. ; ;
  163. ; Registers Destroyed: ;
  164. ; ;
  165. ; Calls: ;
  166. ; ;
  167. ; History: ;
  168. ; ;
  169. ; Tue Sep 29, 1987 03:30:46p -by- David N. Weise [davidw] ;
  170. ; Changed the special token from FEh to 80h to avoid conflict with ;
  171. ; Novell netware that starts with SFT FEh and counts down. ;
  172. ; ;
  173. ; Tue Apr 28, 1987 11:12:00a -by- Raymond E. Ozzie [-iris-] ;
  174. ; Changed to indirect thru PDB to get JFN under DOS 3.x. ;
  175. ; ;
  176. ; Sat Jan 17, 1987 01:54:54a -by- David N. Weise [davidw] ;
  177. ; Added this nifty comment block. ;
  178. ;-----------------------------------------------------------------------;
  179. assumes ds, nothing
  180. assumes es, nothing
  181. cProc FileHandleCall,<PUBLIC,NEAR>
  182. cBegin nogen
  183. if1
  184. ; %OUT FileHandleCall DISABLED
  185. endif
  186. jmp final_call_for_DOS
  187. cEnd nogen
  188. ;-----------------------------------------------------------------------;
  189. ; Xenix_Status (DOS Call 44h) ;
  190. ; ;
  191. ; ;
  192. ; Arguments: ;
  193. ; ;
  194. ; Returns: ;
  195. ; ;
  196. ; Error Returns: ;
  197. ; ;
  198. ; Registers Preserved: ;
  199. ; ;
  200. ; Registers Destroyed: ;
  201. ; ;
  202. ; Calls: ;
  203. ; FileHandleCall ;
  204. ; PassOnThrough ;
  205. ; ;
  206. ; History: ;
  207. ; ;
  208. ; Mon 07-Aug-1989 23:45:48 -by- David N. Weise [davidw] ;
  209. ; Removed WinOldApp support. ;
  210. ; ;
  211. ; Sat Jan 17, 1987 10:17:31p -by- David N. Weise [davidw] ;
  212. ; Added this nifty comment block. ;
  213. ;-----------------------------------------------------------------------;
  214. assumes ds, nothing
  215. assumes es, nothing
  216. cProc Xenix_Status,<PUBLIC,NEAR>
  217. cBegin nogen
  218. cmp al,4
  219. jb xs1
  220. cmp al,7
  221. jz xs1
  222. cmp al,10
  223. jz xs1
  224. jmp PassOnThrough
  225. xs1: jmp FileHandleCall
  226. cEnd nogen
  227. ;********************************************************************
  228. ;
  229. ; Phantom drive Traps
  230. ;
  231. ;********************************************************************
  232. ;**
  233. ;
  234. ; AssignCall -- Trap for Define Macro Call 5F03h
  235. ;
  236. ; ENTRY:
  237. ; Regs for 5F03h except BP is standard INT 21h frame ptr
  238. ; EXIT:
  239. ; Through PassOnThrough or Error path if phantom drive detected
  240. ; USES:
  241. ; Flags and via DOS if error
  242. ;
  243. AssignCall:
  244. cmp ax,5F03h ; Only care about 03 call
  245. jnz AssignCall_OK
  246. cmp bl,4 ; With BL = 4 (assign block)
  247. jnz AssignCall_OK
  248. cmp byte ptr [si],0 ; Ignore this special case
  249. jz AssignCall_OK
  250. push dx
  251. mov dx,si
  252. call PathDrvDSDX
  253. pop dx
  254. jc AssignCall_bad
  255. AssignCall_OK:
  256. jmp PassOnThrough
  257. AssignCall_bad:
  258. push word ptr [si]
  259. mov byte ptr [si],'$' ; Bogus drive letter
  260. call real_DOS ; Set error
  261. pop word ptr [si] ; reset string
  262. jmp SetCarryRet
  263. ;**
  264. ;
  265. ; NameTrans -- Trap for NameTrans Call 60h
  266. ;
  267. ; ENTRY:
  268. ; Regs for 60h except BP is standard INT 21h frame ptr
  269. ; EXIT:
  270. ; Through PassOnThrough or Error path if phantom drive detected
  271. ; USES:
  272. ; Flags and via DOS if error
  273. ;
  274. NameTrans:
  275. push dx
  276. mov dx,si ; Point with DS:DX to call PathDrvDSDX
  277. call PathDrvDSDX
  278. pop dx
  279. jc @F
  280. jmp POTJ1 ; Drive OK
  281. @@:
  282. push word ptr [si]
  283. mov byte ptr [si],'$' ; Bogus drive letter
  284. call real_DOS ; DOS sets error
  285. pop word ptr [si] ; Restore users drive
  286. jmp SetCarryRet ; Error
  287. si_no_good:
  288. call SetErrorDrvDSDX ; Set error
  289. pop dx
  290. jmp SetCarryRet ; Error
  291. PathDSSICall: ; Simple clone of PathDSDXCall
  292. push dx ; but start with offset in SI,
  293. mov dx, si ; and we know this is a file open
  294. call PathDrvDSDX ; call.
  295. jc si_no_good
  296. pop dx
  297. pop ds
  298. push ax
  299. push [bp][6] ; Original flags
  300. push cs
  301. mov ax, codeoffset si_back_here ; Now have IRET frame
  302. push ax
  303. push [bp] ; Original bp+1
  304. mov bp, sp
  305. mov ax, [bp][8]
  306. push ds
  307. jmp PassOnThrough ; Do the DOS call
  308. si_back_here:
  309. pushf
  310. inc bp
  311. push bp ; pass back the correct flags
  312. mov bp,sp
  313. xchg ax, [bp][4]
  314. jc @F
  315. push dx
  316. mov dx, si
  317. call FileCDR_notify
  318. pop dx
  319. @@:
  320. push [bp]
  321. pop [bp][6]
  322. add sp, 2
  323. pop [bp][12]
  324. pop ax
  325. pop bp
  326. dec bp
  327. jmp f_iret
  328. ;**
  329. ;
  330. ; PathDSDXCall -- Trap for Calls which point to a path with DS:DX
  331. ;
  332. ; ENTRY:
  333. ; Regs for call except BP is standard INT 21h frame ptr
  334. ; EXIT:
  335. ; Through PassOnThrough or Error path if phantom drive detected
  336. ; USES:
  337. ; Flags and via DOS if error
  338. ;
  339. PathDSDXCall:
  340. call PathDrvDSDX
  341. jnc @f
  342. jmp pd_drive_no_good ; Drive not OK
  343. @@:
  344. ; If OPEN with SHARING, check to see if this could be a file in
  345. ; the file handle cache. GetModuleHandle is fairly quick as
  346. ; opposed to fully qualifying the path involved, but that would
  347. ; mean two DOS calls in addition to the open. Kernel opens modules
  348. ; in compatibility mode, so sharing bits will barf if the file
  349. ; is in the cache. why is this a problem? CVW opens modules
  350. ; with sharing modes and we broke em when we fixed the fh cache.
  351. ; won't worry about other DOS calls like create or delete since
  352. ; they will damage things anyway.
  353. ;
  354. ife SHARE_AWARE
  355. cmp ah,3Dh ; open call?
  356. jnz maybe_notify
  357. test al, 01110000b ; sharing bits?
  358. jz maybe_notify
  359. call DealWithCachedModule
  360. endif
  361. maybe_notify:
  362. ifdef WOW
  363. cmp ah,41h ; Delete call?
  364. jnz not_delete
  365. call DealWithCachedModule ; Yes Flush it out of our cache
  366. not_delete:
  367. endif; WOW
  368. cmp ah,5Bh
  369. ja no_notify_jmp ; DOS call we don't know
  370. cmp ah,3Dh
  371. jnz nd_101
  372. jmp diddle_share_bits ; Don't notify on open file.
  373. nd_101:
  374. cmp ah,4Eh
  375. jz no_notify_jmp ; Don't notify on find first.
  376. cmp ah,56h
  377. jz no_notify_jmp ; Handle rename specially.
  378. cmp ax, 4300h ; Get File Attributes
  379. jz no_notify_jmp
  380. pop ds
  381. push ax
  382. push [bp][6] ; Original flags
  383. push cs
  384. mov ax, codeoffset back_here ; Now have IRET frame
  385. push ax
  386. push [bp] ; Original bp+1
  387. mov bp, sp
  388. mov ax, [bp][8]
  389. push ds
  390. POTJ1:
  391. jmp PassOnThrough ; Do the DOS call
  392. no_notify_jmp:
  393. jmps no_notify
  394. back_here:
  395. pushf
  396. inc bp
  397. push bp ; pass back the correct flags
  398. mov bp,sp
  399. xchg ax, [bp][4]
  400. jc call_failed
  401. call FileCDR_notify
  402. call_failed:
  403. push [bp]
  404. pop [bp][6]
  405. add sp, 2
  406. pop [bp][12]
  407. pop ax
  408. pop bp
  409. dec bp
  410. jmp f_iret
  411. diddle_share_bits: ; Make ALL opens use SHARE bits
  412. if SHARE_AWARE
  413. test al, 70h ; Any share bits now?
  414. jnz no_notify ; yes, fine.
  415. or al, OF_SHARE_DENY_NONE ; For Read access
  416. test al, 3 ; Write or Read/Write access?
  417. jz no_notify ; no, SHARE_DENY_NONE is fine
  418. ; yes, want SHARE_DENY_WRITE
  419. xor al, OF_SHARE_DENY_WRITE OR OF_SHARE_DENY_NONE
  420. endif
  421. no_notify:
  422. jmps POTJ ; Drive OK
  423. pd_drive_no_good:
  424. call SetErrorDrvDSDX ; Set error
  425. jmps SetCarryRet ; Error
  426. ;**
  427. ;
  428. ; DLDriveCall1 -- Trap for Calls which have a drive number (A = 1) in DL
  429. ; and carry NOT set if error.
  430. ;
  431. ; ENTRY:
  432. ; Regs for call except BP is standard INT 21h frame ptr
  433. ; EXIT:
  434. ; Through PassOnThrough or Error path if phantom drive detected CARRY not
  435. ; diddled
  436. ; USES:
  437. ; Flags and via DOS if error
  438. ;
  439. DLDriveCall1:
  440. call CheckDriveDL
  441. jnc POTJ ; Drive OK
  442. call SetErrorDLDrv ; Set error
  443. jmps DriveErrorRet ; Error
  444. ;**
  445. ;
  446. ; DLDriveCall2 -- Trap for Calls which have a drive number (A = 1) in DL
  447. ; and carry set if error.
  448. ;
  449. ; ENTRY:
  450. ; Regs for call except BP is standard INT 21h frame ptr
  451. ; EXIT:
  452. ; Through PassOnThrough or Error path if phantom drive detected CARRY set
  453. ; USES:
  454. ; Flags and via DOS if error
  455. ;
  456. DLDriveCall2:
  457. call CheckDriveDL
  458. jnc POTJ ; Drive OK
  459. call SetErrorDLDrv ; Set error
  460. jmps SetCarryRet ; Error
  461. ;**
  462. ;
  463. ; FCBCall -- Trap for Calls which point to an FCB with DS:DX
  464. ;
  465. ; ENTRY:
  466. ; Regs for call except BP is standard INT 21h frame ptr
  467. ; EXIT:
  468. ; Through PassOnThrough or Error path if phantom drive detected
  469. ; USES:
  470. ; Flags and via DOS if error
  471. ;
  472. FCBCall:
  473. push dx
  474. push si
  475. mov si,dx
  476. cmp byte ptr [si],0FFh ; Extended FCB?
  477. jnz NotExt ; No
  478. add si,7 ; Point to drive
  479. NotExt:
  480. mov dl,byte ptr [si] ; Get drive
  481. or dl,dl
  482. jz FCBOK ; default drive
  483. call CheckDriveDL
  484. jc FCBBad
  485. FCBOK:
  486. pop si
  487. pop dx
  488. POTJ:
  489. jmp PassOnThrough
  490. FCBBad:
  491. push dx ; Save drive
  492. mov dx,si ; Point to standard FCB
  493. mov byte ptr [si],0F0h ; Known bogus drive
  494. call real_DOS
  495. pop dx
  496. mov byte ptr [si],dl ; Restore user drive
  497. pop si
  498. pop dx
  499. jmps DriveErrorRet
  500. SetCarryRet:
  501. or User_FL,00000001b ; Set carry
  502. jmps DriveErrorRet
  503. DriveErrorRet:
  504. pop ds
  505. pop bp
  506. dec bp
  507. FSTI
  508. jmp f_iret
  509. ;**
  510. ;
  511. ; XenixRename -- Trap for Call 56h
  512. ;
  513. ; ENTRY:
  514. ; Regs for call except BP is standard INT 21h frame ptr
  515. ; EXIT:
  516. ; Through PassOnThrough or Error path if phantom drive detected CARRY set
  517. ; USES:
  518. ; Flags and via DOS if error
  519. ;
  520. XenixRename:
  521. ; On rename we MUST deal with BOTH strings to prevent access to any
  522. ; phantom drives.
  523. call PathDrvDSDX ; Check DS:DX drive
  524. xchg di,dx ; ES:DI <-> DS:DX
  525. push ds
  526. push es
  527. pop ds
  528. pop es
  529. jnc XR_010
  530. jmp RenameError ; bad
  531. XR_010:
  532. call PathDrvDSDX ; Check ES:DI drive
  533. jnc XR_020
  534. jmp RenameError
  535. XR_020:
  536. xchg di,dx ; ES:DI <-> DS:DX
  537. push ds
  538. push es
  539. pop ds
  540. pop es
  541. pop ds
  542. push ax
  543. push [bp][6] ; Original flags
  544. push cs
  545. mov ax, codeoffset back_here1 ; Now have FIRET frame
  546. push ax
  547. push [bp] ; Original bp+1
  548. mov bp, sp
  549. mov ax, [bp][8]
  550. push ds
  551. jmp PassOnThrough ; Do the DOS call
  552. back_here1:
  553. pushf
  554. inc bp
  555. push bp ; pass back the correct flags
  556. mov bp,sp
  557. xchg [bp][4], ax
  558. jc call_failed1
  559. ;;; mov ah,41h ; delete file
  560. call FileCDR_notify
  561. ;;; push ds
  562. ;;; push es
  563. ;;; pop ds
  564. ;;; pop es
  565. ;;; xchg di,dx
  566. ;;; mov ah,5Bh ; create new file
  567. ;;; call FileCDR_notify
  568. ;;; push ds
  569. ;;; push es
  570. ;;; pop ds
  571. ;;; pop es
  572. ;;; xchg di,dx
  573. call_failed1:
  574. push [bp]
  575. pop [bp][6]
  576. add sp, 2
  577. pop [bp][12]
  578. pop ax
  579. pop bp
  580. dec bp
  581. jmp f_iret
  582. RenameError:
  583. xchg di,dx ; DS:DX <-> ES:DI
  584. push ds
  585. push es
  586. pop ds
  587. pop es
  588. ; We patch the ES:DI drive letter even if it isn't there.
  589. ; Since we are setting an error anyway this is OK.
  590. push word ptr ES:[di]
  591. mov byte ptr ES:[di],'$' ; Bogus drive letter
  592. call SetErrorDrvDSDX ; Set error
  593. pop word ptr ES:[di]
  594. jmp SetCarryRet ; Error
  595. ;**
  596. ;
  597. ; PathDrvDSDX -- Check a path pointed to by DS:DX for phantom drives
  598. ;
  599. ; ENTRY:
  600. ; DS:DX points to path
  601. ; EXIT:
  602. ; Carry set if phantom drive detected
  603. ; Carry clear if no phantom drives detected
  604. ; USES:
  605. ; Flags
  606. ;
  607. public PathDrvDSDX
  608. PathDrvDSDX:
  609. push si
  610. mov si,dx ; Point with SI
  611. mov dx,word ptr [si]; Get first two chars
  612. or dl,dl ; NUL in first byte?
  613. jz PDROK ; yes, OK
  614. ifdef FE_SB
  615. push ax
  616. mov al,dl
  617. call MyIsDBCSLeadByte ; see if char is DBC.
  618. pop ax
  619. jnc PDROK ; jump if char is a DBC
  620. endif
  621. or dh,dh ; NUL in second byte?
  622. jz PDROK ; yes, OK
  623. cmp dh,':' ; Drive given?
  624. jnz PDROK ; No, OK
  625. or dl,20h ; to lower case
  626. sub dl,60h ; DL is drive #, A=1
  627. call CheckDriveDL ; Check it out
  628. jmps PDPPRET
  629. PDROK:
  630. clc
  631. PDPPRET:
  632. mov dx,si
  633. pop si
  634. ret
  635. ;**
  636. ;
  637. ; SetErrorDrvDSDX -- Set an error on a DS:DX call by calling the DOS
  638. ;
  639. ; ENTRY:
  640. ; DS:DX points to path with phantom drive
  641. ; All other regs approp for INT 21 CALL
  642. ; EXIT:
  643. ; DOS called to set up error
  644. ; USES:
  645. ; Flags
  646. ; Regs as for INT 21 CALL
  647. ;
  648. SetErrorDrvDSDX:
  649. push si
  650. mov si,dx
  651. push word ptr [si]
  652. mov byte ptr [si],'$' ; Bogus drive letter
  653. call real_DOS ; DOS sets error
  654. pop word ptr [si] ; Restore users drive
  655. pop si
  656. ret
  657. ;**
  658. ;
  659. ; SetErrorDLDrv -- Set an error on a DL call by calling the DOS
  660. ;
  661. ; ENTRY:
  662. ; DL is drive # (A=1) of a phantom drive.
  663. ; All other regs approp for INT 21 CALL
  664. ; EXIT:
  665. ; DOS called to set up error
  666. ; USES:
  667. ; Flags
  668. ; Regs as for INT 21 CALL
  669. ;
  670. SetErrorDLDrv:
  671. push dx
  672. mov dl,0F0h ; Bogus drive letter
  673. call real_DOS ; DOS sets error
  674. pop dx ; Restore users drive
  675. ret43: ret
  676. ;**
  677. ;
  678. ; CheckDriveDL -- Check DL drive (A = 1)
  679. ;
  680. ; ENTRY:
  681. ; DL is drive # (A=1)
  682. ; EXIT:
  683. ; Carry Set if phantom drive
  684. ; Carry Clear if NOT phantom drive
  685. ; USES:
  686. ; Flags
  687. ;
  688. CheckDriveDL:
  689. push bx
  690. mov bx,dx
  691. dec bl ; A = 0
  692. cmp bl,26 ; 0 >= DL < 26?
  693. jae OKDRV ; No, cant be phantom then
  694. xor bh,bh
  695. add bx,dataOffset PhantArray; Index into PhantArray
  696. push ds
  697. SetKernelDS
  698. cmp byte ptr ds:[bx],0 ; Non-zero entry means phantom
  699. pop ds
  700. UnSetKernelDS
  701. stc
  702. jnz BadDrv
  703. OKDRV:
  704. clc
  705. BadDrv:
  706. pop bx
  707. ret
  708. ife SHARE_AWARE
  709. ;**
  710. ;
  711. ; DealWithCachedModule -- closes a cached module if it looks like a filename
  712. ;
  713. ; ENTRY:
  714. ; Same as PathDSDXCall
  715. ;
  716. ; EXIT:
  717. ; Unchanged
  718. ;
  719. ; USES:
  720. ; None
  721. ;
  722. ; SIDE EFFECT:
  723. ; Closes entry in file handle cache if it has the same base name
  724. ;
  725. public DealWithCachedModule
  726. DealWithCachedModule:
  727. pusha
  728. push ds
  729. push es ; save all registers
  730. mov si, dx ; point ds:si to string
  731. sub sp, 130 ; big number for paranoia
  732. mov di, sp
  733. push ss
  734. pop es ; es:di to string
  735. cld ; forwards
  736. copy_name_loop:
  737. lodsb ; get a char
  738. cmp al, 0 ; end of string?
  739. jz end_of_name
  740. cmp al, ':' ; path seperator?
  741. jz path_sep
  742. cmp al, '\'
  743. jz path_sep
  744. cmp al, '/'
  745. jz path_sep
  746. call MyUpper ; upcase the char
  747. stosb
  748. ifdef FE_SB
  749. call MyIsDBCSLeadByte
  750. jc copy_name_loop ; copy second byte in east
  751. movsb
  752. endif
  753. jmp short copy_name_loop
  754. path_sep:
  755. mov di, sp ; point back to beginning
  756. jmp short copy_name_loop
  757. end_of_name:
  758. stosb
  759. mov di, sp ; point back to beginning
  760. SetKernelDS
  761. cCall ResidentFindExeFile, <ss,di> ; find it
  762. or ax, ax
  763. jz @F
  764. cCall FlushCachedFileHandle, <ax> ; flush it
  765. @@:
  766. add sp, 130
  767. pop es
  768. pop ds ; restore registers
  769. popa
  770. UnsetKernelDS
  771. ret
  772. endif
  773. f_iret:
  774. FIRET
  775. sEnd CODE
  776. end