MCPcopy Create free account
hub / github.com/aardappel/treesheets / Init

Method Init

src/StackWalker/StackWalker.cpp:286–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

LoadModulesMethod · 0.45

Calls 2

OnDbgHelpErrMethod · 0.45
OnSymInitMethod · 0.45

Tested by

no test coverage detected