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 


Invalid access to memory location.

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

Joined: 21 Feb 2009
Posts: 107

PostPosted: Fri Mar 13, 2009 2:35 pm    Post subject: Invalid access to memory location. Reply with quote

I'm trying to use WriteProcessMemory, I know I'm using it correctly, but I get a failed result and "Invalid access to memory location." error.

I have set the privaladges via:

Code:
bool EnableSEPriv()
{
   HANDLE hToken;
   LUID luID;
   TOKEN_PRIVILEGES tkp;

   if(!OpenProcessToken(GetCurrentProcess(), (TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY), &hToken))
      return false;

   if(!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luID))
      return false;

   tkp.PrivilegeCount = 1;
   tkp.Privileges[0].Luid = luID;
   tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

   AdjustTokenPrivileges(hToken, FALSE, &tkp, sizeof(tkp), NULL, NULL);
   CloseHandle(hToken);
   return true;
}


but it still will not let me write to the memory location.

Any ideas?
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Fri Mar 13, 2009 2:40 pm    Post subject: Reply with quote

Let's see some code ?
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Fri Mar 13, 2009 2:50 pm    Post subject: Reply with quote

try changing the memory protection of the memory you wish to write to using VirtualProtect(Ex) and please refer to this page for further info..

http://msdn.microsoft.com/en-us/library/aa366786(VS.85).aspx

regards BanMe
Back to top
View user's profile Send private message MSN Messenger
crayzbeef
Expert Cheater
Reputation: 0

Joined: 21 Jan 2007
Posts: 101

PostPosted: Fri Mar 13, 2009 5:13 pm    Post subject: Reply with quote

*Mind reads the writeprocessmemory code where the error is*

Yeah. if you're going to ask a question post the fucking code in question.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Fri Mar 13, 2009 6:54 pm    Post subject: Reply with quote

crayzbeef wrote:
*Mind reads the writeprocessmemory code where the error is*

Yeah. if you're going to ask a question post the fucking code in question.


calm down man.

_________________
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