开发者

reading from File in assembly

开发者 https://www.devze.com 2022-12-26 19:32 出处:网络
i am trying to read a username and a password from a file in x86 assembly for the perpose of authentication

i am trying to read a username and a password from a file in x86 assembly for the perpose of authentication obviously the file consists of two lines , the user name and the password how can i read the two lines seperately and compare them?

My attempt:

proc read_file

  mov ah,3dh
  lea dx,file_name
  int 21h

  mov bx, ax 
  xor si,si

repeat:

  mov ah, 3fh
  lea dx, buffer
  mov cx, 100 
  int 2开发者_JAVA技巧1h

  mov si, ax
  mov buffer[si], '$'
  mov ah, 09h
  int 21h ;print on screen


  cmp si, 100
  je repeat 

  jmp stop;jump to end
stop:
   RET
    read_file ENDP


Go here and read up on functions like CreateFile and ReadFile.


You should use system class to do that and it depends on whether you use Windows or Linux. Check this : http://www.freebsd.org/doc/en/books/developers-handbook/x86-system-calls.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号