Guest User

Untitled

a guest
Jun 22nd, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. .586p
  2. .mmx
  3. .model flat, stdcall
  4. option casemap :none
  5.  
  6. include \masm32\include\windows.inc
  7. include \masm32\include\user32.inc
  8. include \masm32\include\kernel32.inc
  9. include \masm32\include\masm32.inc
  10. include \masm32\include\comctl32.inc
  11. include \masm32\macros\macros.asm
  12.  
  13. includelib \masm32\lib\user32.lib
  14. includelib \masm32\lib\kernel32.lib
  15. includelib \masm32\lib\comctl32.lib
  16. includelib \masm32\lib\masm32.lib
  17.  
  18. .data
  19.  
  20. szFile db "target.exe",0
  21. bCnt dd 0
  22.  
  23. .data?
  24.  
  25. startOffset dd ?
  26. noSec dd ?
  27. dataSec dd ?
  28. rsrcSec dd ?
  29.  
  30. .code
  31.  
  32. main proc
  33.  
  34. fn InitCommonControls
  35.  
  36. fn CreateFile, addr szFile, GENERIC_READ, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL
  37.  
  38. .if eax == INVALID_HANDLE_VALUE
  39. fn MessageBox, 0, "File is missing!", "Info", MB_OK OR MB_ICONHAND
  40. .endif
  41.  
  42. fn CreateFileMapping, eax, NULL, PAGE_READONLY, 0, 0, NULL
  43.  
  44. fn MapViewOfFile, eax, FILE_MAP_READ, 0, 0, 0
  45.  
  46. mov startOffset,eax
  47.  
  48. add eax,[eax+3Ch]
  49. movzx edx,byte ptr [eax+6]
  50. mov noSec,edx
  51. add eax,0F8h
  52.  
  53. @loop:
  54. cmp byte ptr bCnt,1
  55. je @data_sec_found
  56. cmp
  57. add eax,28h
  58. dec byte ptr noSec
  59. jmp @loop
  60.  
  61. @lastfound:
  62. add eax,8
  63.  
  64.  
  65. fn UnmapViewOfFile, startOffset
  66.  
  67. ret
  68.  
  69. main endp
  70.  
  71. end main
Add Comment
Please, Sign In to add comment