[Kernel] Make XexUnloadImage fully release the image

Previously XexUnloadImage did not cleanup the image fully,
and if XexLoadImage was to be called again on the same module,
it was not initialized fully, leading to a crash when using it.
This commit is contained in:
Silent
2019-09-02 21:48:51 +02:00
committed by Rick Gibbed
parent 9d48e904da
commit 38bf6c8822
3 changed files with 37 additions and 1 deletions

View File

@@ -129,7 +129,8 @@ dword_result_t XexUnloadImage(lpvoid_t hmodule) {
if (--ldr_data->load_count == 0) {
// No more references, free it.
module->Release();
kernel_state()->object_table()->RemoveHandle(module->handle());
kernel_state()->UnloadUserModule(object_ref<UserModule>(
reinterpret_cast<UserModule*>(module.release())));
}
}