神奇的问题啊,GetProcAddress一个不存在的API时,返回非空值,且指向另一个API
typedef UINT (WINAPI *pfnGetSystemWow64DirectoryA)(LPSTR,UINT uSize); pfnGetSystemWow64DirectoryA fnGetSystemWow64DirectoryA=NULL; fnGetSystemWow64DirectoryA=(pfnGetSystemWow64DirectoryA)::GetProcAddress(::GetModuleHandleA("kernel32"),"GetSystemWow64DirectoryA"); if (fnGetSystemWow64DirectoryA) { CString str; str.Format("%08X",fnGetSystemWow64DirectoryA); OutputDebugStringA(str); OutputDebugStringA("存在 Syswow64"); fnGetSystemWow64DirectoryA(s_szSystem32,sizeof(s_szSystem32)); }else{ OutputDebugStringA("不存在 Syswow64"); ::GetSystemDirectoryA(s_szSystem32,sizeof(s_szSystem32)); }