PyMODINIT_FUNC init_opticks() { auto_obj pModule(Py_InitModule3("_opticks", OpticksModule::opticksMethods, "Internal Opticks support module.")); if (pModule.get() == NULL) { return; } }
void CSIF::Cmd_Call(const SIFCMDHEADER* hdr) { auto call = reinterpret_cast<const SIFRPCCALL*>(hdr); bool sendReply = true; CLog::GetInstance().Print(LOG_NAME, "Calling function 0x%0.8X of module 0x%0.8X.\r\n", call->rpcNumber, call->serverDataAddr); uint32 nRecvAddr = (call->recv & (PS2::EE_RAM_SIZE - 1)); auto moduleIterator(m_modules.find(call->serverDataAddr)); if(moduleIterator != std::end(m_modules)) { CSifModule* pModule(moduleIterator->second); sendReply = pModule->Invoke(call->rpcNumber, reinterpret_cast<uint32*>(m_eeRam + m_nDataAddr), call->sendSize, reinterpret_cast<uint32*>(m_eeRam + nRecvAddr), call->recvSize, m_eeRam); } else { CLog::GetInstance().Print(LOG_NAME, "Called an unknown module (0x%0.8X).\r\n", call->serverDataAddr); } { SIFRPCREQUESTEND rend; memset(&rend, 0, sizeof(SIFRPCREQUESTEND)); rend.header.packetSize = sizeof(SIFRPCREQUESTEND); rend.header.dest = hdr->dest; rend.header.commandId = SIF_CMD_REND; rend.header.optional = 0; rend.recordId = call->recordId; rend.packetAddr = call->packetAddr; rend.rpcId = call->rpcId; rend.clientDataAddr = call->clientDataAddr; rend.commandId = SIF_CMD_CALL; if(sendReply) { SendPacket(&rend, sizeof(SIFRPCREQUESTEND)); } else { //Hold the packet //We assume that there's only one call that assert(m_callReplies.find(call->serverDataAddr) == m_callReplies.end()); CALLREQUESTINFO requestInfo; requestInfo.reply = rend; requestInfo.call = *call; m_callReplies[call->serverDataAddr] = requestInfo; } } }
TskModule * TskPipeline::createModule(Poco::XML::Element *pElem) { if (!pElem) { LOGERROR(L"TskPipeline::createModule - Passed NULL Element."); return NULL; } try { if (pElem->getAttribute(TskPipeline::MODULE_TYPE_ATTR) == MODULE_EXECUTABLE_TYPE) { // Use auto_ptr to ensure that module will be deleted if there // are exceptions. std::auto_ptr<TskExecutableModule> pModule(new TskExecutableModule()); std::string location(pElem->getAttribute(TskPipeline::MODULE_LOCATION_ATTR)); pModule->setPath(location); //pModule->setPath(pElem->getAttribute(TskPipeline::MODULE_LOCATION_ATTR)); pModule->setArguments(pElem->getAttribute(TskPipeline::MODULE_ARGS_ATTR)); pModule->setOutput(pElem->getAttribute(TskPipeline::MODULE_OUTPUT_ATTR)); m_hasExeModule = true; // The module was successfully created so we no longer need the // auto_ptr to manage it. return pModule.release(); } else if (pElem->getAttribute(TskPipeline::MODULE_TYPE_ATTR) == MODULE_PLUGIN_TYPE) { std::auto_ptr<TskPluginModule> pModule(createPluginModule()); pModule->setPath(pElem->getAttribute(TskPipeline::MODULE_LOCATION_ATTR)); pModule->setArguments(pElem->getAttribute(TskPipeline::MODULE_ARGS_ATTR)); pModule->checkInterface(); // Initialize the module. if (m_loadDll) { if (pModule->initialize() != TskModule::OK) { return NULL; } } // The module was successfully created and initialized so we no longer // need the auto_ptr to manage it. return pModule.release(); } else { std::wstringstream errorMsg; errorMsg << "TskPipeline::createModule - Unrecognized module type : " << pElem->getAttribute(TskPipeline::MODULE_TYPE_ATTR).c_str(); LOGERROR(errorMsg.str()); return NULL; } } catch (TskException& ex) { std::wstringstream errorMsg; errorMsg << L"TskPipeline::createModule - Module creation failed: " << pElem->getAttribute(TskPipeline::MODULE_LOCATION_ATTR).c_str() << L" ("<< ex.message().c_str()<< L")"; LOGERROR(errorMsg.str()); return NULL; } catch (std::exception & ex) { std::wstringstream errorMsg; errorMsg << L"TskPipeline::createModule - Module creation failed: " << pElem->getAttribute(TskPipeline::MODULE_LOCATION_ATTR).c_str() << L" ("<< ex.what() << L")"; LOGERROR(errorMsg.str()); return NULL; } catch (...) { std::wstringstream errorMsg; errorMsg << L"TskPipeline::createModule - Unnkown exception : " << pElem->getAttribute(TskPipeline::MODULE_LOCATION_ATTR).c_str() ; LOGERROR(errorMsg.str()); return NULL; } }