Hi Brendan,
There is a return statement between your enable/disabling redirection.
if (!(dllname = RtlAllocateHeap( GetProcessHeap(), 0,
(strlenW(libname) * sizeof(WCHAR)) + sizeof(dllW) )))
return STATUS_NO_MEMORY;
Regards
Alistair.