nasm astrspn函数 x86
xxx.asm
%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16
section .text
global dllmain
export astrspn
dllmain:
mov eax,1
ret 12
;---------------------------------------------------;
; 返回不属于一组字符的字符串中第一个字符的索引
;---------------------------------------------------;
astrspn:
push ebp
mov ebp,esp
sub esp,8
mov edx,[p1] ; const char *str
mov ecx,[p2] ; const char *strCharSet
xor eax,eax
; 临时变量
mov [ebp-4],ecx
mov [ebp-8],ebx
;-------------------------------------;
; 遍历 str
;-------------------------------------;
.forStr:
mov bh,[edx]
test bh,bh
jz .return
;-------------------------------------;
; 遍历 strCharSet
;-------------------------------------;
.forStrCharSet:
mov bl,[ecx]
test bl,bl
jz .return ; 没找到退出函数
cmp bh,bl
je .forbreak ; 相等 next str
inc ecx
jmp .forStrCharSet ; 不相等 next strCharSet
.forbreak:
mov ecx,[ebp-4]
inc edx
inc eax
jmp .forStr
.return:
mov ebx,[ebp-8]
add esp,8
mov esp,ebp
pop ebp
ret 8
c++:
#include <iostream>
#include <Windows.h>
typedef int (CALLBACK* astrspn_t)(const char* str, const char* strCharSet);
astrspn_t astrspn;
int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrspn = (astrspn_t)GetProcAddress(myDLL, "astrspn");
printf("%d\n", strspn( "abbbc", "ab")); // 4
printf("%d\n", astrspn("abbbc", "ab")); // 4
return 0;
}
nasm astrspn函数 x86的更多相关文章
- 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 ...
- nasm astrncmp函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
随机推荐
- Jackson学习
Jackson 是一个能够将java对象序列化为JSON字符串,也能够将JSON字符串反序列化为java对象的框架. 本文的所有内容都可以从 Java JSON Jackson Introductio ...
- Redis集群动态增加和删除节点
一.添加节点 1.首先将需要添加的节点启动: 这里启动redis6383.conf和redis6393.conf两个节点 查看原有节点: 3个主节点所对应的哈希槽(hash slo ...
- Kafka客户端Producer与Consumer
Kafka客户端Producer与Consumer 一.pom.xml 二.相关配置文件 producer.properties log4j.properties base.properties 三. ...
- python自动化之使用allure生成测试报告
Allure测试报告框架帮助你轻松实现"高大上"报告展示.本文通过示例演示如何从0到1集成Allure测试框架.重点展示了如何将Allure集成到已有的自动化测试工程中.以及如何实 ...
- C# 如何复制(拷贝)Label控件上的文本【新方法】
Label控件在目前是无法直接调用成员函数来复制其文本内容.其实网络上有很多热心程序员网民解答过这个问题,百度上也可以搜索到,不过大多数人建议使用 TextBox 并把边框调整为不可见(运行时文本框看 ...
- F - Courses (学生选课(匈牙利算法模板))
题目大意:一共有N个学生跟P门课程,一个学生可以任意选一门或多门课,问是否达成: 1.每个学生选的都是不同的课(即不能有两个学生选同一门课) 2.每门课都有一个代表(即P门课都被成功选过) 输入为: ...
- 找新朋友 HDU - 1286 欧拉函数模板题
题意: 求出来区间[1,n]内与n互质的数的数量 题解: 典型的欧拉函数应用,具体见这里:Relatives POJ - 2407 欧拉函数 代码: 1 #include<stdio.h> ...
- poj1180 Batch Scheduling
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 3590 Accepted: 1654 Description There ...
- hdu4528 小明系列故事——捉迷藏
Time Limit: 500/200 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s ...
- Drone构建失败,一次drone依赖下载超时导致构建失败的爬坑记录
Once upon a time, birds were singing in the forest, and people were dancing under the trees, It's so ...