xxx.asm

%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16 section .text
global dllmain
export astrlen dllmain:
mov eax,1
ret 12 astrlen:
push ebp
mov ebp,esp mov ecx,[p1] ; char ptr
xor eax,eax .for:
cmp byte [ecx],0
je .return inc ecx
inc eax
jmp .for .return:
mov esp,ebp
pop ebp
ret 4

link.fil:

/entry dllmain
/dll xxx.obj

c++

#include <iostream>
#include <Windows.h> typedef int (CALLBACK* astrlen_t)(const char*); astrlen_t astrlen; int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrlen = (astrlen_t)GetProcAddress(myDLL, "astrlen"); printf("%d\n", astrlen("hello world")); // 11
printf("%d\n", astrlen("nasm")); // 4 return 0;
}

nasm astrlen函数 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 aat函数 x86

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

  5. nasm astrstr函数 x86

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

  6. nasm astrset_s函数 x86

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

  7. nasm astrrev函数 x86

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

  8. nasm astrrchr函数 x86

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

  9. nasm astrncmp函数 x86

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

随机推荐

  1. Redis分布式锁升级版RedLock及SpringBoot实现

    分布式锁概览 在多线程的环境下,为了保证一个代码块在同一时间只能由一个线程访问,Java中我们一般可以使用synchronized语法和ReetrantLock去保证,这实际上是本地锁的方式.但是现在 ...

  2. CSS(简介or选择器)

    我们为什么需要CSS? 使用css的目的就是让网页具有美观一致的页面,另外一个最重要的原因是内容与格式分离 在没有CSS之前,我们想要修改HTML元素的样式需要为每个HTML元素单独定义样式属性,当H ...

  3. string知识

    因为历史原因以及为了与C语言兼容,字符串字面值与标准库string类型不是同一种类型.这一点很容易引起混乱,编程时一定要注意区分字符串字面值和string数据类型的使用,这很重要. 额~~~C字符串是 ...

  4. C/C++ New与Delete (小例子)

    转自:http://blog.csdn.net/chenzujie/article/details/7011639   先来看两段小程序: 1). #include <iostream.h> ...

  5. Cisco的互联网络操作系统IOS和安全设备管理器SDM__散知识点1

    1.启动路由器:当你初次启动一台Cisco路由器时,它将运行开机自检(POST)过程.如果通过了,它将从闪存中查找Cisco IOS,如果有IOS文件存在,则执行装载操作(闪存是一个可电子擦写.可编程 ...

  6. 子网划分、变长子网掩码和TCP/IP排错__子网、掩码、网络汇总

    1.如何创建子网? 要创建子网,就需要从IP地址的主机部分中借出一定的位,并且保留它们用来定义子网地址.这意味着用于主机的位减少,所以子网越多,可用于定义主机的位越少. 2.子网划分的好处: 1)缩减 ...

  7. Java排序算法(一)冒泡排序

    一.测试类SortTest  import java.util.Arrays; public class SortTest { private static final int L = 20; pub ...

  8. Python爬虫笔记一(来自MOOC) Requests库入门

    Python爬虫笔记一(来自MOOC) 提示:本文是我在中国大学MOOC里面自学以及敲的一部分代码,纯一个记录文,如果刚好有人也是看的这个课,方便搬运在自己电脑上运行. 课程为:北京理工大学-嵩天-P ...

  9. Python Line Messaging Api

    Line Messaging line 是国外一个很火的实时通信软件,类似与WX,由于公司业务需求,需要基于line开发一个聊天平台,下面主要介绍关于line messaging api 的使用. 官 ...

  10. 牛客网暑期ACM多校训练营(第二场)message

    传送门:https://ac.nowcoder.com/acm/problem/16631 题意 对于直线y=ax+b,给出n个的a[i]和b[i].m次询问,每次询问给出直线y=cx+d的c[i]和 ...