memset

02/19/2011 00:23 RunzelEier#1
hi,
i made a smal proxy-dll, which patches some adresses.
but it crashes my game.
if i run it in a debugger it tells me.
"Access violation when writing to [007E245E] -use Shift....."
the adress is correct.
does this access violation is due to the anti hack shield?
or was it my fault?.

here are the important parts of my code
PHP Code:
BYTE g_JMP =0xEB;
unsigned long Mutex2 0x007E245E;
memset((VOID*)Mutex2,g_JMP,1); 
02/19/2011 00:37 black0utCpp#2
sorry didn t read close enough i guess it s something with the anti hack shield
02/19/2011 00:57 5769854332#3
check the access rights of the page, e.g. in Ollydbg. Press f3 to load the game, then alt+m

[IMG][Only registered and activated users can see links. Click Here To Register...] Uploaded with [Only registered and activated users can see links. Click Here To Register...][/IMG]

R = Read
W = Write
E = Execute
02/19/2011 01:39 RunzelEier#4
i used the dbghelp.dll as my proxy
i should have all rights.
any other suggestions?

Edit: ahh sry, thats the problem thx
any suggestions how i can fix it?
setdebugprivileg?

i will try it that way

Editē: i adjusted the debug privileges, but still the game crashes.
i used this function:
and olly tells me that i still can only read the process.
02/19/2011 02:19 5769854332#5
VirtualQuery
VirtualProtect

google them or use msdn hp.

edit:
btw your screen doesnt show the access rights of the address 007E245E.
02/19/2011 02:38 RunzelEier#6
ahh i thought my dll has not the right rights.
i will try it that way.

Edit:
Thank you,
i love you.
works like a shame!

i now use this function
PHP Code:
LPVOID memsetEx (void lpDestinationint lpSourceint nLen)
{
    
DWORD dwOldDestProt 0;
    
DWORD dwOldSrcProt    0;
    
    
VirtualProtect    (lpDestinationnLenPAGE_EXECUTE_READWRITE, &dwOldDestProt);
    
memset            (lpDestinationlpSourcenLen);
    
VirtualProtect    (lpDestinationnLendwOldDestProtNULL);

    return 
lpDestination;