For dynamic memory allocation in C/C++
int main(){
MessageBox(0,"crackname","",0);
int * ptr = new int[50];
int * ptr2 = new int[50];
ptr[0] = 0x75;
ptr[1] = 0x65;
(*ptr) +1 = 0x75;
MessageBox(0,"crackname","",0);
return 0;
}
the assembly for this code is the following:
MOV DWORD PTR SS:[EBP-10],EAX
MOV ECX,DWORD PTR SS:[EBP-10]
MOV DWORD PTR SS:[EBP-8],ECX
MOV EDX,DWORD PTR SS:[EBP-4]
MOV DWORD PTR DS:[EDX],75
MOV EAX,DWORD PTR SS:[EBP-4]
MOV DWORD PTR DS:[EAX+4],65
Each dynamic memory allocation is 4 bytes. But is it possible to make it like this?
MOV DWORD PTR DS:[EAX+1],65 // +1 not +4
And if it's possible, what is the theory behind it with dynamic allocated memory?