nasm astrrev函数 x86
xxx.asm
%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16
section .text
global dllmain
export astrrev
dllmain:
mov eax,1
ret 12
;------------------------------------------------;
; 反转字符串的字符。
;------------------------------------------------;
astrrev:
push ebp
mov ebp,esp
mov ecx,[p1] ; char *str
mov edx,[p1]
;------------------------------------------------;
; get last
;------------------------------------------------;
.getLast:
mov ah,[ecx]
test ah,ah
jz .getLastBreak
inc ecx
jmp .getLast
.getLastBreak:
dec ecx
.rev:
cmp ecx,edx
jc .return ; 偶数ecx会小于edx
je .return ; 奇数会相等
;------------------------------------------------;
; 交换字节
;------------------------------------------------;
mov ah,[ecx]
mov al,[edx]
mov [edx],ah
mov [ecx],al
; next
dec ecx
inc edx
jmp .rev
.return:
mov eax,[p1] ; 返回原始指针
mov esp,ebp
pop ebp
ret 4
c++:
#include <iostream>
#include <Windows.h>
#include <tchar.h>
#include <string>
typedef char* (CALLBACK* astrrev_t)(char* str);
astrrev_t astrrev;
int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrrev = (astrrev_t)GetProcAddress(myDLL, "astrrev");
char s[12] = "hello world";
printf("%s, %s\n", _strrev(s), s); // dlrow olleh, dlrow olleh
printf("%s, %s\n", astrrev(s), s); // hello world, hello world
return 0;
}
nasm astrrev函数 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 astrchr函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
- 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 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 ...
随机推荐
- 使用JWT创建安全的ASP.NET Core Web API
在本文中,你将学习如何在ASP.NET Core Web API中使用JWT身份验证.我将在编写代码时逐步简化.我们将构建两个终结点,一个用于客户登录,另一个用于获取客户订单.这些api将连接到在本地 ...
- 莫队/se 优雅的暴力
莫队算法 发明者:队爷莫涛 基于分块的一种暴力算法, 复杂度最慢可以被卡到\(n^2\)正常情况下的复杂度大约在\(O(n\sqrt{n})\)左右分块的大小对复杂的影响很大其中最优分块的大小为\(\ ...
- HDU1814和平委员会
题目大意: 有n对的人,编号从1-2*n,m对的人之间互相不喜欢,每对人中必徐选1个人加入和平委员会,求字典序最小的解 -------------------------------- 2-SAT问题 ...
- 设计模式c++(5)——工厂模式
工厂方法模式定义了一个创建对象的接口,但由子类决定要实例化的类是哪一个.工厂方法让类把实例化推迟到子类. 总的来说,就是工厂方法模式封装了对象的创建,通过让子类决定该创建的对象是什么,来达到将对象创建 ...
- redis学习教程二《四大数据类型》
redis学习教程二<四大数据类型> 四大数据类型包括:字符串 哈希 列表 集合一 : Redis字符串 Redis字符串命令用于管理Redis中的字符串 ...
- Horde Groupware Webmail Edition 远程命令执行
saturn:~ mr_me$ ./poc.py (+) usage ./poc.py <target> <path> <user:pass> <connec ...
- 2.二层常用技术-Portfast和BPDU Guard、BPDU Filter
PortFast (生成树端口加速) 1.在交换机上使用portfast命令,可以防止出现由于STP的收敛时间太长,导致主机的DHCP请求超时,从而使主机不能接收到DHCP地址的问题. 确保有一台服务 ...
- git submodule添加、更新和删除
添加 git submodule add <url> <path> url:替换为自己要引入的子模块仓库地址 path:要存放的本地路径 执行添加命令成功后,可以在当前路径中看 ...
- AtCoder - agc043_a 和 POJ - 2336 dp
题意: 给你一个n行m列由'#'和'.'构成的矩阵,你需要从(1,1)点走到(n,m)点,你每次只能向右或者向下走,且只能走'.'的位置. 你可以执行操作改变矩阵: 你可以选取两个点,r0,c0;r1 ...
- vector总结
vector是不定长数组,具有静态数组的稳定性和动态分配内存的灵活性,在赛场上不失为指针之外牺牲部分时间的保险之举. 本文先介绍一些vector常用的函数(部分借鉴一篇博客中的内容 链接),并以此为铺 ...