Windows Assembly / Register Reassignment

Author Unprotect
Platform Windows
Language Assembly
Technique Register Reassignment

Description:

In this code, the registers eax and ebx are initially assigned to 0. The code then performs some operations on the registers, adding 1 to eax and 2 to ebx.

Next, the code reassigns the registers by copying the value of eax into ebx and the value of ebx into eax. This means that the value of eax will be the same as the original value of ebx, and vice versa.

Finally, the code performs more operations on the registers and returns the result. Because of the register reassignment, the final values of eax and ebx will be different than if the registers had not been reassigned.

This code is intended to be difficult to analyze and understand, as the register reassignment makes it more difficult to track the values of the registers. This can make it harder for a reverse engineer or disassembler to understand the code's behavior and intentions.

Code

; Initialize registers
mov eax, 0
mov ebx, 0

; Perform some operations on the registers
add eax, 1
add ebx, 2

; Reassign the registers
mov ebx, eax
mov eax, ebx

; Perform more operations on the registers
add eax, 1
add ebx, 2

; Return the result
ret

Created

December 6, 2022

Last Revised

April 22, 2024