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 ...
随机推荐
- worker 启动时向 etcd 注册自己的信息,并设置一个带 TTL 的租约,每隔一段时间更新这个 TTL,如果该 worker 挂掉了,这个 TTL 就会 expire 并删除相应的 key。
1.通过etcd中的选主机制,我们实现了服务的高可用.同时利用systemd对etcd本身进行了保活,只要etcd服务所在的机器没有宕机,进程就具备了容灾性. https://mp.weixin.qq ...
- CF 板刷总结
CF 板刷总结 这件事的开始要从万圣节那一天说起.当然,万圣节只用于描述时间,我显然是不参加任何万圣节活动的对吧. 以下是一些我觉得有必要拿出来讲的,有技术含量的题.会持续更新,断更了记得来催更. C ...
- python几个练习(素数、斐波那契数列)
随机输入求素数: x = int(input("please enter the number:")) if x != 1: for i in range(2, x): if x ...
- 设计模式c++(2)——策略模式
策略模式定义了算法族,分别封装起来,让它们之间可以互相替换,此模式让算法的变化独立于使用算法的客体. 书上的例子是鸭子,参考blog的例子是缓存算法.参考blog见:https://blog.csdn ...
- string知识
因为历史原因以及为了与C语言兼容,字符串字面值与标准库string类型不是同一种类型.这一点很容易引起混乱,编程时一定要注意区分字符串字面值和string数据类型的使用,这很重要. 额~~~C字符串是 ...
- trunk
今天我们一起聊trunk(接vlan之后),一台switch我们用vlan就可以划分vlan(虚拟局域网),但是2台switch该怎么办呢? 实验环境搭建 switch0 : enable //切换到 ...
- CSS开发过程中的20个快速提升技巧
摘要:本文涵盖了20个CSS技巧,可以解决许多工作中常见的问题, 让你也成为一个CSS高手. 1.使用CSS重置(reset) css重置库如normalize.css已经被使用很多年了,它们可以为你 ...
- xls与csv文件的区别
CSV是文本文件,用记事本就能打开.XLS 是二进制的文件只有用 EXCEL 才能打开:CSV 文件格式只能保存活动工作表中的单元格所显示的文本和数值.XLS 中所有的数据行和字符都将保存.数据列以逗 ...
- mysql查询太慢,我们如何进行性能优化?
老刘是即将找工作的研究生,自学大数据开发,一路走来,感慨颇深,网上大数据的资料良莠不齐,于是想写一份详细的大数据开发指南.这份指南把大数据的[基础知识][框架分析][源码理解]都用自己的话描述出来,让 ...
- Codeforces Global Round 11 B. Chess Cheater(贪心)
题目链接:https://codeforces.com/contest/1427/problem/B 题意 给出一个长为 \(n\) 由 W, L 组成的字符串,如果一个 W 左侧为 W,则它提供 2 ...