Using ReadProcess function of kernel32.dll at pascal

廉价感情. 提交于 2019-12-06 21:13:26
Lol4t0

OpenProcess has declaration

HANDLE WINAPI OpenProcess(
  _In_  DWORD dwDesiredAccess,
  _In_  BOOL bInheritHandle,
  _In_  DWORD dwProcessId
);

dwDesiredAccess and pid are double words that are

typedef unsigned long       DWORD;

i.e. 32bit on x86, according to this answer.

But Delphi/Pascal Word type is 16bit.

Also, BOOL is defined as

typedef int BOOL;

So, you should use Integer for inherit instead of Byte

So, your function declaration is incorrect.

Seems you should use Cardinal or LongWord instead of Word in your declarations.

If you use Delphi, you can import Windows module that has all Win API functions defined.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!