On Tue Oct 18 12:28:32 2022 +0000, Rémi Bernon wrote:
I think you can simplify this a bit, by doing `if ((current_modref = get_modref(...)))`, after saving its previous value, and restoring it before leaving the CS. Then I'm not sure what side effects this could have, and maybe it'd be better to have this specific change separate from the rest?
How about
```c RtlEnterCriticalSection( &loader_section );
prev = current_modref; wm = get_modref( module ); if (wm) current_modref = wm;
if (!wm) ret = STATUS_DLL_NOT_FOUND; else { ... }
current_modref = prev;
RtlLeaveCriticalSection( &loader_section ); ```