我是一个新的程序集,并尝试编写类似文件搜索器的东西。 我使用的这个片段与4个字母的掩码(FASM)进行比较:
lea eax,[fd.cFileName]
push eax
call [lstrlen]
cmp dword [fd.cFileName+eax-4],'.txt' ; extension comparing
je .finded
如何使用5个字母的扩展名更改此代码段,例如“.docx”? 谢谢。
答案 0 :(得分:0)
如果你想搜索不区分大小写,可能会有点复杂,但是像这样:
lea eax,[fd.cFileName]
push eax
call [lstrlen]
cmp eax, 5
jbe .not_found ; at least 6 characters name.
cmp dword [fd.cFileName+eax-5],'.doc' ; extension comparing
jne .not_found
cmp byte [fd.cFileName+eax-1], 'x'
jne .not_found
.found:
; some code
.not_found:
; some other code...