I was trying out this code.
I am hitting on error “Types of actual and formal var parameters must be identical” . Any help in this regard is highly appreciated.
......
ReadProcessMemory(ProcInfo.hProcess, pointer(Context.Ebx + 8), @BaseAddress, 4, Bytes); <-- error is here
.......
and
.....
WriteProcessMemory(ProcInfo.hProcess, pointer(ImageNtHeaders.OptionalHeader.ImageBase), InjectMemory, InjectSize, Bytes); <---- error here
......
I am using Delphi XE2 and windows 7 64 bit. Some of my friends are able to compile it under D7 environment. Any help is appreciated.
The error tells you that one of the variables you are passing as parameter does not have the required type. The error is in a
varparameter. The final parameter for both these functions is the only var parameter so clearlyBytesis not the required type.The solution is to make
Bytesmatch the type specified in the declaration ofReadProcessMemoryandWriteProcessMemory. In XE2 that type isSIZE_T. So you just need to change your definition ofBytesto be of typeSIZE_T.Here are the XE2 declarations: