nasm astrchr函数 x86
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的更多相关文章
- 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 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 ...
随机推荐
- (万字好文)Dubbo服务熔断与降级的深入讲解&代码实战
原文链接:(万字好文)Dubbo服务熔断与降级的深入讲解&代码实战 一.Dubbo服务降级实战 1 mock 机制 谈到服务降级,Dubbo 本身就提供了服务降级的机制:而 Dubbo 的服务 ...
- noip 注意事项 (个人向)
目录 非常重要 对拍 空间 极限数据 模数,YES/NO等大小写 个人 考场 神仙 czdzx 说要写,我也来写 非常重要 对拍 空间 极限数据 模数,YES/NO等大小写 个人 养身体,不要紧张,不 ...
- Zookeeper语法
ZooKeeper 是一个典型的分布式数据一致性解决方案,分布式应用程序可以基于 ZooKeeper 实现诸如数据发布/订阅.负载均衡.命名服务.分布式协调/通知.集群管理.Master 选举.分布式 ...
- 在项目中如何自定义的Eslint配置
一.设置js风格的缩进为4个空格 在你的前端项目中找到.eslintrc.js文件,如图 module.exports = { root: true, parserOptions: { parser: ...
- 五:Spring Security 中的角色继承问题
Spring Security 中的角色继承问题 以前的写法 现在的写法 源码分析 SpringSecurity 在角色继承上有两种不同的写法,在 Spring Boot2.0.8(对应 Spring ...
- Java 操作Oracle数据库
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import ...
- nginx教程<二>(高可用)
1.nginx集群 对于访问量较大的网站来说,随着流量的增加单台服务器已经无法处理所有的请求,这时候需要多台服务器对大量的请求进行分流处理,即负载均衡. 而如果实现负载均衡,必须在网站的入口部署服务器 ...
- memcache安装及解决无法远程连接的问题
Memcached是什么 Memcached是一个自由开源的,高性能,分布式内存对象缓存系统. Memcached是以LiveJournal旗下Danga Interactive公司的Brad Fit ...
- SpringMVC学习笔记2
一.日期赋值 目标:在springMVC中日期赋值兼容性更广泛 不能直接处理,必须使用转换器1.定义转换器,实现接口Converter<From,To> package com.zy.co ...
- CF-1333F Kate and imperfection
F. Kate and imperfection 假设一个一个的往集合里面放元素,显然在放某个元素之前,我们不想让它的倍数已经在集合里面.因为在这之前,我们不如先把这个数放进去,再把它的倍数放进去更优 ...