On the XP system, there is no positioning program input point.

2023-03-18  

On the XP system, there is no positioning program input point.

After

VC2012 upgraded patch 5.0, the compiled program found that the input point of the XP system cannot locate the input point K32GetProcessMemoryinfo on the dynamic link library Kernel32.dll.
The program had been installed normally on XP before. The colleagues in the test team suddenly discovered that the newly released version cannot be used on XP. This problem is strange, because in the past

The
version is no problem. Why did this problem suddenly occur? From the beginning, find out whether all projects use V110_XP to compile.
Error. In the end, I thought of the recent upgrade of the patch of the Update5.0 of the VC2012, and after packing and compilation, I found that XP’s computer could not be used.

After searching and analysis, it was found that the following problem was found:
This is caused by GetProcessMemoryInfo different in different system versions. The official description is as follows:
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.

solution:
Just add it before the #include <psapi.h>
#ifndef PSAPI_VERSION

#define PSAPI_VERSION 1

#endif

#include <psapi.h>

#pragma ┬ácomment(lib,”Psapi.lib”)

It seems that Microsoft no longer supports the XP system, so all the new versions of the new version of the release have no longer testing the compatibility of XP. It seems that next year, you also need to turn to the XP system, otherwise you need to invest

Test costs and maintenance costs in

need to be fully shifted to the support of Win7 and Win10 systems. It can be seen that the ecosystem is such an important thing and can be left and right.

Cai Junsheng WeChat: shenzhencai Shenzhen

source

Random Posts

c ++ thread lock

Latex Drawing File Label Detailed Explanation, how to draw turning lines, can’t run?

hive programming (2) [Basic operation]

[Twelve Provincial Joint Examination 2019] The Twelve Rings of the Spring Festival

ECMAScript6-Basic 3-String Expansion