xxx.asm

%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16 section .text
global dllmain
export astrcspn dllmain:
mov eax,1
ret 12 ;---------------------------------------------------;
; 返回属于一组字符的字符在字符串中第一次出现的索引
;---------------------------------------------------;
astrcspn:
push ebp
mov ebp,esp
sub esp,8 mov edx,[p1] ; char ptr 1
mov ecx,[p2] ; char ptr 2
xor eax,eax ; 保存str2指针,和ebx寄存器
mov [ebp-4],ecx
mov [ebp-8],ebx ;-------------------------------------;
; 遍历 str1
;-------------------------------------;
.forStr1:
mov bh,[edx]
test bh,bh
jz .return ;-------------------------------------;
; 遍历str2,如果相等退出函数
;-------------------------------------;
.forStr2:
mov bl,[ecx]
test bl,bl
jz .forbreak
cmp bh,bl
je .return
inc ecx
jmp .forStr2 .forbreak:
mov ecx,[ebp-4]
inc edx
inc eax
jmp .forStr1 ;-------------------------------------;
; 恢复ebx寄存器,恢复堆栈
;-------------------------------------;
.return:
mov ebx,[ebp-8]
add esp,8
mov esp,ebp
pop ebp
ret 8

c++:

#include <iostream>
#include <Windows.h> typedef size_t (CALLBACK* astrcspn_t)(const char* str1, const char* str2); astrcspn_t astrcspn; int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrcspn = (astrcspn_t)GetProcAddress(myDLL, "astrcspn"); const char* str1 = "fcba73";
const char* str2 = "1234567890";
printf("%d\n", strcspn(str1, str2)); // 4
printf("%d\n", astrcspn(str1, str2)); // 4
return 0;
}

nasm astrcspn函数 x86的更多相关文章

  1. nasm astrspn函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  2. nasm astrchr函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...

  3. nasm astrlen函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  4. nasm aat函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain dllmain: ...

  5. nasm astrstr函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...

  6. nasm astrset_s函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  7. nasm astrrev函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  8. nasm astrrchr函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  9. nasm astrncmp函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...

随机推荐

  1. 在Centos7上安装Python+Selenium+Firefox+Geckodriver

    1.事先准备好Centos7的系统 Centos系统是CentOS Linux release 7.4.1708 (Core) 查看Centos内核版本命令cat /etc/centos-releas ...

  2. Codeforces 1220D 思维 数学 二分图基础

    原题链接 题意 我们有一个含多个正整数的集合B,然后我们将所有的整数,也就是Z集合内所有元素,都当做顶点 两个整数 \(i , j\) 能建立无向边,当且仅当 \(|i - j|\) 这个数属于B集合 ...

  3. Jmeter的客户端实现与Keep-Alive

    Jmeter的客户端实现与Keep-Alive 目录 Jmeter的客户端实现与Keep-Alive 0. 结论 1.缘起 1.1 起因 1.2 初步尝试 1.3 Jmeter客户端实现 1.4 Ja ...

  4. centos /usr/local 和/opt 安装软件你什么不同../configure --prefix=/usr...

    /usr/local下一般是你安装软件的目录,这个目录就相当于在windows下的programefiles这个目录(所有文件在一个文件夹) /opt这个目录是一些大型软件的安装目录,或者是一些服务程 ...

  5. 3. Linux常用系统状态检测命令

    1.ifconfig :于获取网卡配置与网络状态等信息,如网卡名称.IP.MAC等 2.uname -a :完整地查看当前系统的内核名称.主机名.内核发行版本.节点名.系统时间.硬件名称.硬件平台.处 ...

  6. Java-eclipse导入jar包

    Java-eclipse导入jar包 方法一:基本步骤式 右键项目属性,选择Property,在弹出的对话框左侧列表中选择Java Build Path,如下图所示:选择Add External JA ...

  7. vue-cli-----vue实例中template: '<App/>',这样写是什么意思

    我刚开始学,看这个东西看了好久,官网文档的描述我不太理解,今天终于算明白了 官网的描述: 模板将会替换挂载的元素.挂载元素的内容都将被忽略 也就是说:template: '<App/>' ...

  8. 【疯狂挖坑】linux服务器尝试中的问题(nohup等)

    实验环境:Ubuntu 16.0.4 首当其冲: 1. nohup使用及究极重要事项 我们用服务器肯定都是想在服务器存点什么.让服务器帮我们干点什么,这时候就需要nohup(no hang up)提供 ...

  9. Scala数据结构(数组,Map和Tuple)

    package com.zy import scala.collection.mutable import scala.collection.mutable.ArrayBuffer object te ...

  10. 【uva 714】Copying Books(算法效率--二分+贪心)

    题意:将1个含N个正整数的序列划分成K个连续的子序列,使每段的和的最大值尽量小,问字典序最小的划分方案. 解法:由于是连续的数的"最大值最小",便可想到二分每段的最大值,若这时可分 ...