Prevent -p injecting when already injected
Don't inject into the parent if injection has already occurred. This prevents the reference count from increasing, allowing a single -pu to unload, rather than one -pu for each -p.
This commit is contained in:
parent
86512f67f6
commit
eec487abb6
12
ansicon.c
12
ansicon.c
@ -94,7 +94,8 @@
|
||||
import the DLL.
|
||||
|
||||
v1.85, 22 August, 2018:
|
||||
use IsConsoleHandle for my_fputws, to distinguish NUL.
|
||||
use IsConsoleHandle for my_fputws, to distinguish NUL;
|
||||
don't load into the parent if already loaded.
|
||||
*/
|
||||
|
||||
#define PDATE L"22 August, 2018"
|
||||
@ -219,10 +220,10 @@ void RemoteLoad( LPPROCESS_INFORMATION ppi, LPCTSTR app, BOOL unload )
|
||||
if (_wcsicmp( me.szModule, L"kernel32.dll" ) == 0)
|
||||
{
|
||||
proc = me.modBaseAddr;
|
||||
if (!unload || param)
|
||||
if (param)
|
||||
break;
|
||||
}
|
||||
else if (unload)
|
||||
else
|
||||
{
|
||||
#ifdef _WIN64
|
||||
if (_wcsicmp( me.szModule, DllNameType - 4 ) == 0)
|
||||
@ -247,6 +248,11 @@ void RemoteLoad( LPPROCESS_INFORMATION ppi, LPCTSTR app, BOOL unload )
|
||||
DEBUGSTR( 1, " Unable to locate ANSICON's DLL" );
|
||||
return;
|
||||
}
|
||||
else if (!unload && param != NULL)
|
||||
{
|
||||
DEBUGSTR( 1, " ANSICON already loaded" );
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
rva = GetProcRVA( L"kernel32.dll", (unload) ? "FreeLibrary"
|
||||
|
@ -341,7 +341,8 @@ Version History
|
||||
|
||||
1.85 - 22 August, 2018:
|
||||
- fix wrap issues with a buffer bigger than the window;
|
||||
- fix -e et al when redirecting to NUL.
|
||||
- fix -e et al when redirecting to NUL;
|
||||
- prevent -p from injecting when already injected.
|
||||
|
||||
1.84 - 11 May, 2018:
|
||||
- close the flush handles on detach;
|
||||
|
Loading…
x
Reference in New Issue
Block a user