mirror of https://github.com/x64dbg/TitanEngine
Fix a problem with LoadDll.hFile and committing gigabytes of memory on attach
This commit is contained in:
parent
5d1e43bb69
commit
587183f984
|
|
@ -165,6 +165,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
||||||
myCustomHandler(&DBGEvent.u.CreateProcessInfo);
|
myCustomHandler(&DBGEvent.u.CreateProcessInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(DBGFileHandle)
|
||||||
EngineCloseHandle(DBGFileHandle); //close file handle
|
EngineCloseHandle(DBGFileHandle); //close file handle
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -258,7 +259,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
||||||
memset(&NewLibraryData, 0, sizeof(LIBRARY_ITEM_DATAW));
|
memset(&NewLibraryData, 0, sizeof(LIBRARY_ITEM_DATAW));
|
||||||
NewLibraryData.hFile = DBGEvent.u.LoadDll.hFile;
|
NewLibraryData.hFile = DBGEvent.u.LoadDll.hFile;
|
||||||
NewLibraryData.BaseOfDll = DBGEvent.u.LoadDll.lpBaseOfDll;
|
NewLibraryData.BaseOfDll = DBGEvent.u.LoadDll.lpBaseOfDll;
|
||||||
hFileMapping = CreateFileMappingA(DBGEvent.u.LoadDll.hFile, NULL, PAGE_READONLY, NULL, GetFileSize(DBGEvent.u.LoadDll.hFile, NULL), NULL);
|
hFileMapping = DBGEvent.u.LoadDll.hFile ? CreateFileMappingA(DBGEvent.u.LoadDll.hFile, NULL, PAGE_READONLY, 0, 0, NULL) : NULL;
|
||||||
if(hFileMapping != NULL)
|
if(hFileMapping != NULL)
|
||||||
{
|
{
|
||||||
hFileMappingView = MapViewOfFile(hFileMapping, FILE_MAP_READ, NULL, NULL, NULL);
|
hFileMappingView = MapViewOfFile(hFileMapping, FILE_MAP_READ, NULL, NULL, NULL);
|
||||||
|
|
@ -331,6 +332,9 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
||||||
myCustomHandler = (fCustomHandler)((LPVOID)DBGCustomHandler->chLoadDll);
|
myCustomHandler = (fCustomHandler)((LPVOID)DBGCustomHandler->chLoadDll);
|
||||||
myCustomHandler(&DBGEvent.u.LoadDll);
|
myCustomHandler(&DBGEvent.u.LoadDll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(DBGEvent.u.LoadDll.hFile)
|
||||||
|
EngineCloseHandle(DBGEvent.u.LoadDll.hFile); //close file handle
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -379,7 +383,6 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
||||||
UnmapViewOfFile(hListLibrary.at(i).hFileMappingView);
|
UnmapViewOfFile(hListLibrary.at(i).hFileMappingView);
|
||||||
EngineCloseHandle(hListLibrary.at(i).hFileMapping);
|
EngineCloseHandle(hListLibrary.at(i).hFileMapping);
|
||||||
}
|
}
|
||||||
EngineCloseHandle(hListLibrary.at(i).hFile);
|
|
||||||
hListLibrary.erase(hListLibrary.begin() + i);
|
hListLibrary.erase(hListLibrary.begin() + i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue