/* * ======================================================== * * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== */ #include #include #include #include #include #include using namespace HCore; /***********************************************************************************/ /// @file SharedObjectEntry.cxx /// @brief Shared Object Init code. /***********************************************************************************/ /***********************************************************************************/ /* @brief Allocate new library to be added to the lookup table. */ /***********************************************************************************/ extern "C" SharedObject *__LibMain(VoidPtr image) { SharedObject *library = hcore_tls_new_class(); if (!library) { kcout << "__LibMain: Out of Memory!\n"; ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); return nullptr; } library->Mount(hcore_tls_new_class()); if (!library->Get()) { kcout << "__LibMain: Out of Memory!\n"; ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); return nullptr; } library->Get()->fImageObject = ProcessManager::Shared().Leak().GetCurrent().Leak().Image; library->Get()->fImageEntrypointOffset = library->Load(kPefStart); kcout << "__LibMain: Done jumping to library...\n"; return library; } /***********************************************************************************/