700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 无法定位程序输入点 K32GetProcessMemoryInfo于动态链接库kernel32.dll之上

无法定位程序输入点 K32GetProcessMemoryInfo于动态链接库kernel32.dll之上

时间:2022-08-21 04:41:57

相关推荐

无法定位程序输入点 K32GetProcessMemoryInfo于动态链接库kernel32.dll之上

这是由于GetProcessMemoryInfo在不同系统版本号不同导致的,官方说明如下:

Remarks

Starting with Windows 7 and Windows Server R2, Psapi.h establishes version numbers for the PSAPI functions. The PSAPI version number affects the name used to call the function and the library that a program must load.

If PSAPI_VERSION is 2 or greater, this function is defined as K32GetProcessMemoryInfo in Psapi.h and exported in Kernel32.lib and Kernel32.dll. If PSAPI_VERSION is 1, this function is defined as GetProcessMemoryInfo in Psapi.h and exported in Psapi.lib and Psapi.dll as a wrapper that calls K32GetProcessMemoryInfo.

Programs that must run on earlier versions of Windows as well as Windows 7 and later versions should always call this function as GetProcessMemoryInfo. To ensure correct resolution of symbols, add Psapi.lib to the TARGETLIBS macro and compile the program with -DPSAPI_VERSION=1. To use run-time dynamic linking, load Psapi.dll.

解决方案:

只需要在#include <psapi.h>引用前添加

#ifndef PSAPI_VERSION

#define PSAPI_VERSION 1

#endif

#include <psapi.h>

#pragma comment(lib,"Psapi.lib")

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。