nasm astrcmp函数 x86
xxx.asm:
%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16
section .text
global dllmain
export astrcmp
dllmain:
mov eax,1
ret 12
astrcmp:
push ebp
mov ebp,esp
push ebx
mov eax,[p1] ; char ptr 1
mov ecx,[p2] ; char ptr 2
.for:
mov dl,[eax]
mov bl,[ecx]
cmp dl,bl
jc .r1
jne .r3
test dl,bl
jz .r2
inc eax
inc ecx
jmp .for
;-----------------------------------------------------;
; <0 第一个不匹配的字符在ptr1中的值比在ptr2中的值低
;-----------------------------------------------------;
.r1:
xor eax,eax
not eax
jmp .return
;-----------------------------------------------------;
; 0 两个字符串的内容相等
;-----------------------------------------------------;
.r2:
xor eax,eax
jmp .return
;-----------------------------------------------------;
; >0 第一个不匹配的字符在ptr1中的值大于在ptr2中的值
;-----------------------------------------------------;
.r3:
mov eax,1
jmp .return
.return:
pop ebx
mov esp,ebp
pop ebp
ret 8
c++:
#include <iostream>
#include <Windows.h>
typedef int(CALLBACK* astrcmp_t)(const char* str1, const char* str2);
astrcmp_t astrcmp;
int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrcmp = (astrcmp_t)GetProcAddress(myDLL, "astrcmp");
printf("%x\n", astrcmp("12", "22")); // -1
printf("%x\n", astrcmp("12", "12")); // 0
printf("%x\n", astrcmp("22", "12")); // 1
return 0;
}
nasm astrcmp函数 x86的更多相关文章
- nasm astrspn函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrcspn函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrchr函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
- nasm astrlen函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm aat函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain dllmain: ...
- nasm astrstr函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
- nasm astrset_s函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrrev函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrrchr函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
随机推荐
- numpy pandas 学习
一. 数组要比列表效率高很多 numpy高效的处理数据,提供数组的支持,python默认没有数组.pandas.scipy.matplotlib都依赖numpy. pandas主要用于数据挖掘,探索, ...
- 在项目中如何自定义的Eslint配置
一.设置js风格的缩进为4个空格 在你的前端项目中找到.eslintrc.js文件,如图 module.exports = { root: true, parserOptions: { parser: ...
- Spark 应用监控告警-Graphite_exporter
Spark 应用监控告警-Graphite_exporter Spark监控和工具 Web界面 事后查看 REST API 度量 高级工具 一.下载graphite_exporter 1.1 修改gr ...
- Web漏洞扫描-AWVS
Web漏洞扫描-AWVS 一.AWVS概述 二.功能以及特点 三.AWVS界面 四.AWVS使用 相关优质博文: CSDN:帽子不够白:WEB渗透测试之三大漏扫神器 一.AWVS概述 Acunetix ...
- Java 实现Redis客户端,服务端
Java 实现Redis客户端,服务端 1.Java实现Redis发布订阅 1.1实例 2.[Redis]Java实现redis消息订阅/发布(PubSub) 3.java实现 redis的发布订阅 ...
- WAMP3.1.3自定义根目录
1.首先找到httpd.conf 文件,搜索documentroot 修改前:DocumentRoot "${INSTALL_DIR}/www" <Directory &qu ...
- jquery each报 Uncaught TypeError: Cannot use 'in' operator to search for错误
用$.each()来遍历后台传过来的json数据.直接遍历传过来的数据时就发生 Uncaught TypeError: Cannot use 'in' operator to search for 这 ...
- 设计模式(五)——原型模式(加Spring框架源码分析)
原型模式 1 克隆羊问题 现在有一只羊 tom,姓名为: tom, 年龄为:1,颜色为:白色,请编写程序创建和 tom 羊 属性完全相同的 10 只羊. 2 传统方式解决克隆羊问题 1) 思路分析(图 ...
- 负载均衡之LVS与Nginx对比
今天总结一下负载均衡中LVS与Nginx的区别,好几篇博文一开始就说LVS是单向的,Nginx是双向的,我个人认为这是不准确的,LVS三种模式中,虽然DR模式以及TUN模式只有请求的报文经过Direc ...
- linux中在某个目录下多个文件中搜索关键字
有四种方法: find 文件目录 -name '*.*' -exec grep 'xxx' {} + -n 或是 find 文件目录 -name '*.*' | xargs grep 'xxx' -n ...