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的更多相关文章

  1. nasm astrspn函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  2. nasm astrcspn函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  3. nasm astrchr函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...

  4. nasm astrlen函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  5. nasm aat函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain dllmain: ...

  6. nasm astrstr函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...

  7. nasm astrset_s函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  8. nasm astrrev函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  9. nasm astrrchr函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

随机推荐

  1. 挖掘隐藏在源码中的Vue技巧!

    前言 最近关于Vue的技巧文章大热,我自己也写过一篇(vue开发中的"骚操作"),但这篇文章的技巧是能在Vue的文档中找到蛛丝马迹的,而有些文章说的技巧在Vue文档中根本找不到踪迹 ...

  2. FridaHook框架学习(2)

    FridaHook框架学习(2) 前言 学习过程参考https://bbs.pediy.com/thread-227233.htm. 逆向分析 安装并运行例子程序,可以看到这个例子是一个验证注册码的程 ...

  3. 重绘和回流(Repaint & Reflow)总结,以及如何进行优化

    1. 浏览器渲染机制 浏览器采用流式布局模型(Flow Based Layout) 浏览器会把HTML解析成DOM,把CSS解析成CSSOM,DOM和CSSOM合并就产生了渲染树(Render Tre ...

  4. swap交换2变量

    #define swap(x,y) {(x)=(x)+(y); (y)=(x)-(y); (x)=(x)-(y);} void swap(int i, int offset){ int temp; t ...

  5. HTTPS优化与证书

    1.HTTPS性能优化 1.1 HTTPS性能损耗原因 前文讨论了HTTPS原理与优势:身份验证.信息加密与完整性校验等,且未对TCP和HTTP协议做任何修改.但通过增加新协议以实现更安全的通信必然需 ...

  6. ElasticSearch 介绍、Docker安装以及基本检索第三篇

    一.简介 1.1 什么是Elasticsearch? Elasticsearch是一个分布式的开源搜索和分析引擎, 适用于所有类型的数据,包括文本.数字.地理空间.结构化和啡结构化数据.Elastic ...

  7. cassandra权威指南读书笔记--读写数据

    写cassandra除了轻量级事务,不支持别的事务.cassandra是追加写,写的速度非常快.cassandra还有hint日志,这个数据库总是可写的,而且单个列的写操作是原子的.hint并不是一定 ...

  8. OsgEarth开发笔记(一):Osg3.6.3+OsgEarth3.1+vs2019x64开发环境搭建(上)

    前言   OSG研究之后,做地理GIS显示了地球:<项目实战:Qt+OSG教育学科工具之地理三维星球>,这一文章是基于OSG做的,而基于OsgEarth是可以进一步对地球进行深度操作,所以 ...

  9. hdu3706 Second My Problem First

    Problem Description Give you three integers n, A and B.  Then we define Si = Ai mod B and Ti = Min{ ...

  10. [POJ 2585] Window Pains 拓朴排序

    题意:你现在有9个2*2的窗口在4*4的屏幕上面,由于这9这小窗口叠放顺序不固定,所以在4*4屏幕上有些窗口只会露出来一部分. 如果电脑坏了的话,那么那个屏幕上的各小窗口叠放会出现错误.你的任务就是判 ...