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 


A 32-bit process can not access modules in a 64-bit process

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
d4ne
How do I cheat?
Reputation: 0

Joined: 06 Dec 2016
Posts: 7

PostPosted: Tue Dec 06, 2016 5:47 pm    Post subject: A 32-bit process can not access modules in a 64-bit process Reply with quote

I'm trying to create a trainer for a game. Which causes a error (I think) because im trying to access the game memory of a 64 bit game with a 32 bit command.

My source code: pastebin (dot) com/SD738MFJ

And the memory class I found in a youtube tutorial: youtube (dot) com/watch?v=TWUK-fK7xD8 or preview: pastebin (dot) com/tkEZyMV7

Sadly I'm receiving the following error code:

An unhandled exception of type 'System (dot) ComponentModel (dot) Win32Exception' occurred in System (dot) dll

Additional information: A 32-bit process can not access modules in a 64-bit process.

This error should be caused by the following line I guess:

Code:
memory (dot) WriteUInt32(prestigeAddress, 1);


Does anyone know what I could do now or if there's a fix for this? Or do I need a whole new Memory Processing class?

I would appreciate any kind of help
Back to top
View user's profile Send private message
Kavvman
Master Cheater
Reputation: 2

Joined: 17 Apr 2004
Posts: 316

PostPosted: Tue Dec 06, 2016 6:48 pm    Post subject: Reply with quote

You can't write to 64bit memory from a 32bit program.
_________________
...
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: Wed Dec 07, 2016 4:05 am    Post subject: Reply with quote

You need to compile your application for 64bit.

See here for more info:
https://msdn.microsoft.com/en-us/library/ms185328.aspx

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
d4ne
How do I cheat?
Reputation: 0

Joined: 06 Dec 2016
Posts: 7

PostPosted: Wed Dec 07, 2016 6:08 am    Post subject: Reply with quote

Yes I've got that working sadly i'm receiving a new error now:

int address = module.BaseAddress.ToInt32() + baseAddress.ToInt32();
return GetAddress((IntPtr)address, offsets);

causes the following error in the memory class:


An unhandled exception of type 'System.OverflowException' occurred in mscorlib.dll

Additional information: The arithmetic operation has caused an overflow.

So I assume the memory class I've found on youtube is out of date right?
Back to top
View user's profile Send private message
Matze500
Expert Cheater
Reputation: 8

Joined: 25 Jan 2012
Posts: 241
Location: Germany

PostPosted: Wed Dec 07, 2016 11:55 am    Post subject: Reply with quote

int address = module.BaseAddress.ToInt32() + baseAddress.ToInt32();
to
long address = module.BaseAddress.ToInt64() + baseAddress.ToInt64();

You are on 64bit and adresses are 8byte long

_________________
Back to top
View user's profile Send private message
Kavvman
Master Cheater
Reputation: 2

Joined: 17 Apr 2004
Posts: 316

PostPosted: Wed Dec 07, 2016 12:18 pm    Post subject: Reply with quote

size_t and ptrdiff_t types are your friends.

This article helped me tremendously when i first switched from 32 to 64bit

http://www.viva64.com/en/l/full/

But honestly, i like Delphi better - NativeInt, NativeUint and you are good. C++ is a lot strict with its types

_________________
...
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: Wed Dec 07, 2016 3:08 pm    Post subject: Reply with quote

ViZZion wrote:
size_t and ptrdiff_t types are your friends.

This article helped me tremendously when i first switched from 32 to 64bit

http://www.viva64.com/en/l/full/

But honestly, i like Delphi better - NativeInt, NativeUint and you are good. C++ is a lot strict with its types


He's not using C++, hes using C#. Those datatypes are useless to him.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Dec 07, 2016 6:03 pm    Post subject: Reply with quote

Should change all of your methods to use IntPtr instead of int or long for all of the addresses.
If you're just adding an offset, you can use:
Code:
int offset = 0x1234;
IntPtr address = IntPtr.Add(module.BaseAddress, offset);

If you must add two IntPtr objects together:
Code:
IntPtr address;
if (IntPtr.Size == sizeof(Int32)) {
  address = new IntPtr(module.BaseAddress.ToInt32() + baseAddress.ToInt32());
} else {
  address = new IntPtr(module.BaseAddress.ToInt64() + baseAddress.ToInt64());
}
Back to top
View user's profile Send private message
Kavvman
Master Cheater
Reputation: 2

Joined: 17 Apr 2004
Posts: 316

PostPosted: Wed Dec 07, 2016 6:49 pm    Post subject: Reply with quote

atom0s wrote:

He's not using C++, hes using C#. Those datatypes are useless to him.


Aw shit, that's what happens when you skim over a thread. Still, it's good advice Very Happy

_________________
...
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