정리

PSAPI 사용 주의

저장소/VC++

OS version에 따른 PSAPI 사용에 주의 필요.


다음은 PSAPI 의 EunumProcesses API 의 MSDN 내용 일부 발췌.

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

Programs that must run on earlier versions of Windows as well as Windows 7 and later versions should always call this function as EnumProcesses. 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.



Kernel32.lib on Windows 7 and Windows Server 2008 R2;

Psapi.lib if PSAPI_VERSION=1 on Windows 7 and Windows Server 2008 R2;
Psapi.lib on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP

간단히 요약하면 PSAPI_VERSION 정의값이 1이면 psapi.lib/dll 에서 사용, PSAPI_VERSION 정의값이 2 이상이면 kernel32.lib/dll에서 사용한다고 함.

Windows 7, Windows Server 2008 R2 이전 버전의 OS에서 PSAPI 를 올바르게 사용하려면 PSAPI_VERSION 정의값을 1로 설정하여 psapi.lib/dll 을 사용하도록 해야함.


PSAPI Functions

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684894(v=vs.85).aspx


Visual C++ Team Blog :

Windows SDK V7.0/V7.0A Incompatibility Workaround

http://blogs.msdn.com/b/vcblog/archive/2009/08/27/windows-sdk-v7-0-v7-0a-incompatibility-workaround.aspx