home *** CD-ROM | disk | FTP | other *** search
- PAGE 58,132
- TITLE INWINEQ1 11-19-91 [2-4-92]
-
- ;v1.1 Toad Hall Disassembly and Tweak,
- ;4 Feb 92
- ;Don't you just *love* it when people refuse
- ;to distribute source for such trivial utilities?
- ;David Kirschbaum, Toad Hall
- ;kirsch@usasoc.soc.mil
-
- CSEG SEGMENT
- ASSUME DS:CSEG, SS:CSEG ,CS:CSEG ,ES:CSEG
- ORG 100H
-
- InWinEq PROC NEAR
- MOV AX,DS:2CH ;PSP environment segment
- MOV ES,AX
- ;v1.1 MOV DI,0
- xor di,di ;0 offset v1.1
-
- ;Compare this environment string against 'windir='
- StringLup_108:
- MOV AL,ES:[DI] ;snarf environment byte
- ;v1.1 CMP AL,0
- or al,al ;environment's terminating 0? v1.1
- JZ Term_134 ;yep, terminate
-
- MOV SI,OFFSET txt13D ;'windir='
-
- ;Scan the string, char by character.
- CharLup_112:
- MOV BL,[SI] ;snarf 'windir=' char
- ;v1.1 CMP BL,0
- or bl,bl ;terminating 0? v1.1
- JZ Match_12F ;yep, complete match, flag found
-
- MOV AL,ES:[DI] ;snarf environment character
- CMP AL,BL ;match the 'windir=' char?
- JNZ NoMatch_124 ;nope, no match
-
- INC DI ;char matched, bump both pointers
- INC SI
- JMP CharLup_112 ;and keep matching
-
- NoMatch_124:
- INC DI ;bump environment pointer
- MOV AL,ES:[DI] ;snarf environment character
- OR AL,AL ;terminating 0 for this string?
- JNZ NoMatch_124 ;nope, keep looking
- INC DI ;yep, bump past this string's 0
- JMP StringLup_108 ;and check a whole new string
-
- Match_12F:
- ;v1.1 MOV BYTE PTR bflag13C,1 ;flag 'windir=' found
- inc bflag13C ;flag 'windir=' found v1.1
- Term_134:
- MOV AH,4CH ;terminate process
- MOV AL,bflag13C ;ERRORLEVEL 1 if 'windir=' found
- INT 21H
-
- bflag13C db 0 ;default 0, no 'windir=' found
-
- txt13D DB 'windir=',0
-
- InWinEq ENDP
-
- CSEG ENDS
- END InWinEq