| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| bitterbanana Cheater
 
 ![]() Reputation: 0 
 Joined: 28 Nov 2004
 Posts: 44
 
 
 | 
			
				|  Posted: Mon Oct 17, 2005 1:48 pm    Post subject: Can't write to a memory region |   |  
				| 
 |  
				| A code cave region I like to use in a game starts at 400300, it has trails of zeros for miles after it.  I've been writing to that region with vb6 for a long time.  I tried it with c# and I can't write to it anymore. 
 I know for a fact that it's not a c# problem.  I restarted and closed out of my compiler and tried to write a 90 at 400300 with CE's memory viewer, and it quickly changed back to 00.  But when I opened vb6 and wrote a 90 to it, I could suddenly write to that region, even when I closed out of vb6.
 
 I'm thinking it has to do with protected memory regions.  I guess vb6 overrides something.  Any ideas?
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Mon Oct 17, 2005 6:05 pm    Post subject: |   |  
				| 
 |  
				| Rightclick the address in the hex view and choose "make page wirtable" 
 Ce already changes the protection quickly when you change the assembler code there.
 
 Also, 400300 is a bad idea for code injection. It's usually not executable (but you'll need to change that anyhow before writing to it)
 
 If the game uses directx 9 just use virtualallocex to allocate a code cave as big as you like, it won't be running on windows me or earlier anyhow.
 _________________
 
 Do not ask me about online cheats. I don't know any and wont help finding them.
 Like my help? Join me on Patreon so i can keep helping
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| bitterbanana Cheater
 
 ![]() Reputation: 0 
 Joined: 28 Nov 2004
 Posts: 44
 
 
 | 
			
				|  Posted: Mon Oct 17, 2005 6:10 pm    Post subject: |   |  
				| 
 |  
				| thanks. 
 I've been using 400300 for a long time (the memory region list says Execute+Read), and I've had no problems with the apps I've written.  Is there anyway I can make the area writiable without using cheat engine?
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Mon Oct 17, 2005 6:15 pm    Post subject: |   |  
				| 
 |  
				| use virtualprotectex _________________
 
 Do not ask me about online cheats. I don't know any and wont help finding them.
 Like my help? Join me on Patreon so i can keep helping
 
 Last edited by Dark Byte on Mon Oct 17, 2005 6:17 pm; edited 1 time in total
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| bitterbanana Cheater
 
 ![]() Reputation: 0 
 Joined: 28 Nov 2004
 Posts: 44
 
 
 | 
			
				|  Posted: Mon Oct 17, 2005 6:17 pm    Post subject: |   |  
				| 
 |  
				| oh right. Thanks. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| bitterbanana Cheater
 
 ![]() Reputation: 0 
 Joined: 28 Nov 2004
 Posts: 44
 
 
 | 
			
				|  Posted: Mon Oct 17, 2005 8:45 pm    Post subject: |   |  
				| 
 |  
				| I've been trying to get this function to work, but it keeps returning null.  Does virtualallocex actually change the page at the address to writable? 
 VirtualAllocEx(m_hProcess,0x400000,0x1000, MEM_COMMIT |MEM_RESERVED, PAGE_EXECUTE_READWRITE);
 
 That didn't work.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Mon Oct 17, 2005 8:54 pm    Post subject: |   |  
				| 
 |  
				| Virtualallocex doesn't change the protection virtualprotectex does
 
 Virtualallocex allocates a region of memory, and it's usually best to give as base address NULL so windows can specify where to allocate the memory instead of you, and only do mem_commit.
 
 to use virtualprotectex:
 VirtualProtectAx(m_hProcess,0x400000,0x1000,PAGE_EXECUTE_READWRITE,NULL);
 _________________
 
 Do not ask me about online cheats. I don't know any and wont help finding them.
 Like my help? Join me on Patreon so i can keep helping
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| bitterbanana Cheater
 
 ![]() Reputation: 0 
 Joined: 28 Nov 2004
 Posts: 44
 
 
 | 
			
				|  Posted: Mon Oct 17, 2005 9:21 pm    Post subject: |   |  
				| 
 |  
				| it worked.  thanks again dark byte.  you always pull through.  I love your work. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  |