xxx.asm

  1. %define p1 ebp+8
  2. %define p2 ebp+12
  3. %define p3 ebp+16
  4. section .text
  5. global dllmain
  6. export astrrev
  7. dllmain:
  8. mov eax,1
  9. ret 12
  10. ;------------------------------------------------;
  11. ; 反转字符串的字符。
  12. ;------------------------------------------------;
  13. astrrev:
  14. push ebp
  15. mov ebp,esp
  16. mov ecx,[p1] ; char *str
  17. mov edx,[p1]
  18. ;------------------------------------------------;
  19. ; get last
  20. ;------------------------------------------------;
  21. .getLast:
  22. mov ah,[ecx]
  23. test ah,ah
  24. jz .getLastBreak
  25. inc ecx
  26. jmp .getLast
  27. .getLastBreak:
  28. dec ecx
  29. .rev:
  30. cmp ecx,edx
  31. jc .return ; 偶数ecx会小于edx
  32. je .return ; 奇数会相等
  33. ;------------------------------------------------;
  34. ; 交换字节
  35. ;------------------------------------------------;
  36. mov ah,[ecx]
  37. mov al,[edx]
  38. mov [edx],ah
  39. mov [ecx],al
  40. ; next
  41. dec ecx
  42. inc edx
  43. jmp .rev
  44. .return:
  45. mov eax,[p1] ; 返回原始指针
  46. mov esp,ebp
  47. pop ebp
  48. ret 4

c++:

  1. #include <iostream>
  2. #include <Windows.h>
  3. #include <tchar.h>
  4. #include <string>
  5. typedef char* (CALLBACK* astrrev_t)(char* str);
  6. astrrev_t astrrev;
  7. int main()
  8. {
  9. HMODULE myDLL = LoadLibraryA("xxx.dll");
  10. astrrev = (astrrev_t)GetProcAddress(myDLL, "astrrev");
  11. char s[12] = "hello world";
  12. printf("%s, %s\n", _strrev(s), s); // dlrow olleh, dlrow olleh
  13. printf("%s, %s\n", astrrev(s), s); // hello world, hello world
  14. return 0;
  15. }

nasm astrrev函数 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 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. 编写Hello World ts程序

    准备工作 预装软件NodeJs和VSCode 新建文件夹ts_in_action npm命令初始化工程:npm init -y,生成package.json文件 全局安装TypeScript:npm ...

  2. Kafka Fetch Session剖析

    1.概述 最近有同学留言在使用Kafka的过程中遇到一些问题,比如在拉取的Topic中的数据时会抛出一些异常,今天笔者就为大家来分享一下Kafka的Fetch流程. 2.内容 2.1 背景 首先,我们 ...

  3. Spring Boot:添加导出Excel表格功能

    1.添加POI依赖 2.创建EXCEL实体类 3.创建表格工具类 4.创建ExcelConstant 5.创建ExcelController 1.添加POI依赖 <dependency> ...

  4. java架构《并发线程高级篇四》

    本章主要讲并发线程的常见的两种锁.重入锁和读写锁 一:重入锁(ReentrantLock) 概念:重入锁,在需要进行同步的代码加锁,但最后一定不要忘记释放锁,否则会造成锁永远不能释放,其他线程进不了 ...

  5. C++基本之 运算符重载

    =====>友元运算符#include <iostream> using namespace std; class Test { public: Test(int a = 0) { ...

  6. UML——宏观总结

    今天果断开始UML的学习,要不就要被12期赶超了.努力学习的效率 一.宏观导图把控 导图概要说明:RUP这块儿的内容相当于软件工程已经学过了,只不过这里换了个名词而已.面向对象,已经不再陌生,vb中早 ...

  7. Java二维数组转成稀疏sparsearray数组

    稀疏数组 基本介绍 当一个数组中大部分元素为0,或者为同一个值的数组时,可以使用稀疏数组来保存该数组. 稀疏数组的处理方法是: 记录数组一共有几行几列,有多少个不同的值 把具有不同值的元素的行列及值记 ...

  8. (史上最全)SNP位点与转录因子结合特异性数据库:GVATdb

    众所周知,全基因组关联分析(GWAS)发现的很多变异位点基本为非编码,这些变异位点1)要么调控基因表达(eQTL); 2)要么影响增强子活性; 3)要么影响转录因子(TF)结合特异性; 4)要么啥也不 ...

  9. 【noi 2.6_1481】Maximum sum(DP)

    题意:求不重叠的2段连续和的最大值. 状态定义f[i]为必选a[i]的最大连续和,mxu[i],mxv[i]分别为前缀和后缀的最大连续和. 注意:初始化f[]为0,而max值为-INF.要看好数据范围 ...

  10. C#之字符编码

    在 Windows Vista 及之后的版本中,每个Unicode字符都使用UTF-16编码,UTF的全称是 Unicode Transformation Format(Unicode 转换格式).U ...