
Originally Posted by
Gordon`
OK. Time to teach more noob coders about hacking and programming...
First off, your sending the address incorrectly. Im wanting the first byte of the address im sending, which is - 0040105A
NOT THE ADDRESS OF MY VARIABLE!, which you send by saying - &fail - (address of variable fail).
BTW try sending a valid address LAWL. So, there my freind, you already fail, and have no right to say my code is incorrect.
NOW. Heres a screenshot of my programs' ASM in ollydbg.

Hmmm, lets check address 0040105A
Hmmm, well in my code im sending THAT ADDRESS!
Hence - DWORD test=0x0040105A;
And - BYTE testB=GetByte((BYTE*)test);//Not sending address of variable, im sending the value, which is an address
SO.
Hmmm, check back at my screenie; based on what OllyDBG says, the binary of address 0040105A is
E9 A1 04 00 00
Hmmm, well, lets check the byte that i compared too in my C++ code...
if(testB==0xE9)
Ooooo look! Its the first byte!
Oh yea, also, the program when ran, says its correct... Hmmm, then when i change it to 0x90 (NOP)
It says its incorrect.... Soooo, i was correct?
Hmmm, phail more pl0x?
Code:
#include "stdafx.h"
#include "windows.h"
#include <iostream>
using namespace std;
BYTE GetByte(BYTE* Address){return (BYTE)Address[0];}
//Thanks To Fate/////////////////////////////////////////////////////
//------------------------------
//Write To Memory
void WriteToMemory(DWORD Offset, DWORD Pointer, DWORD Length){
DWORD OldProtection;
VirtualProtect((void *)Offset, Length, PAGE_EXECUTE_READWRITE, &OldProtection);
RtlMoveMemory((void *)Offset, (const void*)Pointer, Length);
VirtualProtect((void *)Offset, Length, OldProtection, &OldProtection);
}
//------------------------------
//Modify Memory
void ModifyMemory( BYTE *Offset, BYTE *ByteArray, DWORD Length){
for(DWORD i = 0; i < Length; i++)
WriteToMemory((DWORD)Offset + i, (DWORD)ByteArray + i, 1);
}
/////////////////////////////////////////////////////////////////////
void start_it(){
DWORD test=0x0040105A;
BYTE testB=GetByte((BYTE*)test);
if(testB==0xE9)cout << "The byte is correct" << endl;else cout << "The byte is incorrect" << endl;
Sleep(100);
BYTE newbyte[] = {0x90, 0x90, 0x90, 0x90, 0x90};
ModifyMemory((BYTE*)test, (BYTE*)newbyte, sizeof(newbyte));
Sleep(100);
testB=GetByte((BYTE*)test);
Sleep(100);
if(testB==0xE9)cout << "The byte is correct" << endl;else cout << "The byte is incorrect" << endl;
}
void main(int argc, char* argv[]){
DWORD ThreadID;
CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE)&start_it,NULL,NULL,&ThreadID);
Sleep(400);
system("pause");
}
Seriously, you failed. You just showed a novince knowledge of programming and and ASM/OllyDBG.
Please dont try more >_>
[img]
http://www.gghax.com/*******/Shut_The_Fuck_Up.jpg[/img]