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

Method LoadModules

lobster/include/StackWalker/StackWalker.cpp:887–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

885}
886
887BOOL StackWalker::LoadModules()
888{
889 if (this->m_sw == NULL)
890 {
891 SetLastError(ERROR_DLL_INIT_FAILED);
892 return FALSE;
893 }
894 if (m_modulesLoaded != FALSE)
895 return TRUE;
896
897 // Build the sym-path:
898 char *szSymPath = NULL;
899 if ( (this->m_options & SymBuildPath) != 0)
900 {
901 const size_t nSymPathLen = 4096;
902 szSymPath = (char*) malloc(nSymPathLen);
903 if (szSymPath == NULL)
904 {
905 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
906 return FALSE;
907 }
908 szSymPath[0] = 0;
909 // Now first add the (optional) provided sympath:
910 if (this->m_szSymPath != NULL)
911 {
912 strcat_s(szSymPath, nSymPathLen, this->m_szSymPath);
913 strcat_s(szSymPath, nSymPathLen, ";");
914 }
915
916 strcat_s(szSymPath, nSymPathLen, ".;");
917
918 const size_t nTempLen = 1024;
919 char szTemp[nTempLen];
920 // Now add the current directory:
921 if (GetCurrentDirectoryA(nTempLen, szTemp) > 0)
922 {
923 szTemp[nTempLen-1] = 0;
924 strcat_s(szSymPath, nSymPathLen, szTemp);
925 strcat_s(szSymPath, nSymPathLen, ";");
926 }
927
928 // Now add the path for the main-module:
929 if (GetModuleFileNameA(NULL, szTemp, nTempLen) > 0)
930 {
931 szTemp[nTempLen-1] = 0;
932 for (char *p = (szTemp+strlen(szTemp)-1); p >= szTemp; --p)
933 {
934 // locate the rightmost path separator
935 if ( (*p == '\\') || (*p == '/') || (*p == ':') )
936 {
937 *p = 0;
938 break;
939 }
940 } // for (search for path separator...)
941 if (strlen(szTemp) > 0)
942 {
943 strcat_s(szSymPath, nSymPathLen, szTemp);
944 strcat_s(szSymPath, nSymPathLen, ";");

Callers 1

StackWalker.cppFile · 0.45

Calls 2

OnDbgHelpErrMethod · 0.95
InitMethod · 0.45

Tested by

no test coverage detected