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 


VirtualProtect/Page protection

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

Joined: 22 Jun 2022
Posts: 5

PostPosted: Wed Jun 22, 2022 4:22 pm    Post subject: VirtualProtect/Page protection Reply with quote

Hello everyone, when I modify one specific DLL's asm/ change page protection using Cheat Engine it works out pretty well, but when I'm trying to change page protecition using VirtualProtect(I code in C++ and inject my custom DLL) it fails(Addr is valid, been already unprotecting some game), I assume DLL(I'm targeting) got some kinda additional protection on it's mem region. How can I get rid of it? Thx
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Jun 23, 2022 3:19 am    Post subject: Reply with quote

what is the getlasterror reason why it fails ?
_________________
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
CakeCode
How do I cheat?
Reputation: 0

Joined: 22 Jun 2022
Posts: 5

PostPosted: Thu Jun 23, 2022 3:44 am    Post subject: Reply with quote

Dark Byte wrote:
what is the getlasterror reason why it fails ?

0x5

edit:
Now I see the error is ERROR_ACCESS_DENIED
And I forgot to mention that I use Cheat Engine functionality(Tools -> Inject DLL) to inject that DLL of mine.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Jun 23, 2022 9:11 am    Post subject: Reply with quote

what protection are you settings ? and what is the size ?
_________________
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
CakeCode
How do I cheat?
Reputation: 0

Joined: 22 Jun 2022
Posts: 5

PostPosted: Thu Jun 23, 2022 2:36 pm    Post subject: Reply with quote

Dark Byte wrote:
what protection are you settings ? and what is the size ?

I want to NOP 2 bytes, so I use VirtualProtect like that:

Code:
if (!VirtualProtect((void*)(pModule + RVA), 2, PAGE_EXECUTE_READWRITE, &temp)) {
         DWORD dwError = GetLastError();
         char buff[50];
         sprintf(buff, "0x%x", dwError);
         MessageBox(0, buff, "", MB_OK);
}


edit:
the unmanipulated page state:



Снимок.PNG
 Description:
 Filesize:  3.58 KB
 Viewed:  1932 Time(s)

Снимок.PNG


Back to top
View user's profile Send private message
CakeCode
How do I cheat?
Reputation: 0

Joined: 22 Jun 2022
Posts: 5

PostPosted: Fri Jun 24, 2022 3:42 pm    Post subject: Reply with quote

Still need help <3 Rolling Eyes
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Jun 24, 2022 11:05 pm    Post subject: Reply with quote

i don't know.

Perhaps the process has enabled the JIT disabling option which prevents it from marking any other memory as executable

try setting the protection to read write without execute and see if that works (the game will crash but that means the operation is succesfull then)

also check if virtualprotect or virtualprotectex is hooked

_________________
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
CakeCode
How do I cheat?
Reputation: 0

Joined: 22 Jun 2022
Posts: 5

PostPosted: Sat Jun 25, 2022 4:27 am    Post subject: Reply with quote

Dark Byte wrote:
i don't know.

Perhaps the process has enabled the JIT disabling option which prevents it from marking any other memory as executable

try setting the protection to read write without execute and see if that works (the game will crash but that means the operation is succesfull then)

also check if virtualprotect or virtualprotectex is hooked

Still can't understand why editing it in Cheat Engine works just perfectly then
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Jun 25, 2022 7:53 am    Post subject: Reply with quote

cheat engine runs as admin outside of the confines of tbe process
_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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