Advertisement
dllbridge

FASM example

Nov 21st, 2022
1,313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.  
  4. format  PE console
  5. entry   start
  6. include 'win32ax.inc'
  7. include 'api\kernel32.inc'
  8.  
  9.  
  10.  
  11. ;------------------------------------------------             Создание переменных:
  12. section '.data' data readable writeable
  13.  
  14.  
  15.            n     dd  92  ; Переменная n (4 байта)
  16.  
  17.  
  18. ;------------------------------------------------                   Код программы:
  19. section '.code' code readable executable
  20.  
  21.  
  22.  start:    mov eax, 15
  23.  
  24.            add eax, [n]
  25.  
  26.            cmp eax, 100
  27.            jz  L_03             ; Если eax == 100
  28.            jg  L_02             ; Если eax  > 100
  29.  
  30.            cinvoke  printf, <"eax = %3d < 100", 10, 0>, eax
  31.            jmp L_04
  32.  L_02:     cinvoke  printf, <"eax = %3d > 100", 10, 0>, eax
  33.            jmp L_04
  34.  L_03:     cinvoke  printf, <"eax = %3d = 100", 10, 0>, eax
  35.  
  36.  L_04:     cinvoke  scanf, <"%d", 10, 0>, n
  37.            invoke   ExitProcess, 0
  38.  
  39.  
  40.  
  41. ;------------------------------------------------           Подключение библиотек:
  42. section '.idata' import data readable
  43. library kernel32, 'kernel32.dll',\
  44.         msvcrt,   'msvcrt.dll'
  45.  
  46. import msvcrt,\
  47.        printf, 'printf',\
  48.        scanf,  'scanf'
  49.  
  50.  
  51.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement