View previous topic :: View next topic |
Author |
Message |
devAnd Newbie cheater Reputation: 0
Joined: 22 Jun 2020 Posts: 13 Location: C#, java and ASM
|
Posted: Wed Aug 11, 2021 7:52 pm Post subject: how to "nop ptr[eax + 0x00]" on C++ _asm inline |
|
|
Hello guys!!
i have this code in asm:
Code: |
cmp ecx,46DC0E00
je 1A380021
nop dword ptr [eax+00]
mov [edx+00000584],ecx
mov [edx+00000584],00000000
jmp game.exe+A42067
mov [edx+00000584],ecx
jmp game.exe+A42067
|
and i have this code on C++:
Code: | __asm
{
cmp ecx, 0x46DC0E00
je $ + 0x19 //25 bytes
//i need put NOP DWORD here
mov[edx + 0x00000584], ecx
mov[edx + 0x00000584], 0
jmp JmpBack
mov[edx + 0x00000584], ecx
jmp JmpBack
} |
how do I put this nop dword in the c++ code?
|
|
Back to top |
|
|
devAnd Newbie cheater Reputation: 0
Joined: 22 Jun 2020 Posts: 13 Location: C#, java and ASM
|
Posted: Thu Aug 12, 2021 8:44 pm Post subject: |
|
|
Solved, just use:
Code: | #define nopDwordPTR __asm _emit 0x0F __asm _emit 0x1F __asm _emit 0x40 __asm _emit 0x00
__asm
{
push eax
mov eax, 0
cmp ecx, 0x46DC0E00
je $ + 0x1D
nopDwordPTR
mov[edx + 0x00000584], ecx
mov[edx + 0x00000584], eax
pop eax
jmp OneHitJmpBack
mov[edx + 0x00000584], ecx
jmp OneHitJmpBack
} |
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8518 Location: 127.0.0.1
|
Posted: Fri Aug 13, 2021 3:40 am Post subject: |
|
|
MSVC's inline assembler uses the 'align' keyword to inject the multibyte nop's if you wanted to go that route instead of doing emits.
https://docs.microsoft.com/en-us/cpp/assembler/inline/even-and-align-directives?view=msvc-160
Keep in mind, it's generally used for loop alignment to make them faster. Depending on where you're cave is injected and your code is aligned to, it may not need it and you could potentially be slowing the code down some.
_________________
- Retired. |
|
Back to top |
|
|
STN I post too much Reputation: 42
Joined: 09 Nov 2005 Posts: 2672
|
Posted: Fri Aug 13, 2021 8:52 am Post subject: |
|
|
just nop nop nop nop
_________________
|
|
Back to top |
|
|
|