SHARE
TWEET

statfs.asm

Ham62 Jan 25th, 2020 121 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;          static structs             ;
  3.  
  4. statfs:
  5.   .f_type:    dd 00h
  6.   .f_bsize:   dd 00h
  7.   .f_blocks:  dd 00h
  8.   .f_bfree:   dd 00h
  9.   .f_bavail:  dd 00h
  10.  
  11.   .f_files:   dd 00h
  12.   .f_free:    dd 00h
  13.   .f_fsid:    dq 00h
  14.   .f_namelen: dd 00h
  15.   .f_frsize:  dd 00h ; since linux 2.6
  16.   .f_flags:   dd 00h ; since linux 2.6.36
  17.  
  18. mov [statfs.f_type], dword 2
  19.  
  20. mov eax, [statfs.f_bsize]
  21.  
  22. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  23. ;          Dynamic structs            ;
  24.  
  25. f_type:    equ 0
  26. f_bsize:   equ f_type+4
  27. f_blocks:  equ f_bsize+4
  28. f_bfree:   equ f_blocks+4
  29. f_bavail:  equ f_bfree+4
  30. f_files:   equ f_bavail+4
  31. f_ffree:   equ f_files+4
  32. f_fsid:    equ f_ffree+4
  33. f_namelen: equ f_fsid+8
  34. f_frsize:  equ f_namelen+4
  35. f_flags:   equ f_frsize+4
  36.  
  37. ; OR we can do it like so:
  38.  
  39. %define f_type    0
  40. %define f_bsize   4
  41. %define f_blocks  8
  42. %define f_bfree   12
  43. %define f_bavail  16
  44. %define f_files   20
  45. %define f_ffree   24
  46. %define f_fsid    28
  47. %define f_namelen 36
  48. %define f_frsize  40
  49. %define f_flags   44
  50.  
  51. mov [edi+f_type], dword 12
  52. mov [myStruct+f_type, dword 12
  53.  
  54. mov eax, [myStruct+f_bsize]
  55. mov eax, [esi+f_bsize]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top