Solved How to write on unwritable regions?

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Adversities

Newbie
Full Member
Aug 19, 2016
29
148
0
Hi guys! It's me again asking for you help.
I've this _processHandle = OpenProcess(ProcessAccess.AllAccess, false, (uint)process.Id); and

C#:
[Flags]
public enum ProcessAccess
{
     Synchronize = 0x100000,
     StandardRightsRequired = 0x000F0000,
     AllAccess = StandardRightsRequired | Synchronize | 0xFFFF
}
It's suppose to give me all access over that process but apparently it doesn't, it doesn't write on any unwritable region even it has to give me allaccess
 
Last edited:

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
Into any process you've differents bricks/regions of memory, each brick has a protection level... the brick where i'm trying to write has a protection level (unwritable region), obviously you can access from Cheat Engine and also you can write that region from Cheat Engine too. But i can't write any unwritable region from my Memory manager. That's my problem dude.
Well, now finally a precise statement. Two things you should look up:
VirtualQueryEx with PAGE_EXECUTE_READWRITE
If that doesn't help:
SeDebugPrivilege

If it's still not possible for your program to write to the regions it's black magic.
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
The value of the flag (0x1FFFFF) is correct. The problem must be something else. Wen you call OpenProcess does it return 0? If so use GetLastError to get some more information.
 
Last edited:

Adversities

Newbie
Full Member
Aug 19, 2016
29
148
0
The value isn't 0, i can read into the memory and write, but i can't write on unwritable memory, i dont know why. That's my only problen.
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
The value isn't 0, i can read into the memory and write, but i can't write on unwritable memory, i dont know why. That's my only problen.
Didn't really pay attention to the title in my previous post :4head:
What kind of protection are you talking about? A game with an anticheat protecting it? Or "normal" memory protection like PAGE_EXECUTE_READWRITE?
In the second case just use good old VirtualProtectEx. In the first case things will be more complicated.
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
It's protected ofc
But there are different kind of protections. You said you're able to read/write to some memory. Are you talking about the same process? If so then it's not protected by a kernel driver or worse.
Is Cheat Engine able to access (both read&write) the memory?
 

Adversities

Newbie
Full Member
Aug 19, 2016
29
148
0
Into any process you've differents bricks/regions of memory, each brick has a protection level... the brick where i'm trying to write has a protection level (unwritable region), obviously you can access from Cheat Engine and also you can write that region from Cheat Engine too. But i can't write any unwritable region from my Memory manager. That's my problem dude.
 

Adversities

Newbie
Full Member
Aug 19, 2016
29
148
0
Aight so i've this

C#:
[DllImport("kernel32.dll")]
static extern bool VirtualProtectEx(IntPtr hProcess, IntPtr lpAddress,
   UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect);
Then it might be like: VirtualProtectEx(_processHandle, myMemoryAddress, Size of What? of the bytes that i want to write?, what here?, and here?)
I dont get what it must be on dwSize, flNewProtect, lpflOldProtect, i've an idea but i'm not sure.

Well i got it, the only problem is flNewProtect and lpflOldProtect i dont know what are the values, where can i see a list?
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
Aight so i've this

C#:
[DllImport("kernel32.dll")]
static extern bool VirtualProtectEx(IntPtr hProcess, IntPtr lpAddress,
   UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect);
Then it might be like: VirtualProtectEx(_processHandle, myMemoryAddress, Size of What? of the bytes that i want to write?, what here?, and here?)
I dont get what it must be on dwSize, flNewProtect, lpflOldProtect, i've an idea but i'm not sure.
Did you even bother taking a look at the msdn documentation of the API? Would be faster lel.
Edit:
flNewProtect = one of these
lpflOldProtect = a pointer to a variable that will receive the previous protection value. I don't know the C# syntax for that.
 

Adversities

Newbie
Full Member
Aug 19, 2016
29
148
0
Yeaah dude, i figure it out already, thanks you... And sorry but you know sometimes you got stressed and... x) Thanks you for helping <3
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods