nacer@orstcs.UUCP (nacer) (04/20/86)
If someone has downloaded NO.COM from the PC magazine Interactive Reader Service at (212)696-0360 please post it here ! If possible post NO.ASM as well Thank you! hp-pcd!orstcs!nacer
mbailey@ncrcae.UUCP (Merle Bailey) (04/24/86)
# This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # The uencoded no.com --> no.com.u no.asm echo x - no.com.u sed 's/^X//' > "no.com.u" << '//E*O*F no.com.u//' Xbegin 644 no.com XMZ0@!0V]P>7)I9VAT(#$Y.#8@6FEF9BU$879I<R!0=6)L:7-H:6YG($-O+AH@ XM4')O9W)A;6UE9"!B>2!#:&%R;&5S(%!E='IO;&0@&E-Y;G1A>#H@3D\@9FEL XM97-P96,@8V]M;6%N9"!;<&%R86UE=&5R<UTD3D\Z($YE961S($1/4R R+C @ XM*R1.3SH@26YC;W)R96-T($9I;&4@4W!E8R1.3SH@5&]O(&UA;GD@9FEL97,@ XM=&\@:&ED921.3SH@06QL;V-A=&EO;B!0<F]B;&5M)$Y/.B!#3TU-04Y$(%!R XM;V)L96TD"2 L.ST 0T]-4U!%0ST !< ; M##- XM(3P"<Q>Z=0&T"<TAS2"L/ UT];_G ;D% /*NP[I, ;Z! /SHZ/]T^XO>2^C@ XM_W7[3H?SOPL$@'P!.G4%K23?ZPBT&<TA!$&T.JNP7#@$=".J5HOWBE3]@.I XMM$?-(;J) 7*E*L X!'0)N4 \JY/L%RJ7HO+*\[SI"K JHD^[ &#ZP2@@ $ XM@"K#M"")!\=' B]#H2P H_L!B1[] 8P._P&,#@,"C X% KK@ [0:S2&+/NP! XMN@L$*\FT3LTA<PL]$@!T);J) >D^_XO'!0 "<@0[Q'(&NJ$!Z2W_OOX#Z.D XM_P;N ;1/Z]*)/O !BS[L ;E +!<_?*NQD4" /RX #/-(8@6\@$JTK@!,\TA XML_^W NB& (L>\ &!PP "B^.#PP^Q!-/KM$K-(;J\ 7)6!HX&+ K_[[S ;K3 XM 2: /0!T0U97N0@ \Z9?7G0)*L"Y___RKNOF@\<('@8?!XDF"0*+U[O[ ;@ XM2\TAC,B.V([ CM"+)@D"G"K2N $SS2&=NM,!<P2T"<TAL_VW .@+ (H6\@&X XM 3/-(<T@BP[N >,HBS;L 8L6\ %6O@L$B_KH& !/7N@3 %&X $/-(2++"L^X XM 4/-(5GBX,.D@'W_ '7YPP X# X Xend //E*O*F no.com.u// echo x - no.asm sed 's/^X//' > "no.asm" << '//E*O*F no.asm//' X; NO.ASM -- Hides specified files from command that follows X; ====== X XCSEG Segment X Assume CS:CSEG, DS:CSEG, ES:CSEG, SS:CSEG X Org 002Ch XEnvironment Label Word ; Segment of Environment is here X Org 0080h XParameter Label Byte ; Parameter is here X Org 0100h XEntry: Jmp Begin ; Entry Point X X; Most Data (some more at end of program) X; --------------------------------------- X X db "Copyright 1986 Ziff-Davis Publishing Co.",1Ah X db " Programmed by Charles Petzold ",1Ah XSyntaxMsg db "Syntax: NO filespec command [parameters]$" XDosVersMsg db "NO: Needs DOS 2.0 +$" XFileSpecMsg db "NO: Incorrect File Spec$" XTooManyMsg db "NO: Too many files to hide$" XMemAllocMsg db "NO: Allocation Problem$" XCommandMsg db "NO: COMMAND Problem$" XDelimiters db 9,' ,;=' XFileList dw ? ; Storage of found files XFileCount dw 0 ; Count of found files XFileListEnd dw ? ; End of storage of found files XBreakState db ? ; Store original break state here XComspec db 'COMSPEC=' ; String for Environment search XParamBlock dw ? ; Parameter block for EXEC call X dw ?, ? X dw 5Ch, ? X dw 6Ch, ? XStackPointer dw ? ; Save SP during EXEC call X X; Check DOS Version X; ----------------- X XBegin: Mov AH, 30h ; Check for DOS Version X Int 21h ; through DOS call X Cmp AL, 2 ; See if it's 2.0 or above X Jae DosVersOK ; If so, continue X X Mov DX, Offset DosVersMsg ; Error message XErrorExit: Mov AH, 9 ; Print String function call X Int 21h ; Do it X Int 20h ; And exit prematurely X X; Parse Command Line to get NO File specification X; ----------------------------------------------- X XScanParam: Lodsb ; SUBROUTINE: Get byte X Cmp AL, 13 ; See if end of parameter X Je ErrorExit ; If so, exit X Mov DI, Offset Delimiters ; Check if delimiter X Mov CX, 5 ; There are 5 of them X Repne Scasb ; Scan the string X Ret ; And return X XDosVersOK: Mov DX, Offset SyntaxMsg ; Possible error msg X Mov SI, 1+Offset Parameter ; NO Parameter string X Cld ; Directions forward X XBegSearch: Call ScanParam ; Check byte in subroutine X Je BegSearch ; If delimiter, keep searching X Mov BX, SI ; Save pointer in BX X Dec BX ; BX points to NO file spec X XEndSearch: Call ScanParam ; Check byte in subroutine X Jne EndSearch ; If not delimiter, keep going X X; Construct full FilePath and save down at end of program X; ------------------------------------------------------- X X Dec SI ; Points after NO file spec X Xchg SI, BX ; SI points to beg, BX to end X Mov DI, Offset FullPath ; Points to destination X Cmp Byte Ptr [SI + 1], ':' ; See if drive spec included X Jnz GetDrive ; If not, must get the drive X Lodsw ; Otherwise, grab drive spec X And AL, 0DFh ; Capitalize drive letter X Jmp Short SaveDrive ; And skip next section X XGetDrive: Mov AH, 19h ; Get current drive X Int 21h ; through DOS X Add AL, 'A' ; Convert to letter X Mov AH, ':' ; Colon after drive letter X XSaveDrive: Stosw ; Save drive spec and colon X Mov AL, '\' ; Directory divider byte X Cmp [SI], AL ; See if spec starts at root X Jz HaveFullPath ; If so, no need to get path X Stosb ; Store that character X Push SI ; Save pointer to parameter X Mov SI, DI ; Destination of current path X Mov DL, [SI - 3] ; Drive letter specification X Sub DL, '@' ; Convert to number X Mov AH, 47h ; Get current directory X Int 21h ; through DOS X Mov DX, Offset FileSpecMsg ; Possible error message X Jc ErrorExit ; Exit if error X Sub AL, AL ; Search for terminating zero X Cmp [SI], AL ; Check if Root Directory X Jz RootDir ; If so, don't use it X Mov CX, 64 ; Number of bytes to search X Repnz Scasb ; Do the search X Dec DI ; DI points to last zero X Mov AL, '\' ; Put a backslash in there X Stosb ; So filespec can follow XRootDir: Pop SI ; Get back SI X XHaveFullPath: Mov CX, BX ; End of NO file spec X Sub CX, SI ; Number of bytes to transfer X Rep Movsb ; Transfer them X Sub AL, AL ; Terminating zero X Stosb ; Save it X Mov [FileList], DI ; Repository for found files X X; Fix up parameter and ParamBlock for eventual COMMAND load X; --------------------------------------------------------- X X Sub BX, 4 ; Points to new param begin X Mov AL, [Parameter] ; Old byte count of parameter X Add AL, 80h ; Add beginning of old param X Sub AL, BL ; Subtract beginning of new X Mov AH, ' ' ; Space separator X Mov Word Ptr [BX], AX ; Store it X Mov Word Ptr [BX + 2], 'C/' ; Add /C to beginning of rest X Mov AX, [Environment] ; Get environment segment X Mov [ParamBlock], AX ; Save it X Mov [ParamBlock + 2], BX ; Save parameter pointer X Mov [ParamBlock + 4], CS ; Save segment of ParamBlock X Mov [ParamBlock + 8], CS X Mov [ParamBlock + 10], CS X X; Find Files from NO File Specification X; ------------------------------------- X X Mov DX, Offset DTABuffer ; Set File Find buffer X Mov AH, 1Ah ; by calling DOS X Int 21h X X Mov DI, [FileList] ; Address of destination X Mov DX, Offset FullPath ; Search string X Sub CX, CX ; Search Normal files only X Mov AH, 4Eh ; Find first file X XFindFile: Int 21h ; Call DOS to find file X Jnc Continue ; If no error continue X Cmp AX, 18 ; If no more files X Jz NoMoreFiles ; get out of the loop X Mov DX, Offset FileSpecMsg ; Error message otherwise X Jmp ErrorExit ; Exit and print message X XContinue: Mov AX, DI ; Address of destination X Add AX, 512 ; See if near top of segment X Jc TooManyFiles ; If so, too many files X Cmp AX, SP ; See if getting too many X Jb StillOK ; If not, continue X XTooManyFiles: Mov DX, Offset TooManyMsg ; Otherwise error message X Jmp ErrorExit ; And terminate X XStillOK: Mov SI, 30+Offset DTABuffer ; Points to filename X Call AsciizTransfer ; Transfer it to list X Inc [FileCount] ; Kick up counter X Mov AH, 4Fh ; Find next file X Jmp FindFile ; By looping around X XNoMoreFiles: Mov [FileListEnd], DI ; Points after last file X Mov DI, [FileList] ; Points to end of find string X Mov CX, 64 ; Search up to 64 bytes X Mov AL, '\' ; For the backslash X Std ; Search backwards X Repnz Scasb ; Do the search X Mov Byte Ptr [DI + 2], 0 ; Stick zero in there X Cld ; Fix up direction flag X X; Stop Ctrl-Break Exits and Hide the files X; ---------------------------------------- X X Mov AX,3300h ; Get Break State X Int 21h ; By calling DOS X Mov [BreakState],DL ; Save it X Sub DL,DL ; Set it to OFF X Mov AX,3301h ; Set Break State X Int 21h ; By calling DOS X Mov BL, 0FFh ; Value to AND attribute X Mov BH, 02h ; Value to OR attribute X Call ChangeFileMode ; Hide all the files X X; Un-allocate rest of memory X; -------------------------- X X Mov BX, [FileListEnd] ; Beyond this we don't need X Add BX, 512 ; Allow 512 bytes for stack X Mov SP, BX ; Set new stack pointer X Add BX, 15 ; Prepare for truncation X Mov CL,4 ; Prepare for shift X Shr BX,CL ; Convert to segment form X Mov AH,4Ah ; Shrink allocated memory X Int 21h ; By calling DOS X Mov DX,Offset MemAllocMsg ; Possible Error Message X Jc ErrorExit2 ; Print it and terminate X X; Search for Comspec in Environment X; --------------------------------- X X Push ES ; We'll be changing this X Mov ES, [Environment] ; Set ES to Environment X Sub DI, DI ; Start at the beginning X Mov SI, Offset ComSpec ; String to search for X Mov DX, Offset CommandMsg ; Possible error message X XTryThis: Cmp Byte Ptr ES:[DI], 0 ; See if points to zero X Jz ErrorExit2 ; If so, we can't go on X Push SI ; Temporarily save these X Push DI X Mov CX, 8 ; Search string has 8 chars X Repz Cmpsb ; Do the string compare X Pop DI ; Get back the registers X Pop SI X Jz LoadCommand ; If equals, we've found it X Sub AL, AL ; Otherwise search for zero X Mov CX, -1 ; For 'infinite' bytes X Repnz Scasb ; Do the search X Jmp TryThis ; And try the next string X X; Load COMMAND.COM X; ----------------- X XLoadCommand: Add DI, 8 ; so points after 'COMSPEC=' X Push DS ; Switch DS and ES registers X Push ES X Pop DS X Pop ES X Mov [StackPointer],SP ; Save Stack Pointer X Mov DX, DI ; DS:DX = Asciiz of COMMAND X Mov BX, Offset ParamBlock ; ES:BX = parameter block X Mov AX, 4B00h ; EXEC function call X Int 21h ; Load command processor X X; Return from COMMAND.COM X; ----------------------- X X Mov AX, CS ; Current code segment X Mov DS, AX ; Reset DS to this segment X Mov ES, AX ; Reset ES to this segment X Mov SS, AX ; Reset stack segment to it X Mov SP, [StackPointer] ; Reset SP X Pushf ; Save error flag X Sub DL,DL ; Set Ctrl Break to OFF X Mov AX,3301h X Int 21h ; By calling DOS X Popf ; Get back error flag X Mov DX,Offset CommandMsg ; Set up possible error msg X Jnc Terminate ; And print if EXEC error X X; Unhide the Files, restore Ctrl-Break state, and exit X; ---------------------------------------------------- X XErrorExit2: Mov AH,9 ; Will print the string X Int 21h ; Print it XTerminate: Mov BL, 0FDh ; AND value for change X Mov BH, 00h ; OR value for change X Call ChangeFileMode ; Change file attributes X Mov DL,[BreakState] ; Original break-state X Mov AX,3301h ; Change the break-state X Int 21h ; by calling DOS X Int 20h ; Terminate X X; SUBROUTINE: Change File Mode (All files, BL = AND, BH = OR) X; ----------------------------------------------------------- X XChangeFileMode: Mov CX, [FileCount] ; Number of files X Jcxz EndOfChange ; If no files, do nothing X Mov SI, [FileList] ; Beginning of list X Mov DX, [FileListEnd] ; End of List XChangeLoop: Push SI ; Save pointer X Mov SI, Offset FullPath ; Preceeding path string X Mov DI, DX ; Destination of full name X Call AsciizTransfer ; Transfer it X Dec DI ; Back up to end zero X Pop SI ; Get back pointer to filename X Call AsciizTransfer ; Transfer it X Push CX ; Save the counter X Mov AX, 4300h ; Get attribute X Int 21h ; by calling DOS X And CL, BL ; AND with BL X Or CL, BH ; OR with BH X Mov AX, 4301h ; Now set attribute X Int 21h ; by calling DOS X Pop CX ; Get back counter X Loop ChangeLoop ; And do it again if necessary XEndOfChange: Ret ; End of subroutine X X; SUBROUTINE: Asciiz String Transfer (SI, DI in, returned incremented) X; -------------------------------------------------------------------- X XAsciizTransfer: Movsb ; Transfer Byte X Cmp Byte Ptr [DI - 1], 0 ; See if it was end X Jnz AsciizTransfer ; If not, loop X Ret ; Or leave subroutine X X; Variable length data stored at end X; ---------------------------------- X XDTABuffer Label Byte ; For file find calls XFullPath equ DTABuffer + 43 ; For file path and names XCSEG EndS ; End of the segment X End Entry ; Denotes entry point //E*O*F no.asm// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 21 78 1083 no.com.u 311 1819 17410 no.asm 332 1897 18493 total !!! wc no.com.u no.asm | sed 's=[^ ]*/==' | diff -b $temp - exit 0