home *** CD-ROM | disk | FTP | other *** search
/ Software Recommendations - 1998 Season 1 / DNBCD4.iso / develop / tool / zip / HS118B70.ZIP / CHKHS.ASM next >
Encoding:
Assembly Source File  |  1998-01-14  |  3.8 KB  |  135 lines

  1. ;; This is a quick hack done on Dark Stalker's Check DS-Crypt
  2. ;; Work's only with files (COM/EXE) smaller than 63 KB!
  3.  
  4. .model  tiny
  5. include dos.inc
  6. .code
  7. Org     100h
  8. .startup
  9.         cld
  10.         Mov     Dx,OffSet Intro
  11.         Call    Print
  12.         Call    GetParam
  13.         Mov     Ax,3D00h                ; fopen
  14.         Mov     Dx,FName
  15.         Int     21h
  16.         Jnc     Next
  17.         Mov     Dx,OffSet FoErr
  18.         Jmp     Short Print
  19. Next:
  20.         XChg    Ax,Bx
  21.         Mov     Ah,3Fh
  22.         Mov     Dx,OffSet Buf
  23.         Mov     Cx,0FF00h
  24.         sub     cx, dx
  25.         Int     21h
  26.         Push    Ax
  27.         Mov     Ah,3Eh
  28.         Int     21h
  29.         Pop     Si
  30.         Add     Si,OffSet Buf-9
  31.         LodSw
  32.         Cmp     Ax,'SH'
  33.         Jne     NotDsc
  34.         LodSw
  35.         Mov     VerHi,Al
  36.         Mov     VerLo,Ah
  37.         lodsw
  38.         cmp     ax, "sM"
  39.         jne     NotDsc
  40.         @ShowStr "Found HackStop "
  41.         sub     ax, ax
  42.         mov     al, VerHi
  43.         call    WriteDecimal
  44.         @ShowChar '.'
  45.         sub     ax, ax
  46.         mov     al, VerLo
  47.         call    WriteDecimal
  48.         @ShowChar 13, 10
  49.         .exit   0
  50. NotDsc:
  51.         Mov     Dx,OffSet NoDsd
  52.         call    Print
  53.         .exit   3
  54.  
  55. Print   Proc
  56.         Mov     Ah,9
  57.         Int     21h
  58.         Ret
  59. Print   EndP
  60.  
  61. GetParam Proc
  62.         Mov     Cl,Ds:[80h]             ; Grab the command line length in CL
  63.         Or      Cl,Cl                   ; Check to see if it's 0
  64.         Jz      Short NoCmd             ; No, get the commandline
  65. ScnCmd:
  66.         Mov     Si,81h                  ; Load command offset into SI
  67. ScanLp:
  68.         LodSb                           ; Load a byte from SI into AL
  69.         Cmp     Al,20h                  ; Remove the leading spaces, Is it a space?
  70.         Jne     Short Found             ; No, stop this loop and save the starting point
  71.         Loop    ScanLp                  ; Yes, loop ScanLp until its not a space.
  72. NoCmd:
  73.         Mov     Ah,9
  74.         Mov     Dx,OffSet Usage         ; Display the usage message
  75.         Int     21h
  76.         .exit   2
  77. Found:
  78.         Dec     Si                      ; Subtract 1 from the offset of commandline
  79.         Push    Si
  80. ScnEnd:
  81.         LodSb                           ; Load a byte from SI
  82.         Cmp     Al,0Dh                  ; Search for CR
  83.         Jne     Short ScnEnd            ; CR not found so keep scanning
  84.         Mov     Byte Ptr Ds:[Si-1],0    ; Replace CR with nul char (ASCIIZ)
  85.         Pop     FName
  86.         Ret
  87. GetParam EndP
  88.  
  89. ;; ************************************************************************
  90.  
  91. WriteDecimal proc near uses bx cx ax dx,
  92.  
  93.         test    ax, 8000h               ; negative
  94.         je      short @@3
  95.         neg     ax                      ; reverse the number
  96.         push    ax
  97.         mov     ah, 02h
  98.         mov     dl, '-'                 ; print a '-'
  99.         int     21h
  100.         pop     ax
  101.  
  102. @@3:
  103.         mov     bx, 10
  104.         xor     cx, cx
  105.  
  106. @@1:    xor     dx, dx
  107.         idiv    bx                      ; (dx:ax) / 10
  108.         push    dx                      ; the lowest decimal number
  109.         inc     cx
  110.         or      ax, ax                  ; eax=0 ?
  111.         jne     @@1
  112.  
  113.         mov     ah, 02h
  114. @@2:    pop     dx                      ; number into DL
  115.         add     dl, '0'
  116.         int     21h
  117.         loop    @@2
  118.  
  119.         ret
  120. WriteDecimal endp
  121.  
  122.  
  123.  
  124. .data
  125.         Intro   Db 13,10,'---=[ Check-HackStop v1.0 by ROSE, Concept by Dark Stalker ]=-----------------',13,10,13,10,'$'
  126.         NoDsd   Db '[Not HS-Protected]',13,10,'$'
  127.         FoErr   Db 'File open error',13,10,'$'
  128.         Usage   Db ' USAGE: ChkHS <FileName>',13,10,'$'
  129.         FName   Dw 0
  130.         VerHi   Db 0
  131.         VerLo   Db 0
  132.         Buf     Equ $
  133. .stack
  134. end
  135.