/*
- * AcessNative
+ * AcessNative Dynamic Linker
+ * - By John Hodge (thePowersGang)
+ *
+ * binary.c
+ * - Provides binary loading and type abstraction
*/
+#define DEBUG 0
#include "common.h"
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#define LIBRARY_PATH "$$$$../Usermode/Output/x86/Libs"
+#define LIBRARY_PATH "$$$$../Usermode/Output/x86_64/Libs"
// === TYPES ===
typedef struct sBinary {
extern int ElfGetSymbol(void *Base, char *Name, uintptr_t *ret, size_t *size);
extern int ciNumBuiltinSymbols;
extern tSym caBuiltinSymbols[];
+extern char **gEnvP;
// === PROTOTYPES ===
void Binary_AddToList(const char *Filename, void *Base, tBinFmt *Format);
}
ret = Binary_Load(path, (uintptr_t*)&entry);
- printf("LOADED '%s' to %p (Entry=%p)\n", path, ret, entry);
+ if( ret != (void*)-1 )
+ Debug("LOADED '%s' to %p (Entry=%p)", path, ret, entry);
free(path);
#if DEBUG
#if DEBUG
printf("Calling '%s' entry point %p\n", Name, entry);
#endif
- entry(ret, 0, argv, NULL);
+ entry(ret, 0, argv, gEnvP);
}
return ret;
}
#if DEBUG
- printf("fmt->Load(%i)...\n", fd);
+ printf("fmt->Load(0x%x)...\n", fd);
#endif
ret = fmt->Load(fd);
acess_close(fd);
#if DEBUG
- printf("fmt->Load(%p): %p\n", fd, ret);
+ printf("fmt->Load(0x%x): %p\n", fd, ret);
#endif
if( !ret ) {
return NULL;
}
//printf("Binary_GetSymbol: RETURN 0, not found\n");
-
+ printf("--- ERROR: Unable to find symbol '%s'\n", SymbolName);
+
+ exit( -1 );
return 0;
}