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 


memcpy problems

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

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Sat Mar 28, 2009 9:55 am    Post subject: memcpy problems Reply with quote

Code:

__checkReturn BOOL setAW( void ){
   __try{
      memcpy( (void*)0x00913C0D, (const void*)AW1, 16);
      memcpy( (void*)0x00913C1D, (const void*)AW1, 16);
      memcpy( (void*)0x00913C2D, (const void*)AW1, 16);

      memcpy( (void*)0x00913C7C, (const void*)AW2, 16);
      memcpy( (void*)0x00913C8C, (const void*)AW2, 16);
      memcpy( (void*)0x00913C9C, (const void*)AW2, 16);

      memcpy( (void*)0x00914841, (const void*)AW3, 16);
      memcpy( (void*)0x00914851, (const void*)AW3, 16);
      memcpy( (void*)0x00914861, (const void*)AW3, 16);

      *(WORD*)0x00916A81 = 0x0000;

      memcpy( (void*)0x00916A81, (const void*)AW3, 8);
      memcpy( (void*)0x00916AA5, (const void*)AW3, 8);
      return TRUE;
   }__except(EXCEPTION_EXECUTE_HANDLER){
      return FALSE;
   }
}


It always return false; Anyone know what's wrong?
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat Mar 28, 2009 10:04 am    Post subject: Reply with quote

VirtualQuery for Page protections?
_________________
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Mon Mar 30, 2009 6:20 pm    Post subject: Reply with quote

yup you might have to do VirtualProtect()'s with PAGE_EXECUTE_READWRITE for src and dest

then memcpy()

then another 2 VirtualProtect()'s again to fix

Code:

   VirtualProtect((LPVOID)src,length,PAGE_EXECUTE_READWRITE,&src);
    VirtualProtect((LPVOID)dest,length,PAGE_EXECUTE_READWRITE,&olddest);
   
   memcpy((void*)dest,(void*)src,length);
   
   VirtualProtect((LPVOID)dest,length,olddest,&olddest);
   VirtualProtect((LPVOID)src,length,oldsrc,&oldsrc);



length = size of your new memedit (might corrupt if location is not big enough).
src = location
dest = your new memedit

_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
Back to top
View user's profile Send private message
crayzbeef
Expert Cheater
Reputation: 0

Joined: 21 Jan 2007
Posts: 101

PostPosted: Mon Mar 30, 2009 11:49 pm    Post subject: Re: memcpy problems Reply with quote

S3NS4 wrote:
Code:

__checkReturn BOOL setAW( void ){
   __try{
      memcpy( (void*)0x00913C0D, (const void*)AW1, 16);
      memcpy( (void*)0x00913C1D, (const void*)AW1, 16);
      memcpy( (void*)0x00913C2D, (const void*)AW1, 16);

      memcpy( (void*)0x00913C7C, (const void*)AW2, 16);
      memcpy( (void*)0x00913C8C, (const void*)AW2, 16);
      memcpy( (void*)0x00913C9C, (const void*)AW2, 16);

      memcpy( (void*)0x00914841, (const void*)AW3, 16);
      memcpy( (void*)0x00914851, (const void*)AW3, 16);
      memcpy( (void*)0x00914861, (const void*)AW3, 16);

      *(WORD*)0x00916A81 = 0x0000;

      memcpy( (void*)0x00916A81, (const void*)AW3, 8);
      memcpy( (void*)0x00916AA5, (const void*)AW3, 8);
      return TRUE;
   }__except(EXCEPTION_EXECUTE_HANDLER){
      return FALSE;
   }
}


It always return false; Anyone know what's wrong?


god that code is horrible.
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