X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Usermode%2FLibraries%2Fld-acess.so_src%2Floadlib.c;h=31dcbd8acfa23840d954df1e2b555c7a78fee44f;hb=d8d31a4ec9a28eb8de493146ce75e8238e8e13b1;hp=dbb7c156f000d71d1983a0e8d6c9d54f2f833c43;hpb=b829bff15b4760c20c7b0eae49c70c35aa2b46d6;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/ld-acess.so_src/loadlib.c b/Usermode/Libraries/ld-acess.so_src/loadlib.c index dbb7c156..31dcbd8a 100644 --- a/Usermode/Libraries/ld-acess.so_src/loadlib.c +++ b/Usermode/Libraries/ld-acess.so_src/loadlib.c @@ -4,6 +4,7 @@ */ #include "common.h" #include +#include #include #define DEBUG 0 @@ -64,7 +65,7 @@ void CallQueuedEntrypoints(char **EnvP) { giNumQueuedEntrypoints --; const struct sQueuedEntry *qe = &gaQueuedEntrypoints[giNumQueuedEntrypoints]; - //_SysDebug("Calling EP for %p", qe->Base); + DEBUGS("Calling EP %p for %p", qe->Entry, qe->Base); qe->Entry(qe->Base, 0, NULL, EnvP); } } @@ -266,7 +267,8 @@ int GetSymbol(const char *name, void **Value, size_t *Size, void *IgnoreBase) return 1; } } - + + bool have_weak = false; for(int i = 0; i < MAX_LOADED_LIBRARIES && gLoadedLibraries[i].Base != 0; i ++) { // Allow ignoring the current module @@ -277,13 +279,25 @@ int GetSymbol(const char *name, void **Value, size_t *Size, void *IgnoreBase) //SysDebug(" GetSymbol: Trying 0x%x, '%s'", // gLoadedLibraries[i].Base, gLoadedLibraries[i].Name); - if(GetSymbolFromBase(gLoadedLibraries[i].Base, name, Value, Size)) { - //SysDebug("GetSymbol: Remote %p - %p", gLoadedLibraries[i].Base, *Value); - return 1; + void *tmpval; + size_t tmpsize; + int rv = GetSymbolFromBase(gLoadedLibraries[i].Base, name, &tmpval, &tmpsize); + if(rv) + { + *Value = tmpval; + *Size = tmpsize; + if( rv == 1 ) { + return 1; + } + have_weak = true; } } - //SysDebug("GetSymbol: None"); - return 0; + if(have_weak) { + return 2; + } + else { + return 0; + } } /**