The whole idea is to βoverwriteβ the source code that Messagebox runs on:
JuMP <CustomMessageBoxFunction> RETurn (back to program execution)
So,
First, he copies his shellcode into the JMP array:
memcpy(JMP, tempJMP, SIZE);
He then copies the source code of the assembly source code from the source address to his "oldBytes" temporary storage so that he can copy it after executing his custom function:
memcpy(oldBytes, pOrigMBAddress, SIZE);
Then it copies the address size that it previously calculated for the JMP array immediately after the jmp command:
memcpy(&JMP[1], &JMPSize, 4);
Finally, its JMP [] array contains the shellcode needed to call its function, for example.
JMP 1234 RET
so now he should copy this over the original bytes, where the program expects to find the original MessageBox function:
memcpy(pOrigMBAddress, JMP, SIZE);
Now, going to your question, if you want to connect InsertDate (), instead of using pOrigMBAddress you can use the address of InsertDate.
But I'm not sure if this will work with 64-bit windows.