MCPcopy Create free account
hub / github.com/cuberite/cuberite / Init

Method Init

src/StackWalker.cpp:287–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

LoadModulesMethod · 0.45

Calls 2

OnSymInitMethod · 0.80
OnDbgHelpErrMethod · 0.45

Tested by

no test coverage detected