remove some TitanEngine calls
This commit is contained in:
parent
9394b06c4d
commit
2fd5cedd0d
|
@ -13,16 +13,15 @@
|
||||||
///api functions
|
///api functions
|
||||||
bool apienumexports(duint base, const EXPORTENUMCALLBACK & cbEnum)
|
bool apienumexports(duint base, const EXPORTENUMCALLBACK & cbEnum)
|
||||||
{
|
{
|
||||||
duint size;
|
duint export_dir_rva, export_dir_size;
|
||||||
base = MemFindBaseAddr(base, &size);
|
{
|
||||||
if(!base || !size)
|
SHARED_ACQUIRE(LockModules);
|
||||||
return false;
|
auto modinfo = ModInfoFromAddr(base);
|
||||||
Memory<void*> buffer(size, "apienumexports:buffer");
|
if(!modinfo)
|
||||||
if(!MemRead(base, buffer(), size))
|
return false;
|
||||||
return false;
|
export_dir_rva = GetPE32DataFromMappedFile(modinfo->fileMapVA, 0, UE_EXPORTTABLEADDRESS);
|
||||||
IMAGE_NT_HEADERS* pnth = (IMAGE_NT_HEADERS*)((duint)buffer() + GetPE32DataFromMappedFile((ULONG_PTR)buffer(), 0, UE_PE_OFFSET));
|
export_dir_size = GetPE32DataFromMappedFile(modinfo->fileMapVA, 0, UE_EXPORTTABLESIZE);
|
||||||
duint export_dir_rva = pnth->OptionalHeader.DataDirectory[0].VirtualAddress;
|
}
|
||||||
duint export_dir_size = pnth->OptionalHeader.DataDirectory[0].Size;
|
|
||||||
IMAGE_EXPORT_DIRECTORY export_dir;
|
IMAGE_EXPORT_DIRECTORY export_dir;
|
||||||
memset(&export_dir, 0, sizeof(export_dir));
|
memset(&export_dir, 0, sizeof(export_dir));
|
||||||
MemRead((export_dir_rva + base), &export_dir, sizeof(export_dir));
|
MemRead((export_dir_rva + base), &export_dir, sizeof(export_dir));
|
||||||
|
@ -69,32 +68,26 @@ bool apienumexports(duint base, const EXPORTENUMCALLBACK & cbEnum)
|
||||||
|
|
||||||
bool apienumimports(duint base, const IMPORTENUMCALLBACK & cbEnum)
|
bool apienumimports(duint base, const IMPORTENUMCALLBACK & cbEnum)
|
||||||
{
|
{
|
||||||
|
ULONG_PTR importTableRva, importTableSize;
|
||||||
|
{
|
||||||
|
SHARED_ACQUIRE(LockModules);
|
||||||
|
auto modinfo = ModInfoFromAddr(base);
|
||||||
|
if(!modinfo)
|
||||||
|
return false;
|
||||||
|
importTableRva = GetPE32DataFromMappedFile(modinfo->fileMapVA, 0, UE_IMPORTTABLEADDRESS);
|
||||||
|
importTableSize = GetPE32DataFromMappedFile(modinfo->fileMapVA, 0, UE_IMPORTTABLESIZE);
|
||||||
|
}
|
||||||
// Variables
|
// Variables
|
||||||
bool readSuccess;
|
bool readSuccess;
|
||||||
Memory<char*> importName(MAX_IMPORT_SIZE + 1, "apienumimports:buffer");
|
Memory<char*> importName(MAX_IMPORT_SIZE + 1, "apienumimports:buffer");
|
||||||
char importModuleName[MAX_MODULE_SIZE + 1] = "";
|
char importModuleName[MAX_MODULE_SIZE + 1] = "";
|
||||||
duint regionSize;
|
duint regionSize;
|
||||||
ULONG_PTR importTableRva, importTableSize;
|
|
||||||
PIMAGE_IMPORT_DESCRIPTOR importTableVa;
|
PIMAGE_IMPORT_DESCRIPTOR importTableVa;
|
||||||
IMAGE_IMPORT_DESCRIPTOR importDescriptor;
|
IMAGE_IMPORT_DESCRIPTOR importDescriptor;
|
||||||
PIMAGE_THUNK_DATA imageIATVa, imageINTVa;
|
PIMAGE_THUNK_DATA imageIATVa, imageINTVa;
|
||||||
IMAGE_THUNK_DATA imageOftThunkData, imageFtThunkData;
|
IMAGE_THUNK_DATA imageOftThunkData, imageFtThunkData;
|
||||||
PIMAGE_IMPORT_BY_NAME pImageImportByNameVa;
|
PIMAGE_IMPORT_BY_NAME pImageImportByNameVa;
|
||||||
|
|
||||||
// Get page size
|
|
||||||
base = MemFindBaseAddr(base, ®ionSize);
|
|
||||||
if(!base || !regionSize)
|
|
||||||
return false;
|
|
||||||
Memory<void*> buffer(regionSize, "apienumimports:buffer");
|
|
||||||
|
|
||||||
// Read first page into buffer
|
|
||||||
if(!MemRead(base, buffer(), regionSize))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Import Table address and size
|
|
||||||
importTableRva = GetPE32DataFromMappedFile((duint)buffer(), 0, UE_IMPORTTABLEADDRESS);
|
|
||||||
importTableSize = GetPE32DataFromMappedFile((duint)buffer(), 0, UE_IMPORTTABLESIZE);
|
|
||||||
|
|
||||||
// Return if no imports
|
// Return if no imports
|
||||||
if(!importTableSize)
|
if(!importTableSize)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -224,35 +224,27 @@ bool cbDebugDownloadSymbol(int argc, char* argv[])
|
||||||
|
|
||||||
bool cbInstrImageinfo(int argc, char* argv[])
|
bool cbInstrImageinfo(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
duint mod;
|
|
||||||
SHARED_ACQUIRE(LockModules);
|
|
||||||
MODINFO* info;
|
|
||||||
duint address;
|
duint address;
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
address = GetContextDataEx(hActiveThread, UE_CIP);
|
address = GetContextDataEx(hActiveThread, UE_CIP);
|
||||||
else
|
else if(!valfromstring(argv[1], &address))
|
||||||
{
|
{
|
||||||
if(!valfromstring(argv[1], &address))
|
dputs(QT_TRANSLATE_NOOP("DBG", "Invalid argument"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
duint c, dllc, mod;
|
||||||
|
{
|
||||||
|
SHARED_ACQUIRE(LockModules);
|
||||||
|
auto modinfo = ModInfoFromAddr(address);
|
||||||
|
if(!modinfo)
|
||||||
{
|
{
|
||||||
dputs(QT_TRANSLATE_NOOP("DBG", "Invalid argument"));
|
dputs(QT_TRANSLATE_NOOP("DBG", "Invalid argument"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
c = GetPE32DataFromMappedFile(modinfo->fileMapVA, 0, UE_CHARACTERISTICS);
|
||||||
|
dllc = GetPE32DataFromMappedFile(modinfo->fileMapVA, 0, UE_DLLCHARACTERISTICS);
|
||||||
|
mod = modinfo->base;
|
||||||
}
|
}
|
||||||
mod = MemFindBaseAddr(address, nullptr);
|
|
||||||
if(mod == 0)
|
|
||||||
{
|
|
||||||
dputs(QT_TRANSLATE_NOOP("DBG", "Invalid argument"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
info = ModInfoFromAddr(mod);
|
|
||||||
if(info == nullptr)
|
|
||||||
{
|
|
||||||
dputs(QT_TRANSLATE_NOOP("DBG", "Invalid argument"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
auto c = GetPE32DataFromMappedFile(info->fileMapVA, 0, UE_CHARACTERISTICS);
|
|
||||||
auto dllc = GetPE32DataFromMappedFile(info->fileMapVA, 0, UE_DLLCHARACTERISTICS);
|
|
||||||
SHARED_RELEASE();
|
|
||||||
|
|
||||||
auto pFlag = [](ULONG_PTR value, ULONG_PTR flag, const char* name)
|
auto pFlag = [](ULONG_PTR value, ULONG_PTR flag, const char* name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2844,6 +2844,7 @@ static void debugLoopFunction(void* lpParameter, bool attach)
|
||||||
pDebuggedBase = 0;
|
pDebuggedBase = 0;
|
||||||
pCreateProcessBase = 0;
|
pCreateProcessBase = 0;
|
||||||
isDetachedByUser = false;
|
isDetachedByUser = false;
|
||||||
|
hActiveThread = nullptr;
|
||||||
if(!gDllLoader.empty()) //Delete the DLL loader (#1496)
|
if(!gDllLoader.empty()) //Delete the DLL loader (#1496)
|
||||||
{
|
{
|
||||||
DeleteFileW(gDllLoader.c_str());
|
DeleteFileW(gDllLoader.c_str());
|
||||||
|
|
Loading…
Reference in New Issue