hallo, ich will eine keine Anwendung schreiben, bzw hab sie geschrieben( funktioniert nur net) mit der man per VirtualProtectEx() die protection-Flags im speicher neu setzen kann. ZIEL PAGE_GUARD auszuschalten.
hier mal der code:
wenn ihr mir sagen könnt wo mein fehler liegt, wieso des immer fahlschlägt, dann sagts mir... bin fuer jede Hilfe dankbar.
Gruß Tobi.
hier mal der code:
Code:
/*******************************************************************************
Author : Tobias Stein
Date : 8th July '07
Project : Kill PAGE_GUARD
File : KillPG.cpp
Remark : Many memory addresses will protected by PAGE_GUARD, if you want to
manipulate or read an address, PAGE_GUARD cause an exception, so
you got no access.
This application should turn off the fucking PAGE_GUARD.
All Rights Reserved!
*******************************************************************************/
//--- Includes -----------------------------------------------------------------
#include <windows.h>
#include <iostream>
#include <stdio.h>
using namespace std;
//--- Globals ------------------------------------------------------------------
HWND hProcessWnd;
HANDLE hProcess;
DWORD dwProcessID;
DWORD dwSize;
SYSTEM_INFO si;
char szWndName[ 128 ];
//--- Prototypes ---------------------------------------------------------------
bool getProcessHandle( char * );
bool kickPAGE_GUARD( );
//--- Main ---------------------------------------------------------------------
int main( int argc, char* argv[] ) {
SetConsoleTitle( "Kill the fucking PAGE_GUARD!" );
system( " mode con COLS=54 LINES=40 " );
cout << "\n"
<< " *** Enter name of running window! *** \n"
<< "=====================================================\n"
<< "\n"
<< " Windowname: ";
cin.getline( szWndName, sizeof( szWndName ) );
cout << "=====================================================\n"
<< "=====================================================\n\n\n";
if( getProcessHandle( szWndName ) ) {
memset( &si, 0, sizeof( SYSTEM_INFO ) );
GetSystemInfo( &si );
dwSize = (DWORD)( (DWORD)si.lpMinimumApplicationAddress + (DWORD)si.lpMaximumApplicationAddress );
cout << " *** Systeminfo of computer *** \n"
<< "=====================================================\n"
<< "\n"
<< " Page size : " << si.dwPageSize << "\n"
<< " Minimum application address : 0x" << hex << si.lpMinimumApplicationAddress << "\n"
<< " Maximum application address : 0x" << hex << si.lpMaximumApplicationAddress << "\n"
<< "=====================================================\n"
<< "=====================================================\n"
<< "\n\n";
if( kickPAGE_GUARD( ) ) {
cout << " *** Success! *** \n"
<< "=====================================================\n"
<< "\n"
<< " Now you got full access to all memory addresses! \n"
<< "=====================================================\n"
<< "=====================================================\n"
<< "\n\n";
system( "PAUSE" );
CloseHandle( hProcess );
VirtualFree( si.lpMinimumApplicationAddress, dwSize, MEM_DECOMMIT );
}
else {
printf( "\n Failure, couldn't turn off PAGE_GUARD!\n " );
system( "PAUSE" );
CloseHandle( hProcess );
VirtualFree( si.lpMinimumApplicationAddress, dwSize, MEM_DECOMMIT );
return 0;
}
}
else {
printf( "\n The window \"%s\" was not found!\n ", szWndName );
system( "PAUSE" );
CloseHandle( hProcess );
VirtualFree( si.lpMinimumApplicationAddress, dwSize, MEM_DECOMMIT );
return 0;
}
return 0;
}
//--- Definitions --------------------------------------------------------------
bool getProcessHandle( char *szWindowName ) {
hProcessWnd = FindWindow( 0, szWindowName );
if( !hProcessWnd ) {
return false;
}
GetWindowThreadProcessId( hProcess, &dwProcessID );
hProcess = OpenProcess( PROCESS_ALL_ACCESS, 0, dwProcessID );
return true;
}
bool kickPAGE_GUARD( ) {
if( ( VirtualProtectEx( hProcess,
si.lpMinimumApplicationAddress,
dwSize,
PAGE_READWRITE | PAGE_EXECUTE_READWRITE,
0 ) ) == 0 ) {
system( "PAUSE" );
return false;
}
return true;
}
//--- EXIT ---------------------------------------------------------------------
Gruß Tobi.