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.

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