测试一下,主要测试对贴代码的效果,还有速度等.
TCHARszTemp[
4096
];
// Butbeforewqedothis,wefirstcheckifthe".local"fileexists
if (GetModuleFileName(NULL,szTemp, 4096 ) > 0 )
... {
_tcscat_s(szTemp,_T(".local"));
if(GetFileAttributes(szTemp)==INVALID_FILE_ATTRIBUTES)
...{
//".local"filedoesnotexist,sowecantrytoloadthedbghelp.dllfromthe"DebuggingToolsforWindows"
if(GetEnvironmentVariable(_T("ProgramFiles"),szTemp,4096)>0)
...{
_tcscat_s(szTemp,_T("/DebuggingToolsforWindows/dbghelp.dll"));
//nowcheckifthefileexists:
if(GetFileAttributes(szTemp)!=INVALID_FILE_ATTRIBUTES)
...{
m_hDbhHelp=LoadLibrary(szTemp);
}
}
//Stillnotfound?Thentrytoloadthe64-Bitversion:
if((m_hDbhHelp==NULL)&&(GetEnvironmentVariable(_T("ProgramFiles"),szTemp,4096)>0))
...{
_tcscat_s(szTemp,_T("/DebuggingToolsforWindows64-Bit/dbghelp.dll"));
if(GetFileAttributes(szTemp)!=INVALID_FILE_ATTRIBUTES)
...{
m_hDbhHelp=LoadLibrary(szTemp);
}
}
}
}
// Butbeforewqedothis,wefirstcheckifthe".local"fileexists
if (GetModuleFileName(NULL,szTemp, 4096 ) > 0 )
... {
_tcscat_s(szTemp,_T(".local"));
if(GetFileAttributes(szTemp)==INVALID_FILE_ATTRIBUTES)
...{
//".local"filedoesnotexist,sowecantrytoloadthedbghelp.dllfromthe"DebuggingToolsforWindows"
if(GetEnvironmentVariable(_T("ProgramFiles"),szTemp,4096)>0)
...{
_tcscat_s(szTemp,_T("/DebuggingToolsforWindows/dbghelp.dll"));
//nowcheckifthefileexists:
if(GetFileAttributes(szTemp)!=INVALID_FILE_ATTRIBUTES)
...{
m_hDbhHelp=LoadLibrary(szTemp);
}
}
//Stillnotfound?Thentrytoloadthe64-Bitversion:
if((m_hDbhHelp==NULL)&&(GetEnvironmentVariable(_T("ProgramFiles"),szTemp,4096)>0))
...{
_tcscat_s(szTemp,_T("/DebuggingToolsforWindows64-Bit/dbghelp.dll"));
if(GetFileAttributes(szTemp)!=INVALID_FILE_ATTRIBUTES)
...{
m_hDbhHelp=LoadLibrary(szTemp);
}
}
}
}
怪了,那么多语言,居然没有c++.用c#凑合一下了.