nasm astricmp函数 x86
xxx.asm:
%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16
section .text
global dllmain
export astricmp
dllmain:
mov eax,1
ret 12
;-------------------------------------------;
; 对字符串(char)进行不区分大小写的比较。
;-------------------------------------------;
astricmp:
push ebp
mov ebp,esp
sub esp,12
%define pStr1 edx
%define pStr2 ecx
mov pStr1,[p1] ; char ptr1
mov pStr2,[p2] ; char ptr2
mov [ebp-12],ebx
.for:
mov [ebp-4],pStr1
mov [ebp-8],pStr2
mov bh,[pStr1]
mov bl,[pStr2]
mov al,bh
push eax
call _toLowerCase
mov bh,al
mov al,bl
push eax
call _toLowerCase
mov bl,al
test bh,bl
jz .identical
cmp bh,bl
jc .less
jne .greater ; 不相等跳
mov pStr1,[ebp-4]
mov pStr2,[ebp-8]
inc pStr1
inc pStr2
jmp .for
;-----------------------------------------------------;
; <0 string1 less than string2
;-----------------------------------------------------;
.less:
xor eax,eax
not eax
jmp .return
;-----------------------------------------------------;
; 0 string1 identical to string2
;-----------------------------------------------------;
.identical:
xor eax,eax
jmp .return
;-----------------------------------------------------;
; >0 string1 greater than string2
;-----------------------------------------------------;
.greater:
mov eax,1
jmp .return
.return:
mov ebx,[ebp-12]
add esp,12
mov esp,ebp
pop ebp
ret 8
_toLowerCase:
push ebp
mov ebp,esp
mov al,[p1] ; char
;----------------------------------------;
; 如果 < 0x41 return
;----------------------------------------;
cmp al,41h
jb .return
;----------------------------------------;
; 如果 > 0x5A return
;----------------------------------------;
cmp al,5Ah
ja .return
add al,20h
.return:
mov esp,ebp
pop ebp
ret 4
c++:
#include <iostream>
#include <Windows.h>
typedef size_t (CALLBACK* astricmp_t)(const char* str1, const char* str2);
astricmp_t astricmp;
int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astricmp = (astricmp_t)GetProcAddress(myDLL, "astricmp");
printf("%d\n", _stricmp("a", "a")); // 0
printf("%d\n", _stricmp("a", "A")); // 0
printf("%d\n", _stricmp("", "")); // 0
printf("%d\n", _stricmp("a", "b")); // -1
printf("%d\n", _stricmp("b", "a")); // 1
printf("//----------------------------------------\n");
printf("%d\n", astricmp("aaaa", "AaA")); // 0
printf("%d\n", astricmp("a", "A")); // 0
printf("%d\n", astricmp("", "")); // 0
printf("%d\n", astricmp("a", "b")); // -1
printf("%d\n", astricmp("b", "aaaaa")); // 1
return 0;
}
nasm astricmp函数 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 ...
随机推荐
- (十)整合 JWT 框架,解决Token跨域验证问题
整合 JWT 框架,解决Token跨域验证问题 1.传统Session认证 1.1 认证过程 1.2 存在问题 2.JWT简介 2.1 认证流程 2.2 JWT结构说明 2.3 JWT使用方式 3.S ...
- 渗透测试流程——渗透测试的9个步骤(转)
目录 明确目标 分析风险,获得授权 信息收集 漏洞探测(手动&自动) 漏洞验证 信息分析 利用漏洞,获取数据 信息整理 形成报告 1.明确目标 1)确定范围:测试的范围,如:IP.域名.内外网 ...
- HaspMap源码分析(JDK 1.8)
底层结构分析 上面这两张图分别画出了JDK 1.7.1.8底层数据结构,在JDK 1.7.1.8中都使用 了散列算法,但是在JDK 1.8中引入了红黑树,在链表的长度大于等于8并且hash桶的长度大于 ...
- Spring Boot配置,读取配置文件
Spring Boot配置,读取配置文件 一.配置Spring Boot 1.1 服务器配置 1.2 使用其他Web服务器 1.3 配置启动信息 1.4 配置浏览器显示ico 1.5 Yaml语法 1 ...
- 存储过程demo返回银行名称
create or replace procedure TEST_NUMO(Cityno IN VARCHAR2,--输入参数 Deptid IN VARCHAR2,--输入参数 Retval OUT ...
- Vue-Cli程序环境搭建
环境搭建 ##1.下载node.js cmd输入 node -v 查看是否能够正确打印出版本号 cmd输入 npm -v 查看是否能够正确打印出版本号 ##2.安装node.js淘宝镜像加速器 ### ...
- 使用C#实现数据结构堆
一. 堆的介绍: 堆是用来排序的,通常是一个可以被看做一棵树的数组对象.堆满足已下特性: 1. 堆中某个节点的值总是不大于或不小于其父节点的值 任意节点的值小于(或大于)它的所有后裔,所以最小元(或最 ...
- poj2923 Relocation
Description Emma and Eric are moving to their new house they bought after returning from their honey ...
- Codeforces Round #651 (Div. 2) B. GCD Compression (构造)
题意:有一个长度为\(2n\)的数组,删去两个元素,用剩下的元素每两两相加构造一个新数组,使得新数组所有元素的\(gcd\ne 1\).输出相加时两个数在原数组的位置. 题解:我们按照新数组所有元素均 ...
- net core 踩坑记录
静态文件要放到wwwroot目录中才能访问 linux服务器部署运行报错 System.Net.Http.HttpRequestException: The SSL connection could ...