| View previous topic :: View next topic |
| Author |
Message |
B14CKS1D3 Cheater
Reputation: 0
Joined: 30 Jul 2014 Posts: 26
|
Posted: Fri Oct 16, 2015 9:29 pm Post subject: C++ Memory editing on Win10 ? |
|
|
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 |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2676
|
Posted: Sat Oct 17, 2015 3:45 am Post subject: |
|
|
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). _________________
|
|
| Back to top |
|
 |
B14CKS1D3 Cheater
Reputation: 0
Joined: 30 Jul 2014 Posts: 26
|
Posted: Sat Oct 17, 2015 9:40 am Post subject: |
|
|
| "native bit adjusted types" what's that? |
|
| Back to top |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2676
|
Posted: Sat Oct 17, 2015 12:31 pm Post subject: |
|
|
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. _________________
|
|
| Back to top |
|
 |
B14CKS1D3 Cheater
Reputation: 0
Joined: 30 Jul 2014 Posts: 26
|
Posted: Sat Oct 17, 2015 12:40 pm Post subject: |
|
|
Process is 64 bit. This function fails while executed on Win8
DWORD ReadMemory(DWORD address){ return *(DWORD*)(address); }
Nvm, solved it |
|
| Back to top |
|
 |
|