Advertisement
kamasazi99

asm lab 7, 3 zad

Dec 4th, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .386
  2. .Model Flat,stdcall
  3. ;stale plik
  4. GENERIC_READ equ 80000000h
  5. GENERIC_WRITE equ 40000000h
  6. CREATE_NEW equ 1
  7. CREATE_ALWAYS equ 2
  8. OPEN_EXISTING equ 3
  9. OPEN_ALWAYS equ 4
  10. ;normal
  11. WriteConsoleA PROTO:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
  12. GetStdHandle PROTO:DWORD
  13. ExitProcess PROTO:DWORD
  14. ;plik
  15. ReadFile PROTO :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  16. CreateFileA PROTO :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
  17.  
  18. .data
  19. ;plik
  20. path byte "C:\Users\Hubert\source\repos\lab07\2\MyFile.txt",0
  21. handle_plik DWORD 0
  22. ;normal
  23. buffor byte 255 dup(0)
  24. odczytane DWORD 0
  25. ;wypisz consola
  26. wypisz DWORD 0
  27. .code
  28. main proc
  29.  
  30. invoke CreateFileA, offset path,GENERIC_READ,0,0,OPEN_EXISTING,0,0
  31. mov handle_plik,eax
  32. invoke ReadFile, handle_plik,offset buffor, lengthof buffor, offset odczytane,0
  33.  
  34. invoke GetStdHandle, -11
  35. mov wypisz,eax
  36.  
  37. invoke WriteConsoleA, wypisz,offset buffor, lengthof buffor, offset odczytane,0
  38.  
  39.  
  40. invoke ExitProcess,0
  41. main endp
  42. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement