xxx.asm:

%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16 section .text
global dllmain
export astrchr dllmain:
mov eax,1
ret 12 astrchr:
push ebp
mov ebp,esp mov eax,[p1] ; char ptr
mov ecx,[p2] ; char .for:
;-------------------------------------------;
; 找到后返回第一次出现的指针
;-------------------------------------------;
cmp [eax],cl
je .return
inc eax ;-------------------------------------------;
; 如果找不到该字符,则该函数返回空指针
;-------------------------------------------;
cmp byte [eax],0
je .error
jmp .for .error:
xor eax,eax .return:
mov esp,ebp
pop ebp
ret 8

c++:

#include <iostream>
#include <Windows.h> typedef char*(CALLBACK* astrchr_t)(const char* str, int character); astrchr_t astrchr; int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrchr = (astrchr_t)GetProcAddress(myDLL, "astrchr"); char str[] = "hello world"; char* pch = strchr(str, 'l');
printf("%s\n", pch); // llo world char* pch2 = astrchr(str, 'l');
printf("%s\n", pch2); // llo world //==============================// char* pch3 = strchr(str, 'b');
printf("%s\n", pch3); // (null) char* pch4 = astrchr(str, 'b');
printf("%s\n", pch4); // (null)
return 0;
}

nasm astrchr函数 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 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. poj2631

    求一棵树的直径,所谓直径就是树上距离最远的两个点! 树形动归,每个点的为根的子树的最长向下链和次长链的和! 当然也可以二次深搜! ----------------------------------- ...

  2. hbuilder使用技巧总结

    HBuilder是DCloud(数字天堂)推出的一款支持HTML5的Web开发IDE.HBuilder的编写用到了Java.C.Web和Ruby.HBuilder本身主体是由Java编写,它基于Ecl ...

  3. js部分知识整理,google浏览器的代码调试

    整理一些学过的js知识点,包括js中3个括号的含义,this的使用,递归,google浏览器的代码调试.Location的属性及常用方法,window对象常用方法,open方法等. js括号 在js中 ...

  4. logstash的S3 input插件

    logstash从AWS S3获取日志信息的常用方法有两种,一种是利用AWS lambda,另一种就是利用logstash的S3 input插件. 插件github:https://github.co ...

  5. CVE-2018-4407(IOS缓冲区溢出漏洞)exp

    CVE-2018-4407为ios缓冲区溢出漏洞 exp: import scapyfrom scapy.all import * send(IP(dst="同一局域网内目标Ip" ...

  6. 二进制方法-部署k8s集群部署1.18版本

    二进制方法-部署k8s集群部署1.18版本 1. 前置知识点 1.1 生产环境可部署kubernetes集群的两种方式 目前生产部署Kubernetes集群主要有两种方式 kuberadm Kubea ...

  7. Sqoop export参数updatemode两种模式updateonly和allowinsert区别

    1.更新导出(updateonly模式)1.1参数说明-- update-key,更新标识,即根据某个字段进行更新,例如id,可以指定多个更新标识的字段,多个字段之间用逗号分隔. -- updatem ...

  8. impala支持的数据库里的double(float)类型,通过迁移inceptor后,类型的值都变成了null

    impala支持的数据库里的double(float)类型,通过迁移inceptor后,double类型的值都变成了null. 通过查阅日志发现默认将double转换成Decimal(38,10)然而 ...

  9. Codeforces Round #654 (Div. 2)

    比赛链接:https://codeforces.com/contest/1371 A. Magical Sticks 题意 有 $n$ 根小棍,长度从 $1$ 到 $n$,每次可以将两根小棍连接起来, ...

  10. Alternating Strings Gym - 100712D 简单dp && Alternating Strings II Gym - 100712L 数据结构优化dp

    比赛链接:https://vjudge.net/contest/405905#problem/D 题意: 给你一个长度为n的由0或1构成的串s,你需要切割这个串,要求切割之后的每一个子串长度要小于等于 ...