首页 > 其他 > 详细

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

时间:2014-09-15 16:02:11      阅读:1016      评论:0      收藏:0      [点我收藏+]

bubuko.com,布布扣

这是由于GetProcessMemoryInfo在不同系统版本号不同导致的,官方说明如下:
Remarks
Starting with Windows 7 and Windows Server 2008 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")

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

原文:http://blog.csdn.net/chentao1206/article/details/39292445

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!