码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:   library   

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之上

标签:   library   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!