xxx.asm:

%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16 section .text
global dllmain
export astrstr dllmain:
mov eax,1
ret 12 ;-------------------------------------------------------------;
; 返回一个指针,该指针指向字符串中第一次出现的搜索字符串
;-------------------------------------------------------------;
astrstr:
push ebp
mov ebp,esp
sub esp,4 mov ecx,[p1] ; const char *str
mov edx,[p2] ; const char *strSearch mov [ebp-4],ecx .for:
mov ah,[edx]
mov al,[ecx] ;--------------------------------------------------;
; strSearch 全部查找完
;--------------------------------------------------;
test ah,ah
jz .find ;--------------------------------------------------;
; str 全部查找完
;--------------------------------------------------;
test al,al
jz .notFind ;--------------------------------------------------;
; 如果相等进行下一个strSearch字符的判断
;--------------------------------------------------;
cmp ah,al
je .foarchNext ;--------------------------------------------------;
; 不相等进行下一个str字符的判断
; 如果strSearch指针变动,则恢复strSearch指针
;--------------------------------------------------;
cmp edx,[p2]
jne .reSearch
inc ecx
mov [ebp-4],ecx
jmp .for .reSearch:
mov edx,[p2]
mov [ebp-4],ecx
jmp .for .foarchNext:
inc ecx
inc edx
jmp .for .notFind:
xor eax,eax
jmp .return .find:
mov eax,[ebp-4]
jmp .return .return:
add esp,4
mov esp,ebp
pop ebp
ret 8

c++:

#include <iostream>
#include <Windows.h> typedef int (CALLBACK* astrstr_t)(const char* str, const char* strCharSet);
astrstr_t astrstr; int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrstr = (astrstr_t)GetProcAddress(myDLL, "astrstr"); const char* s1 = "hello world";
const char* s2 = "ll";
printf("%s\n", strstr( s1, s2)); // llo world
printf("%s\n", astrstr(s1, s2)); // llo world
return 0;
}

nasm astrstr函数 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 astrcspn函数 x86

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

  3. nasm astrchr函数 x86

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

  4. nasm astrlen函数 x86

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

  5. nasm aat函数 x86

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

  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. 九:SpringBoot-整合Mybatis框架,集成分页助手插件

    九:SpringBoot-整合Mybatis框架,集成分页助手插件 1.Mybatis框架 1.1 mybatis特点 1.2 适用场景 2.SpringBoot整合MyBatis 2.1 核心依赖 ...

  2. JavaWeb——Servlet开发

    什么是Servlet? Servlet运行的过程 Servlet的生命周期 生命周期的各个阶段 Servlet的配置 使用Web.xml配置 使用注解配置 Servlet相关接口 ServletCon ...

  3. Spark-读写HBase,SparkStreaming操作,Spark的HBase相关操作

    Spark-读写HBase,SparkStreaming操作,Spark的HBase相关操作 1.sparkstreaming实时写入Hbase(saveAsNewAPIHadoopDataset方法 ...

  4. docker 安装 nexus3 初始密码不再是admin123

    最近在docker上安装 nexus3 ,参照之前博客都提示 初始密码是admin/admin123 但是登录的时候出现如下提示: 很显然提示  admin用户的密码在/nexus-data/admi ...

  5. checkAll操作

    //全部勾选 function checkAll(obj) { var cols = document.getElementsByName('cols'); for ( var i = 0; null ...

  6. 1.VLAN

    1.定位:VLAN,即虚拟局域网(Virtual Local Area Network),一种将局域网设备从逻辑上划分成一个个网段,从而实现虚拟工作组的新兴数据交换技术.VLAN是将一个物理的LAN在 ...

  7. 2019牛客暑期多校训练营(第七场)H.Pair(数位dp)

    题意:给你三个数A,B,C 现在要你找到满足  A and B >C 或者 A 异或 B < C 的对数. 思路:我们可以走对立面 把既满足 A and B <= C 也满足 A 异 ...

  8. Power Strings POJ - 2406 后缀数组

    Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc&quo ...

  9. python爬虫下载小视频和小说(基础)

    下载视频: 1 from bs4 import BeautifulSoup 2 import requests 3 import re 4 import urllib 5 6 7 def callba ...

  10. 2.使用jenkins自动构建并发布应用到k8s集群

    作者 微信:tangy8080 电子邮箱:914661180@qq.com 更新时间:2019-06-21 14:39:01 星期五 欢迎您订阅和分享我的订阅号,订阅号内会不定期分享一些我自己学习过程 ...