コード例 #1
0
void init(HMODULE hModule)
{
   Path rootPath;
   loadDLLPath(hModule, rootPath);

   instance = new Instance(rootPath.c_str());

   void* debugSection = NULL;
   Instance::ImageSection section;
   section.init((void*)0x400000, 0x1000);

   size_t ptr = 0;
   PEHelper::seekSection(MemoryReader(&section), ".debug", ptr);
   debugSection = (void*)ptr;

   Path configPath(CONFIG_PATH);
   instance->init(debugSection, configPath.c_str());
}
コード例 #2
0
ファイル: dllmain.cpp プロジェクト: bencz/cpu-simulator
EXTERN_DLL_EXPORT void* Init(void* debugSection, ident_t package)
{
   if (instance) {
      if (debugSection == NULL) {
         Instance::ImageSection section;
         section.init((void*)0x400000, 0x1000);

         size_t ptr = 0;
         PEHelper::seekSection(MemoryReader(&section), ".debug", ptr);
         debugSection = (void*)ptr;
      }

      Path configPath;
      Path::loadPath(configPath, CONFIG_PATH);
      instance->init(debugSection, package, configPath);

      return instance;
   }
   else return 0;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: ELENA-LANG/elena-lang
void* init()
{
   instance = new Instance(CONFIG_PATH);

   void* debugSection = NULL;
   void* messageSection = NULL;
   Instance::ImageSection section;
   section.init((void*)IMAGE_BASE, 0x1000);

   size_t ptr = 0;
   MemoryReader reader(&section);

   ELFHelper::seekDebugSegment(reader, ptr);
   debugSection = (void*)ptr;

   PEHelper::seekSection(MemoryReader(&section), ".mdata", ptr);
   messageSection = (void*)ptr;

   instance->init(debugSection, messageSection, CONFIG_PATH);

   return instance;
}