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