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 


C++ Memory editing on Win10 ?

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

Joined: 30 Jul 2014
Posts: 26

PostPosted: Fri Oct 16, 2015 9:29 pm    Post subject: C++ Memory editing on Win10 ? Reply with quote

My code works fine on W7/W8 but people reports it's crashing on W10. Not sure what I should do. I'm using VS2013. Code sample:

Code:
DWORD ReadMemory(DWORD address) { return *(DWORD*)address }
void main(){
DWORD dwOffsets[] = {0x7a, 0x0, 0x210};
DWORD Oaddr = *(DWORD*)(ThisModuleHandle() + Pointer) + dwOffsets[0];
Oaddr = ReadMemory(Oaddr + dwOffsets[1]);
*(DWORD*)(Oaddr + dwOffsets[2]) = 19;
}
Back to top
View user's profile Send private message
STN
I post too much
Reputation: 43

Joined: 09 Nov 2005
Posts: 2676

PostPosted: Sat Oct 17, 2015 3:45 am    Post subject: Reply with quote

Debug it step by step and see where it crashes. Probably some value not being set or returned right by some API. Also if its x64 bit (your trainer), make sure you are using the appropriate data types (use native bit adjusted types to be safe).
_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
B14CKS1D3
Cheater
Reputation: 0

Joined: 30 Jul 2014
Posts: 26

PostPosted: Sat Oct 17, 2015 9:40 am    Post subject: Reply with quote

"native bit adjusted types" what's that?
Back to top
View user's profile Send private message
STN
I post too much
Reputation: 43

Joined: 09 Nov 2005
Posts: 2676

PostPosted: Sat Oct 17, 2015 12:31 pm    Post subject: Reply with quote

Data types that are 32 bit on 32 bit platforms and 64 bit on 64 bit platform ( https://developer.xamarin.com/guides/cross-platform/macios/nativetypes/ , http://docwiki.embarcadero.com/RADStudio/XE7/en/Delphi_Data_Types ). For example in Delphi(XE5) you can use the NativeInt or NativeUInt and the compiler will use the data type depending on the platform you're compiling for (32/64 bit). These are compiler specific i believe, i use Delphi XE, not sure if Lazarus has them (probably does since they're just typedef).

I am not sure what C++ offers as its been a while since i've coded in anything, size_t is what i can remember that used the platform specific data type range. There were a few others, can't recall.

If your program is not 64 bit, you don't need to worry about this at all. I just had weird results when using wrong data types with ReadProcessMemory.

_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
B14CKS1D3
Cheater
Reputation: 0

Joined: 30 Jul 2014
Posts: 26

PostPosted: Sat Oct 17, 2015 12:40 pm    Post subject: Reply with quote

Process is 64 bit. This function fails while executed on Win8
DWORD ReadMemory(DWORD address){ return *(DWORD*)(address); }

Nvm, solved it
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