| 8 | namespace osidbg |
| 9 | { |
| 10 | bool LibraryManager::FindEoCPlugin(uint8_t const * & start, size_t & size) |
| 11 | { |
| 12 | HMODULE hEoCApp = GetModuleHandleW(L"EoCApp.exe"); |
| 13 | if (hEoCApp != NULL) { |
| 14 | MessageBoxW(NULL, L"This version of the Osiris Extender can only be used with the editor.", L"Osiris Extender Error", MB_OK | MB_ICONERROR); |
| 15 | TerminateProcess(GetCurrentProcess(), 1); |
| 16 | } |
| 17 | |
| 18 | HMODULE hDivinityEngine = GetModuleHandleW(L"DivinityEngine2.exe"); |
| 19 | if (hDivinityEngine == NULL) { |
| 20 | return false; |
| 21 | } |
| 22 | |
| 23 | HMODULE hEoCPlugin = LoadLibraryW(L"EoCPlugin.dll"); |
| 24 | if (hEoCPlugin == NULL) { |
| 25 | return false; |
| 26 | } |
| 27 | |
| 28 | MODULEINFO moduleInfo; |
| 29 | if (!GetModuleInformation(GetCurrentProcess(), hEoCPlugin, &moduleInfo, sizeof(moduleInfo))) { |
| 30 | Fail("Could not get module info of EoCPlugin.dll"); |
| 31 | } |
| 32 | |
| 33 | start = (uint8_t const *)moduleInfo.lpBaseOfDll; |
| 34 | size = moduleInfo.SizeOfImage; |
| 35 | |
| 36 | HMODULE hCoreLib = LoadLibraryW(L"CoreLib.dll"); |
| 37 | if (hCoreLib == NULL) { |
| 38 | return false; |
| 39 | } |
| 40 | |
| 41 | if (!GetModuleInformation(GetCurrentProcess(), hCoreLib, &moduleInfo, sizeof(moduleInfo))) { |
| 42 | Fail("Could not get module info of CoreLib.dll"); |
| 43 | } |
| 44 | |
| 45 | coreLibStart_ = (uint8_t const *)moduleInfo.lpBaseOfDll; |
| 46 | coreLibSize_ = moduleInfo.SizeOfImage; |
| 47 | |
| 48 | return true; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | void LibraryManager::FindMemoryManagerEoCPlugin() |