you need to look at each argument of ReadProcessMemory and make sure you are pasing the correct type
Code:
BOOL ReadProcessMemory(
HANDLE hProcess,
LPCVOID lpBaseAddress,
LPVOID lpBuffer,
SIZE_T nSize,
SIZE_T* lpNumberOfBytesRead
);
The second argument is the addres so if you are using a number like 0x... then that must be cast to a pointer type (void *)0x.....
The third argument is a pointer to a buffer that recieves the data, you've set it to 512 which is an int type not a pointer.
The forth argument is the size, if you want to read 10 bytes then that's correct
The fifth and final argument is a pointer to a SIZE_T type but this is ok to be NULL.
So for example
Code:
unsigned char Buffer[10];
ReadProcessMemory(hProcess, (void *)0x40100, Buffer, 10, NULL);