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 ...
随机推荐
- mysql、sql server、oracle大比较
MYSQL 多个数据库多个用户形式(最好每个数据库对应一个用户),占用内存小,适用于所有平台,开源免费 客户端和命令窗口,都是由数据库决定内容-> use datebase; 组函数在selec ...
- 前端api管理工具YApi
使用YApi接口管理工具,提升前端开发效率前端开发苦恼: 代码中使用json数据模拟后端api数据,注释调取api接口代码,代码乱七八糟 为了测试不同case,央求后端人员返回不同的数据,返回状态.返 ...
- (十七)整合 Zookeeper组件,管理架构中服务协调
整合 Zookeeper组件,管理架构中服务协调 1.Zookeeper基础简介 1.1 基本理论 1.2 应用场景 2.安全管理操作 2.1 操作权限 2.2 认证方式: 2.3 Digest授权流 ...
- jRating五星评级
<!DOCTYPE html> <html> <head> <title>jrating使用示例</title> <meta char ...
- hdu 4738 Caocao's Bridges(割边)
题目链接 用tarjan求桥上的最小权值 #include<bits/stdc++.h> #define ll long long int using namespace std; inl ...
- Codeforces Round #627 (Div. 3) C - Frog Jumps(逻辑)
题意: 有一个每个单元标明移动方向的长为n的序列,每次移动不能超过距离k,问能够从0移动到n+1的k的最小值. 思路: k=最长连续L序列长度+1. #include <bits/stdc++. ...
- Color Changing Sofa Gym - 101962B、Renan and Cirque du Soleil Gym - 101962C、Hat-Xor Gym - 101962E 、Rei do Cangaço Gym - 101962K 、Sorting Machine Gym - 101962M
Color Changing Sofa Gym - 101962B 题意:给你一个由字母构成的字符串a,再给你一个由0.1构成的字符串b.你需要在a字符串中找到一个可以放下b的位置,要保证b字符串中0 ...
- Codeforces Round #305 (Div. 1) B. Mike and Feet
Mike is the president of country What-The-Fatherland. There are n bears living in this country besid ...
- Codeforces Round #646 (Div. 2) C. Game On Leaves (贪心,博弈)
题意:给你一棵树,每次可以去掉叶节点的一条边,Ayush先开始,每回合轮流来,问谁可以第一个把\(x\)点去掉. 题解:首先如果\(x\)的入度为\(1\),就可以直接拿掉,还需要特判一下入度为\(0 ...
- Medium Free
fetch(window.location.href,{credentials:"omit",redirect:"follow",mode:"no-c ...