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 ...
随机推荐
- Mysql 四种事务隔离级别
一.前提 时过一年重新拾起博文记录,希望后面都能坚持下来. 接着之前MySql的学习,先记录下这篇. 以下都是基于mysql8 innodb存储引擎进行分析的. 二.事务的ACID特性 A(Atomi ...
- 在Ubuntu安装Docker
1.查看Linux内核依赖 kernel version >= 3.8 查看代码: uname -a | awk '{split($3, arr, "-"); print a ...
- JavaWeb——B/S,C/S结构,HTTP协议
B/S: 开发基于B/S结构项目:目前主要采用三种服务器端语言:JSP,PHP,ASP.NET. 这三种语言构成三种常用应用开发组合:JSP+Oracle组合.PHP+MySQL体系.以及ASP.NE ...
- Java中String对象创建机制详解()
一String 使用 private final char value来实现字符串存储 二Java中String的创建方法四种 三在深入了解String创建机制之前要先了解一个重要概念常量池Const ...
- vulnhub靶场之AI-WEB1.0渗透记录
在本机电脑上自行搭建了一个练手的靶场,下面是记录渗透过程 目录 一.确认靶机ip 二.端口&目录扫描 三.查看敏感目录 四.sql注入 五.get shell 六.系统提权 确认靶机ip ka ...
- 彻底掌握 AQS
前言 AQS( AbstractQueuedSynchronizer )是一个用来构建锁和同步器(所谓同步,是指线程之间的通信.协作)的框架,Lock 包中的各种锁(如常见的 ReentrantLoc ...
- cassandra权威指南读书笔记--读写数据
写cassandra除了轻量级事务,不支持别的事务.cassandra是追加写,写的速度非常快.cassandra还有hint日志,这个数据库总是可写的,而且单个列的写操作是原子的.hint并不是一定 ...
- HanLP 下载和配置
方式一.Maven 为了方便用户,特提供内置了数据包的Portable版,只需在pom.xml加入: <dependency> <groupId>com.hankcs</ ...
- Codeforces Round #570 (Div. 3) E. Subsequences (easy version) (搜索,STL)
题意:有一长度为\(n\)的字符串,要求得到\(k\)不同的它的子序列(可以是空串),每个子序列有\(|n|-|t|\)的贡献,求合法情况下的最小贡献. 题解:直接撸个爆搜找出所有子序列然后放到set ...
- Butterfly美化
Butterfly美化 首先提示,本文量特别大哦!基本上有所有的美化,还在持续更新ing,谨慎入坑......... 主题配置文件修改 基础配置 最最最开始的,好不容易搭建了自己的个人博客,当然要写上 ...