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
Windows SDK V7.0/V7.0A Incompatibility Workaround
'저장소 > VC++' 카테고리의 다른 글
윈도우 재배치 깜빡임 줄이기 - DeferWindowPos (0) | 2013.11.19 |
---|---|
How to use VC_EXTRALEAN and WIN32_LEAN_AND_MEAN to enhance the build process in Visual C++ (0) | 2013.11.19 |
Aasynchronous WinHTTP (0) | 2013.10.31 |
윈도우의 오류 메커니즘(마이크로소프트웨어 신영진님 기고글) (0) | 2013.10.23 |
Stream Manipulators (0) | 2013.08.16 |