-void AddLoaded(char *File, Uint base)
-{\r
- int i, length;\r
- char *name = gsNextAvailString;\r
- \r
- DEBUGS("AddLoaded: (File='%s', base=0x%x)", File, base);\r
- \r
- // Find a free slot\r
- for( i = 0; i < MAX_LOADED_LIBRARIES; i ++ )\r
- {\r
- if(gLoadedLibraries[i].Base == 0) break;\r
- }\r
- if(i == MAX_LOADED_LIBRARIES) {\r
- SysDebug("ERROR - ld-acess.so has run out of load slots!");\r
- return;\r
- }\r
- \r
- // Check space in string buffer\r
- length = strlen(File);\r
- if(&name[length+1] >= &gsLoadedStrings[MAX_STRINGS_BYTES]) {\r
- SysDebug("ERROR - ld-acess.so has run out of string buffer memory!");\r
- return;\r
- }\r
- \r
- // Set information\r
- gLoadedLibraries[i].Base = base;\r
- strcpy(name, File);\r
- gLoadedLibraries[i].Name = name;\r
- gsNextAvailString = &name[length+1];\r
- DEBUGS("'%s' (0x%x) loaded as %i\n", name, base, i);\r
+void *IsFileLoaded(const char *file)
+{
+ int i;
+ DEBUGS("IsFileLoaded: (file='%s')", file);
+
+ // Applications link against either libld-acess.so or ld-acess.so
+ if( strcmp(file, "/Acess/Libs/libld-acess.so") == 0
+ || strcmp(file, "/Acess/Libs/ld-acess.so") == 0 )
+ {
+ DEBUGS("IsFileLoaded: Found local (%p)", &gLinkedBase);
+ return &gLinkedBase;
+ }
+
+ for( i = 0; i < MAX_LOADED_LIBRARIES; i++ )
+ {
+ if(gLoadedLibraries[i].Base == 0) break; // Last entry has Base set to NULL
+ DEBUGS(" strcmp('%s', '%s')", gLoadedLibraries[i].Name, file);
+ if(strcmp(gLoadedLibraries[i].Name, file) == 0) {
+ DEBUGS("IsFileLoaded: Found %i (%p)", i, gLoadedLibraries[i].Base);
+ return gLoadedLibraries[i].Base;
+ }
+ }
+ DEBUGS("IsFileLoaded: Not Found");
+ return 0;
+}
+
+/**
+ * \fn void AddLoaded(char *File, Uint base)
+ * \brief Add a file to the loaded list
+ */
+void AddLoaded(const char *File, void *base)
+{
+ int i, length;
+ char *name = gsNextAvailString;
+
+ DEBUGS("AddLoaded: (File='%s', base=%p)", File, base);
+
+ // Find a free slot
+ for( i = 0; i < MAX_LOADED_LIBRARIES; i ++ )
+ {
+ if(gLoadedLibraries[i].Base == 0) break;
+ }
+ if(i == MAX_LOADED_LIBRARIES) {
+ SysDebug("ERROR - ld-acess.so has run out of load slots!");
+ return;
+ }
+
+ // Check space in string buffer
+ length = strlen(File);
+ if(&name[length+1] >= &gsLoadedStrings[MAX_STRINGS_BYTES]) {
+ SysDebug("ERROR - ld-acess.so has run out of string buffer memory!");
+ return;
+ }
+
+ // Set information
+ gLoadedLibraries[i].Base = base;
+ strcpy(name, File);
+ gLoadedLibraries[i].Name = name;
+ gsNextAvailString = &name[length+1];
+ DEBUGS("'%s' (%p) loaded as %i", name, base, i);