从程序集中的文件读取
我正在尝试从 x86 程序集中的文件中读取用户名和密码以进行身份验证 显然该文件由两行组成,用户名和密码,我如何分别读取这两行并比较它们?
我的尝试:
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
转到此处并阅读诸如创建文件和读取文件。
Go here and read up on functions like CreateFile and ReadFile.
您应该使用系统类来执行此操作,这取决于您使用 Windows 还是 Linux。
检查这个: http://www.freebsd .org/doc/en/books/developers-handbook/x86-system-calls.html
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