| View previous topic :: View next topic |
| Author |
Message |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Fri Jul 20, 2007 4:42 pm Post subject: Memory protection |
|
|
Hey guys, I saw this code in a book before and they said that if I wanted to write to OS data structures I had to un-protect the memory and they gave me a code sample:
| Code: | // UN-protect memory
__asm
{
push eax
mov eax, CR0
and eax, 0FFFEFFFFh
mov CR0, eax
pop eax
}
// do something
// RE-protect memory
__asm
{
push eax
mov eax, CR0
or eax, NOT 0FFFEFFFFh
mov CR0, eax
pop eax
}
|
So I was using this code, but today, I was reading this article, and they used this:
| Code: |
ULONG CR0Reg;
__asm
{
cli
mov eax, cr0
mov CR0Reg,eax
and eax,0xFFFEFFFF
mov cr0, eax
}
//Do stuff
__asm
{
mov eax, CR0Reg
mov cr0, eax
sti |
They look almost the same, except the fact that the second one used cli/sti to disable/enable interrupt processing.
So yeah, I tried both methods in my code, and I didn't see any difference. Which one should I use? Are those codes the same ? _________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Fri Jul 20, 2007 4:53 pm Post subject: |
|
|
| you shouldn't use that method at all, it's global and dangerous. |
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Fri Jul 20, 2007 4:55 pm Post subject: |
|
|
So that leaves me with the MDL method right? _________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Fri Jul 20, 2007 4:59 pm Post subject: |
|
|
| Yes |
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Fri Jul 20, 2007 5:55 pm Post subject: |
|
|
| appalsap wrote: | | you shouldn't use that method at all, it's global and dangerous. |
CE Uses this =\. Its quick and easy. |
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Mon Jul 23, 2007 6:31 pm Post subject: |
|
|
| noz3001 wrote: | | appalsap wrote: | | you shouldn't use that method at all, it's global and dangerous. |
CE Uses this =\. Its quick and easy. |
and thats why my C drive is gone one day (partition label) and i had to ghost it back. _________________
Get kidnapped often. |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25820 Location: The netherlands
|
Posted: Mon Jul 23, 2007 6:38 pm Post subject: |
|
|
gameguard uses it as well, and it was probably gameguard that whiped your c-drive on purpose _________________
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 |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Mon Jul 23, 2007 6:41 pm Post subject: |
|
|
or maybe some guy just leaves a line of code out for the UCE I used _________________
Get kidnapped often. |
|
| Back to top |
|
 |
|