MainStub VirtualMachine::LoadMainContainer(const std::string &path) { if (!fragmentManager.LoadContainer(path)) throw std::logic_error("Could not load specified container"); auto resolver = fragmentManager.GetSymbolResolver(path); auto entryPoints = resolver->GetEntryPoints(); for (const auto& entryPoint : entryPoints) { if (entryPoint.Name == CFM::SymbolResolver::MainSymbolName) { if (entryPoint.Universe == CFM::SymbolUniverse::PowerPC) return MainStub(*this, entryPoint); else throw std::logic_error("Container successfully resolved, but main symbol is not a PPC symbol"); } } throw std::logic_error("Container does not contain a main symbol"); }
BOOL CRegisterDLL::Startup(void) { Shutdown(); /* // Generate the library name. */ CString csLibName; TRY { #ifdef WIN32 csLibName = GetGlobalPathManager()->ExpandPath("MSREG32.DLL"); #else csLibName = GetGlobalPathManager()->ExpandPath("MSREG16.DLL"); #endif } CATCH_ALL(e) { return FALSE; } END_CATCH_ALL UINT wOldSem = SetErrorMode(SEM_NOOPENFILEERRORBOX); if ((m_hLibrary = LoadLibrary(csLibName)) < (HINSTANCE)HINSTANCE_ERROR) { m_hLibrary = NULL; } SetErrorMode(wOldSem); GetEntryPoints(); // Setup our event notify. RegSendCommand(REGCOMMAND_SetEventNotify, (DWORD)EventNotify); return IsValid(); }
BOOL CSpellEngine::Startup(void) { // If we are already open, there is nothing to do. if (IsValid()) { return TRUE; } #ifdef WIN32 LPCSTR pszDLLName = "SSCE4132.DLL"; #else LPCSTR pszDLLName = "SSCE4116.DLL"; #endif // We use the path manager to create a full path. This means that we will // ONLY be loading the DLL if it is in our directory. If this is undesirable, // (e.g. if we want to also be able to load from WINDOWS dir, etc), then // just pass the base name. CString csDLLName = GetGlobalPathManager()->ExpandPath(pszDLLName); // We don't want any error messages while we're loading the library. UINT wOldSem = SetErrorMode(SEM_NOOPENFILEERRORBOX); // Load the library. if ((m_hLibrary = LoadLibrary(csDLLName)) < (HINSTANCE)HINSTANCE_ERROR) { // Failed! ASSERT(FALSE); m_hLibrary = NULL; } // Restore the previous error mode. SetErrorMode(wOldSem); // And get the entry points from the DLL. return GetEntryPoints(); }