Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


how to "nop ptr[eax + 0x00]" on C++ _asm inline

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
devAnd
Newbie cheater
Reputation: 0

Joined: 22 Jun 2020
Posts: 13
Location: C#, java and ASM

PostPosted: Wed Aug 11, 2021 7:52 pm    Post subject: how to "nop ptr[eax + 0x00]" on C++ _asm inline Reply with quote

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
View user's profile Send private message
devAnd
Newbie cheater
Reputation: 0

Joined: 22 Jun 2020
Posts: 13
Location: C#, java and ASM

PostPosted: Thu Aug 12, 2021 8:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Fri Aug 13, 2021 3:40 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
STN
I post too much
Reputation: 42

Joined: 09 Nov 2005
Posts: 2672

PostPosted: Fri Aug 13, 2021 8:52 am    Post subject: Reply with quote

just nop nop nop nop
_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites