bunnytaur

bunnyboi

Aug 1st, 2008
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. .586 ; create 32 bit code
  2. .model flat, stdcall ; 32 bit memory model
  3. option casemap :none ; case sensitive
  4.  
  5. include test.inc
  6.  
  7. .data
  8. rlen dd 0
  9. .radix 16
  10. buff db 05,45,6D,61,69,6C,0A,59,61,68,6F,6F,20,4D,6A,69,6C,0,0,0
  11. .radix 10
  12.  
  13. .code
  14. ; �������������������������������������������������������������������������
  15. start:
  16. ; �������������������������������������������������������������������������
  17. xor ebx, ebx
  18. .WHILE ebx < SIZEOF buff
  19. mov al, [buff+ebx]
  20. print xbyte$(al)
  21. .IF ebx < SIZEOF buff - 1
  22. print chr$(",")
  23. .ENDIF
  24. inc ebx
  25. .ENDW
  26. print chr$(13,10)
  27. invoke CreateFile,chr$("testdat.txt"),
  28. GENERIC_READ or GENERIC_WRITE,
  29. NULL,
  30. NULL,
  31. CREATE_ALWAYS,
  32. FILE_ATTRIBUTE_NORMAL,
  33. NULL
  34. mov ebx, eax
  35. print "file handle "
  36. print ustr$(ebx),13,10
  37.  
  38. invoke WriteFile, ebx, ADDR buff, SIZEOF buff, ADDR rlen, NULL
  39. print "bytes written "
  40. print ustr$(rlen),13,10
  41.  
  42. print "new file pointer "
  43. invoke SetFilePointer,ebx, 0, 0, FILE_BEGIN
  44. print ustr$(eax),13,10
  45.  
  46. invoke ReadFile, ebx, ADDR buff, SIZEOF buff, ADDR rlen, NULL
  47. print "bytes read "
  48. print ustr$(rlen),13,10
  49.  
  50. xor ebx, ebx
  51. .WHILE ebx < SIZEOF buff
  52. mov al, [buff+ebx]
  53. print xbyte$(al)
  54. .IF ebx < SIZEOF buff - 1
  55. print chr$(",")
  56. .ENDIF
  57. inc ebx
  58. .ENDW
  59. print chr$(13,10)
  60.  
  61. inkey "Press any key to exit..."
  62. exit
  63. ; �������������������������������������������������������������������������
  64. end start
Add Comment
Please, Sign In to add comment