| 282 | m_szSymPath = NULL; |
| 283 | } |
| 284 | BOOL Init(LPCSTR szSymPath) |
| 285 | { |
| 286 | if (m_parent == NULL) |
| 287 | return FALSE; |
| 288 | // Dynamically load the Entry-Points for dbghelp.dll: |
| 289 | // First try to load the newest one from |
| 290 | TCHAR szTemp[4096]; |
| 291 | // But before we do this, we first check if the ".local" file exists |
| 292 | if (GetModuleFileName(NULL, szTemp, 4096) > 0) |
| 293 | { |
| 294 | _tcscat_s(szTemp, _T(".local")); |
| 295 | if (GetFileAttributes(szTemp) == INVALID_FILE_ATTRIBUTES) |
| 296 | { |
| 297 | // ".local" file does not exist, so we can try to load the dbghelp.dll from the "Debugging Tools for Windows" |
| 298 | // Ok, first try the new path according to the architecture: |
| 299 | #ifdef _M_IX86 |
| 300 | if ((m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0)) |
| 301 | { |
| 302 | _tcscat_s(szTemp, _T("\\Debugging Tools for Windows (x86)\\dbghelp.dll")); |
| 303 | // now check if the file exists: |
| 304 | if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES) |
| 305 | { |
| 306 | m_hDbhHelp = LoadLibrary(szTemp); |
| 307 | } |
| 308 | } |
| 309 | #elif _M_X64 |
| 310 | if ((m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0)) |
| 311 | { |
| 312 | _tcscat_s(szTemp, _T("\\Debugging Tools for Windows (x64)\\dbghelp.dll")); |
| 313 | // now check if the file exists: |
| 314 | if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES) |
| 315 | { |
| 316 | m_hDbhHelp = LoadLibrary(szTemp); |
| 317 | } |
| 318 | } |
| 319 | #elif _M_IA64 |
| 320 | if ((m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0)) |
| 321 | { |
| 322 | _tcscat_s(szTemp, _T("\\Debugging Tools for Windows (ia64)\\dbghelp.dll")); |
| 323 | // now check if the file exists: |
| 324 | if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES) |
| 325 | { |
| 326 | m_hDbhHelp = LoadLibrary(szTemp); |
| 327 | } |
| 328 | } |
| 329 | #endif |
| 330 | // If still not found, try the old directories... |
| 331 | if ((m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0)) |
| 332 | { |
| 333 | _tcscat_s(szTemp, _T("\\Debugging Tools for Windows\\dbghelp.dll")); |
| 334 | // now check if the file exists: |
| 335 | if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES) |
| 336 | { |
| 337 | m_hDbhHelp = LoadLibrary(szTemp); |
| 338 | } |
| 339 | } |
| 340 | #if defined _M_X64 || defined _M_IA64 |
| 341 | // Still not found? Then try to load the (old) 64-Bit version: |
no test coverage detected