When loading a new executable file for debugging, MapFileEx() is used to map it to memory after opening a handle to the file. The resulting handle is not closed afterwards and left open during further execution.
|
if(MapFileEx(szFileName, DesiredAccess, FileHandle, LoadedSize, FileMap, FileMapVA, NULL)) |
|
{ |
|
return true; |
|
} |
This enables an anti-debugging technique where the process can attempt to open its own executable file for exclusive access, but will fail receiving an INVALID_HANDLE_VALUE instead of a valid handle.
My suggestion would be to close the handle before returning. But since I am not familiar with the code base, I decided to open an issue first.
When loading a new executable file for debugging, MapFileEx() is used to map it to memory after opening a handle to the file. The resulting handle is not closed afterwards and left open during further execution.
TitanEngine/TitanEngine/TitanEngine.Static.cpp
Lines 13 to 16 in 7976be4
This enables an anti-debugging technique where the process can attempt to open its own executable file for exclusive access, but will fail receiving an INVALID_HANDLE_VALUE instead of a valid handle.
My suggestion would be to close the handle before returning. But since I am not familiar with the code base, I decided to open an issue first.