nasm astrcat_s函数 x86
xxx.asm
%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16
section .text
global dllmain
export astrcat_s
dllmain:
mov eax,1
ret 12
astrcat_s:
push ebp
mov ebp,esp
push ebx
mov ecx,[p1] ; dst char ptr
mov eax,[p2] ; src char ptr
mov edx,[p3] ; dwDstSize
; if dwDstSize==0 return FALSE
test edx,edx
jz .error
; get dst char end
.dstFor:
cmp byte [ecx],0
je .copyFor
inc ecx
dec edx
test edx,edx
jz .error
jmp .dstFor
.copyFor:
cmp byte [eax],0
je .success
dec edx
test edx,edx
jz .error
mov bl,byte [eax]
mov byte [ecx],bl
inc eax
inc ecx
jmp .copyFor
.error:
xor eax,eax
jmp .return
.success:
mov eax,1
jmp .return
.return:
pop ebx
mov esp,ebp
pop ebp
ret 12
c++:
#include <iostream>
#include <Windows.h>
typedef BOOL(CALLBACK* astrcat_s_t)(char* dst, const char* src, size_t dwDstSize);
astrcat_s_t astrcat_s;
int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrcat_s = (astrcat_s_t)GetProcAddress(myDLL, "astrcat_s");
const char* a = "hello";
const char* b = " world";
char dst[12] = { 0 };
if (!astrcat_s(dst, a, sizeof(dst)))
{
printf("astrcat_s 1 error.\n");
return 0;
}
if (!astrcat_s(dst, b, sizeof(dst)))
{
printf("astrcat_s 2 error.\n");
return 0;
}
printf("%p\n", dst);
printf("%s\n", dst); // hello world
return 0;
}
nasm astrcat_s函数 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 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 ...
随机推荐
- Spring整合SpringMVC + Mybatis基础框架的配置文件
目录 前言 1. Mybatis层编写 2. Spring层编写 1. Spring整合Mybatis 2. Spring整合service 3. SpringMVC层编写 1. 编写web.xml ...
- 《我想进大厂》之Zookeeper夺命连环9问
谈谈你对Zookeeper的理解? Zookeeper是一个开源的分布式协调服务,由雅虎公司创建,由于最初雅虎公司的内部研究小组的项目大多以动物的名字命名,所以后来就以Zookeeper(动物管理员) ...
- 小白搭建WNMP详细教程---PHP安装与设置
php的安装请参考WAMP中PHP的安装教程https://www.cnblogs.com/missbye/p/12049925.html 需要注意的是,我们下载的PHP版本要下载Non Thread ...
- ODS(Operational Data Store)定义
ODS(Operational Data Store)可操作的数据存储. 很多人对ODS究竟是什么有很多的困惑,ODS对于不同的人可以有不同的看法,我主要说说什么是最主流的定义.首先我们需要注意,OD ...
- hdu 2072 单词数(字符串)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2072 题意 每行输入由小写字母和空格组成,统计每行中不同的单词数. 题解 题解一 比较简洁的解法,读入 ...
- hdu1890 Robotic Sort (splay+区间翻转单点更新)
Problem Description Somewhere deep in the Czech Technical University buildings, there are laboratori ...
- [笔记]吞吐量(TPS)、QPS、并发数、响应时间(RT)概念
开发的原因,需要对吞吐量(TPS).QPS.并发数.响应时间(RT)几个概念做下了解,查自百度百科,记录如下: 1. 响应时间(RT) 响应时间是指系统对请求作出响应的时间.直观上看,这个指标与人对软 ...
- python-零基础入门-自学笔记
目录 第一章:计算机基础 1.1 硬件组成 1.2 操作系统分类 1.3 解释型和编译型介绍 第二章:Python入门 2.1 介绍 2.2 python涉及领域 2.2.1 哪些公司有使用Pytho ...
- 【论文笔记】AutoML for MCA on Mobile Devices——论文解读与代码解析
理论部分 方法介绍 本节将详细介绍AMC的算法流程.AMC旨在自动地找出每层的冗余参数. AMC训练一个强化学习的策略,对每个卷积层会给出其action(即压缩率),然后根据压缩率进行裁枝.裁枝后,A ...
- Operating System:信号量
pv原语操作(1)操作系统PV意思:PV操作与信号量的处理相关,P表示通过的意度思,V表示释放的意思.(2)p操作和v操作是不可中断问的程序段,称为原语.如果将信号量看作共享变量,则pv操作为其临界区 ...