nasm astrcpy_s函数 x86
xxx.asm
%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16
section .text
global dllmain
export astrcpy_s
dllmain:
mov eax,1
ret 12
astrcpy_s:
push ebp
mov ebp,esp
push ebx
mov eax,[p1] ; dst char ptr
mov ecx,[p2] ; dwDstSize
mov edx,[p3] ; src char ptr
.for:
;-------------------------------------;
; get src first char
;-------------------------------------;
mov bl,[edx]
;-------------------------------------;
; 检查src是否结束
;-------------------------------------;
test bl,bl
jz .return
;-------------------------------------;
; copy
;-------------------------------------;
mov [eax],bl
;-------------------------------------;
; 避免dst溢出
;-------------------------------------;
dec ecx
test ecx,ecx
jz .return
;-------------------------------------;
; next
;-------------------------------------;
inc eax
inc edx
jmp .for
.return:
pop ebx
mov esp,ebp
pop ebp
ret 12
c++:
#include <iostream>
#include <Windows.h>
typedef void (CALLBACK* astrcpy_s_t)(char* dest, size_t dest_size, const char* src);
astrcpy_s_t astrcpy_s;
int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrcpy_s = (astrcpy_s_t)GetProcAddress(myDLL, "astrcpy_s");
char r[100];
strcpy_s(r, sizeof(r), "123");
printf("%s\n", r); // 123
astrcpy_s(r, sizeof(r), "456");
printf("%s\n", r); // 456
//===============================//
strcpy_s(r, 2, "1");
printf("%s\n", r); // 1
astrcpy_s(r, 2, "2");
printf("%s\n", r); // 2
return 0;
}
nasm astrcpy_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 ...
随机推荐
- LOJ10078
CQOI 2005 重庆城里有 n 个车站,m 条双向公路连接其中的某些车站.每两个车站最多用一条公路连接,从任何一个车站出发都可以经过一条或者多条公路到达其他车站,但不同的路径需要花费的时间可能不同 ...
- 玩遍博客网站,我整理了 Hexo 及其流行的风格主题
搭建博客网站是个人进入互联网世界的最常见方式之一.伴随着网站技术的发展,如何搭建博客网站已经变得非常容易了.当然,你可以选择诸如 新浪博客.CSDN.博客园 之类的大型网站,快速创建依赖于大平台的个人 ...
- Web下无插件播放rtsp视频流的方案及各家优秀内容资源整理
Web下无插件播放rtsp视频流的方案及各家优秀内容资源整理 方案一:服务器端用 websocket 接受 rtsp ,然后,推送至客户端 实现步骤: 方案二:使用 ffmpeg + nginx 把 ...
- SpringMVC 中 @ControllerAdvice 注解
SpringMVC 中 @ControllerAdvice 注解 1.@ControllerAdvice 1.1 全局异常处理 1.2 全局数据绑定 1.3 全局数据预处理 原文地址: 江南一点雨:S ...
- Apache Cocoon XML注入 [CVE-2020-11991]
受影响版本: Apache Cocoon <= 2.1.x 程序使用了StreamGenerator这个方法时,解析从外部请求的xml数据包未做相关的限制,恶意用户就可以构造任意的xml表达式, ...
- 深信服EDR3.2.21任意代码执行
漏洞原理: dev_linkage_launch.php 为设备联动的新入口点主要是将联动的接口构造成业务统一处理的接口 主要调用 跟进 可以看到 第一个检查为 $req_url = $_SERVE ...
- OSPF总结
参考文档:OSPF知识点总结(华为)https://wenku.baidu.com/view/8cc8ab52a36925c52cc58bd63186bceb19e8edf6.html OSPF概念 ...
- php之在admin的目录下的php文件里加上JSON的报头,运行php文件会提示下载
去掉报头就正常,但在前端引用数据时要加上JSON.parse,不然读不出数据. $.get("fetchUpLast.php",{ rd:new Date().getTime()} ...
- Word 脚本 (自用)
打开开发工具 右击功能区->自定义功能区 勾选开发工具->确定 导入代码 开发工具选项卡->Visual Basic 右击Normal->插入->模块 粘贴代码-> ...
- 2017-2018 ACM-ICPC, Asia Daejeon Regional Contest PART(10/12)
$$2017-2018\ ACM-ICPC,\ Asia\ Daejeon\ Regional\ Contest$$ \(A.Broadcast\ Stations\) \(B.Connect3\) ...