home *** CD-ROM | disk | FTP | other *** search
/ The Elite Hackers Toolkit / TheEliteHackersToolkitVolume1_1998.rar / HACKERS.BIN / appcraks / STNPEER.ZIP / CONSOLE.INC next >
Text File  |  1998-01-26  |  5KB  |  162 lines

  1. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  2. ;
  3. ;              CONSOLE.INC - procedures for console input/output
  4. ;                   (C) Copyright 1998 by ANAKiN [DaVinci]
  5. ;
  6. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  7.  
  8. Comment %
  9.         m  cinit
  10.         m  cwrite  <buffer> <length>
  11.         m  cwrites <buffer>
  12.         m  cread   <buffer> <length>
  13.         m  ccolor  <color>
  14.         m  cgotoxy <x> <y>
  15.         %
  16.  
  17. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  18. ; imports
  19. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  20.  
  21. Extrn   GetStdHandle             : PROC
  22. Extrn   SetConsoleCursorPosition : PROC
  23. Extrn   SetConsoleTextAttribute  : PROC
  24. Extrn   WriteConsoleA            : PROC
  25. Extrn   ReadConsoleA             : PROC
  26.  
  27. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  28. ; constants
  29. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  30.  
  31. STD_INPUT_HANDLE   equ -10
  32. STD_OUTPUT_HANDLE  equ -11
  33. STD_ERROR_HANDLE   equ -12
  34.  
  35. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  36. ; data
  37. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  38.  
  39. .data
  40.  
  41. hconout  dd 0
  42. hconin   dd 0
  43. cchRW    dd 0
  44.  
  45. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  46. ; procedures / macros
  47. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  48.  
  49. .code
  50.  
  51. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  52. ; cinit - initializes input and output stream
  53. ; IN:
  54. ;  nothing
  55. ; OUT:
  56. ;  nothing
  57. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  58.  
  59. cinit macro
  60.         CALL    _cinit
  61. endm
  62.  
  63. _cinit proc
  64.         ; init input stream
  65.         PUSH    STD_INPUT_HANDLE  ; fdwDevice
  66.         CALL    GetStdHandle
  67.         CMP     EAX, -1
  68.         JE      ciniterror
  69.         MOV     [hconin], EAX
  70.  
  71.         ; init output stream
  72.         PUSH    STD_OUTPUT_HANDLE ; fdwDevice
  73.         CALL    GetStdHandle
  74.         CMP     EAX, -1
  75.         JE      ciniterror
  76.         MOV     [hconout], EAX
  77.  
  78.         RET
  79. endp
  80.  
  81. ciniterror proc
  82.         PUSH    -1
  83.         CALL    ExitProcess
  84. endp
  85.  
  86. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  87. ; cwrite - writes string to console
  88. ; IN:
  89. ;  buffer
  90. ;  length
  91. ; OUT:
  92. ;  nothing
  93. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  94.  
  95. cwrite macro buffer, length
  96.         PUSH    0                 ; Reserved
  97.         PUSH    offset cchRW      ; lpcchWritten
  98.         PUSH    length            ; cchToWrite
  99.         PUSH    offset buffer     ; lpvBuffer
  100.         PUSH    [hconout]         ; hConsoleOutput
  101.         CALL    WriteConsoleA
  102. endm
  103.  
  104. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  105. ; cwrites - writes string to console
  106. ; IN:
  107. ;  buffer
  108. ; OUT:
  109. ;  nothing
  110. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  111.  
  112. cwrites macro buffer
  113.         cwrite  <buffer> <l&buffer>
  114. endm
  115.  
  116. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  117. ; cread - reads string from console
  118. ; IN:
  119. ;  buffer
  120. ;  length
  121. ; OUT:
  122. ;  nothing
  123. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  124.  
  125. cread macro buffer, length
  126.         PUSH    0                 ; Reserved
  127.         PUSH    offset cchRW      ; lpcchRead
  128.         PUSH    length            ; cchToRead
  129.         PUSH    offset buffer     ; lpvBuffer
  130.         PUSH    [hconin]          ; hConsoleInput
  131.         CALL    ReadConsoleA
  132. endm
  133.  
  134. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  135. ; ccolor - sets color for output
  136. ; IN:
  137. ;  color
  138. ; OUT:
  139. ;  nothing
  140. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  141.  
  142. ccolor macro color
  143.         PUSH    color                    ; wAttr
  144.         PUSH    [hconout]                ; hConsoleOutput
  145.         CALL    SetConsoleTextAttribute
  146. endm
  147.  
  148. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  149. ; cgotoxy - set new cursorposition
  150. ; IN:
  151. ;  x
  152. ;  y
  153. ; OUT:
  154. ;  nothing
  155. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  156.  
  157. cgotoxy macro x, y
  158.         PUSH    (y shl 16)+x             ; wAttr
  159.         PUSH    [hconout]                ; hConsoleOutput
  160.         CALL    SetConsoleCursorPosition
  161. endm
  162.