reading from File in assembly

血红的双手。 提交于 2020-06-26 14:47:16

问题


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 21h

  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

回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/2648388/reading-from-file-in-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!