In Delphi XE2, the Compiler swears on the WriteProcessMemory and ReadProcessMemory , yielding an error

error E2033: E2033 Types

Everything works great in Delphi7. Has anyone come across?

  • 2
    Do not hesitate, show the code. But the compiler's message seems to be quite eloquent enough: when you pass parameters, you try to cause a type conversion. In Delphi 7, everything could roll, for example, because the wrapper to the WinAPI WriteProcessMemory looked a little different. - Nofate
  • Any example for Delphi7 containing the above functions produces this error. - Grigory Ponomarev

1 answer 1

Compare the definition of methods in 2010 (there are no 7s at hand) and XE2:

 //Delphi 2010 function ReadProcessMemory(hProcess: THandle; const lpBaseAddress: Pointer; lpBuffer: Pointer; nSize: DWORD; var lpNumberOfBytesRead: DWORD): BOOL; stdcall; function WriteProcessMemory(hProcess: THandle; const lpBaseAddress: Pointer; lpBuffer: Pointer; nSize: DWORD; var lpNumberOfBytesWritten: DWORD): BOOL; stdcall; //Delphi XE2 function ReadProcessMemory(hProcess: THandle; const lpBaseAddress: Pointer; lpBuffer: Pointer; nSize: SIZE_T; var lpNumberOfBytesRead: SIZE_T): BOOL; stdcall; function WriteProcessMemory(hProcess: THandle; const lpBaseAddress: Pointer; lpBuffer: Pointer; nSize: SIZE_T; var lpNumberOfBytesWritten: SIZE_T): BOOL; stdcall; 

Those. all you need to do is explicitly specify the data type for the variable passed as lpNumberOfBytesWritten , as SIZE_T .

SIZE_T , obviously, appeared with support for 64-bit systems.

  • I love you .. I did not tell you before?)))))) - Grigory Ponomarev
  • No, it did not happen) - Nofate