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 


VirtualallocEx C#

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

Joined: 17 Mar 2016
Posts: 4

PostPosted: Thu Mar 17, 2016 9:34 pm    Post subject: VirtualallocEx C# Reply with quote

Good evening , I apologize for my English , have a question , I can not create a memory closer to the instruction address as the CE, 0x7FFF00000000 address of the instruction , and the memory allocated to the example in 0x7FF000000000 because of that I can not make the right jmp , tell me what to do , or how to create the correct CE in memory in C # thanks in advance , sorry for the English, they speak a little
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25812
Location: The netherlands

PostPosted: Fri Mar 18, 2016 3:44 am    Post subject: Reply with quote

not sure about c# but virtualalloxex has a prefered base address.
but for it to function the address must be dividabke by 0x10000 (in short, the address gas to end with 0000 ) and no memory in that region must have been allocated or reserved.

also, don't onky use mem_commit, also use mem_reserve (combine them with a binary or instruction. usually | )

_________________
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
View user's profile Send private message MSN Messenger
GGKillLive
How do I cheat?
Reputation: 0

Joined: 17 Mar 2016
Posts: 4

PostPosted: Fri Mar 18, 2016 6:36 am    Post subject: Reply with quote

Dark Byte wrote:
not sure about c# but virtualalloxex has a prefered base address.
but for it to function the address must be dividabke by 0x10000 (in short, the address gas to end with 0000 ) and no memory in that region must have been allocated or reserved.

also, don't onky use mem_commit, also use mem_reserve (combine them with a binary or instruction. usually | )


Thank you very much , but that's not work ,for example I use this functionality,
VirtualAllocEx(HandleProc, IntPtr.Zero, (IntPtr)Size, 0x1000 + 0x100000, MemoryProtection.ExecuteReadWrite);

And it's further than 0x7ff000000000 my mobile phone , and you want to create in 0x7fff00000000

I would be very grateful if you show me an example , I just have 2 days trying to figure out how to be in C# with a selection in the desired location in memory and not dismantled.... MB I'm stupid
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Fri Mar 18, 2016 7:15 am    Post subject: Reply with quote

I think on C++ for example your example would work, but I've heard (I don't program C# for myself, so you'll have to google if it's true) that in C#, the lpAddress parameter tries to allocate memory exactly at the address (not near it), so if you've chosen an invalid address (such as 0x00000000) or an address that's already taken (such as "Game.exe"+12345), the function fails.

Again, I'm not really sure about that ...
Back to top
View user's profile Send private message
GGKillLive
How do I cheat?
Reputation: 0

Joined: 17 Mar 2016
Posts: 4

PostPosted: Fri Mar 18, 2016 7:35 am    Post subject: Reply with quote

i.e. as I understand , specifically the implementation of the creation of memory in C# 0x7ff00000000 no more , for I don't know , then the trainer is easier to do in C++?
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Fri Mar 18, 2016 7:44 am    Post subject: Reply with quote

Yes, I'd recommend C++ or Pascal rather than C# ...
Back to top
View user's profile Send private message
GGKillLive
How do I cheat?
Reputation: 0

Joined: 17 Mar 2016
Posts: 4

PostPosted: Fri Mar 18, 2016 7:53 am    Post subject: Reply with quote

Thanks bro , you can close the topic
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Mar 18, 2016 1:09 pm    Post subject: Reply with quote

C# will work just fine doing this, there is no reason to switch languages.

VirtualAllocEx is setup like this:
Code:
LPVOID WINAPI VirtualAllocEx(
  _In_     HANDLE hProcess,
  _In_opt_ LPVOID lpAddress,
  _In_     SIZE_T dwSize,
  _In_     DWORD  flAllocationType,
  _In_     DWORD  flProtect
);


For creating memory to be used within a code cave, you normally just need to do something similar to:

(This is C++):
Code:
::VirtualAllocEx(handle, nullptr, 0x1000, MEM_COMMIT, PAGE_EXECUTE_READWRITE);


Your code looks fine as long as the DllImport you are using is correct. However, your memory access is a bit is wrong. You don't add two bits together. You need to OR them together like this:
0x1000 | 0x100000

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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