当前位置:网站首页>1. Assignment statement
1. Assignment statement
2022-07-23 10:19:00 【Chicken Island~】
mov Instructions

C++ Code
gi = 0x12345678;
Assembly instruction
mov dword ptr ds:[001202DCh],12345678h
Machine instructions
00115718 C7 05 DC 02 12 00 78 56 34 12
Raise questions
- Memory 00AB02DCh It's really gi The address of ?
- mov Instructions are really stored in the address 00115718 In memory ?
Found that regular
The integer represented on the computer is Store in reverse byte order Of
Knowledge point : Storage mode of the large and small end (Intel Computers are small terminals )
Conclusion : Instructions are combinations of bytes
Raise questions : We can build our own instructions to execute ?
#include <iostream>
#include <Windows.h>
int gi{
};
void* address;
void* buildCode();
int main() {
void* codeAdr = buildCode();
_asm mov address, offset _adr;
DWORD oldProtect{
};
VirtualProtect(codeAdr, 16, PAGE_EXECUTE_READWRITE, &oldProtect);
gi = 1;
printf("gi = %d\n", gi);
_asm jmp codeAdr;
gi = 13;
_adr:
printf("gi = %d\n", gi);
getchar();
}
void* buildCode()
{
char* code = (char*)malloc(16);
char* pMov = (char*)code;
char* pJmp = (char*)code + 10;
char* pAddress = pMov + 2;
//C7 05 B0 00 94 00 01 00 00 00
pMov[0] = 0xC7;
pMov[1] = 0x05;
*((int*)pAddress) = (int)&gi;
*((int*)(pAddress + 4)) = 2;
//FF 25 88 01 7B 00
pJmp[0] = 0xFF;
pJmp[1] = 0x25;
*((int*)(&pJmp[2])) = (int)&address;
return code;
}
边栏推荐
- Illustration and text demonstrate the movable range of the applet movable view
- [C language foundation] 16 variable array (array length can be extended)
- 博世BOSCH EDI项目案例
- 这个工具,补齐了 JMeter性能分析最后一公里短板
- GNN-第三方库:PyG(Pytorch Geometric)【基于Pytorch构建的库,可以帮助用户快速构建和训练自己的图神经网络模型】【DeepWalk、LINE、GCN、GAT等】
- Nine charts overview the cycle law of encryption Market
- One of the series of composition principle analysis, the design principle of composition
- Use reflection to modify the member variable whose modifier is final
- 如何在OneFlow中新增算子
- redis token记录用户登录设计求解?
猜你喜欢

在线问题反馈模块实战(十一):实现图片下载功能

Read write barrier in memory barrier -- concurrency problem

博世BOSCH EDI项目案例

数据中台、BI业务访谈(三):如何选择合适的访谈对象

数据库安全性和数据的完整性
![[azure event center] try new functions of azure event hub -- geo disaster recovery](/img/7a/628152d10b61fa5447564225b6f77a.png)
[azure event center] try new functions of azure event hub -- geo disaster recovery

【C语言基础】16 可变数组(数组长度可扩展)

Three goals and eight tasks of intelligent construction pilot city notice

2.判断语句

Leetcode 1074. number of submatrices that sum to target
随机推荐
射频电路循证设计
Visual full link log tracking
STM32——输入捕获实验
leetcode-99.恢复二叉搜索树
Target detection XML file to achieve mixup data enhancement (modifying the file path can be used directly, which is very convenient)
华泰证劵开户有骗局吗安全吗
C語言——幾道C語言經典習題
141.环形链表
金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(九))
Technology sharing | big transaction blocking show master status
Three goals and eight tasks of intelligent construction pilot city notice
Args parameter parsing
【MySQL】游标「Cursor」
C language -- several classic exercises of C language
网络安全之ARP欺骗防护
内存屏障中的读写屏障——并发问题
L-cysteine modified gold nanoparticles (Cys GNPs) and bovine serum albumin / biotinylated albumin nanoparticles
范式及反范式
Nine charts overview the cycle law of encryption Market
如何在OneFlow中新增算子