Fixes
Unhook on terminate, to properly exit (Vista CMD.EXE and a MinGW-built ansicon.exe would seem to exit okay, but the exit code was wrong). Fixes #123. Verify the DLL exists prior to injection. With the DLL now being added to the import table, failing to find it would prevent the process itself from loading.
This commit is contained in:
parent
0472db80b2
commit
eccbbe7a54
17
ANSI.c
17
ANSI.c
@ -215,6 +215,10 @@
|
||||
always inject from ansicon.exe, even if it's GUI or excluded;
|
||||
log CreateFile calls;
|
||||
preserve last error.
|
||||
|
||||
v1.86, 4 November, 2018:
|
||||
always unhook, even on terminate;
|
||||
check the DLL still exists before adding to imports.
|
||||
*/
|
||||
|
||||
#include "ansicon.h"
|
||||
@ -3026,6 +3030,17 @@ void Inject( DWORD dwCreationFlags, LPPROCESS_INFORMATION lpi,
|
||||
}
|
||||
if (type > 0)
|
||||
{
|
||||
#if defined(_WIN64) || defined(W32ON64)
|
||||
if (type == 32)
|
||||
*(PDWORD)DllNameType = 0x320033/*L'23'*/;
|
||||
else
|
||||
*(PDWORD)DllNameType = 0x340036/*L'46'*/;
|
||||
#endif
|
||||
if (GetFileAttributes( DllName ) == INVALID_FILE_ATTRIBUTES)
|
||||
type = 0;
|
||||
}
|
||||
if (type > 0)
|
||||
{
|
||||
#ifdef _WIN64
|
||||
if (type == 64)
|
||||
{
|
||||
@ -4122,7 +4137,6 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
|
||||
if (lpReserved == NULL)
|
||||
{
|
||||
DEBUGSTR( 1, "Unloading" );
|
||||
HookAPIAllMod( Hooks, TRUE, FALSE );
|
||||
if (winmm != NULL)
|
||||
FreeLibrary( winmm );
|
||||
}
|
||||
@ -4130,6 +4144,7 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
|
||||
{
|
||||
DEBUGSTR( 1, "Terminating" );
|
||||
}
|
||||
HookAPIAllMod( Hooks, TRUE, FALSE );
|
||||
if (orgattr != 0)
|
||||
{
|
||||
hConOut = CreateFile( L"CONOUT$", GENERIC_READ | GENERIC_WRITE,
|
||||
|
@ -99,7 +99,7 @@
|
||||
add log level 32 to log CreateFile.
|
||||
*/
|
||||
|
||||
#define PDATE L"23 August, 2018"
|
||||
#define PDATE L"4 November, 2018"
|
||||
|
||||
#include "ansicon.h"
|
||||
#include "version.h"
|
||||
|
@ -23,6 +23,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef INVALID_FILE_ATTRIBUTES
|
||||
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
||||
#endif
|
||||
#ifndef LOAD_LIBRARY_AS_IMAGE_RESOURCE
|
||||
#define LOAD_LIBRARY_AS_IMAGE_RESOURCE 0x20
|
||||
#endif
|
||||
|
10
readme.txt
10
readme.txt
@ -3,7 +3,7 @@
|
||||
|
||||
Copyright 2005-2018 Jason Hood
|
||||
|
||||
Version 1.85. Freeware
|
||||
Version 1.86. Freeware
|
||||
|
||||
|
||||
Description
|
||||
@ -340,6 +340,10 @@ Version History
|
||||
|
||||
Legend: + added, - bug-fixed, * changed.
|
||||
|
||||
1.86 - 4 November, 2018:
|
||||
- check the DLL exists before importing it (allows renaming to update);
|
||||
- unhook on terminate, as well (fixes issues with Vista and MinGW).
|
||||
|
||||
1.85 - 23 August, 2018:
|
||||
- fix wrap issues with a buffer bigger than the window;
|
||||
- fix -e et al when redirecting to NUL;
|
||||
@ -636,5 +640,5 @@ Distribution
|
||||
in LICENSE.txt.
|
||||
|
||||
|
||||
============================
|
||||
Jason Hood, 23 August, 2018.
|
||||
=============================
|
||||
Jason Hood, 4 November, 2018.
|
||||
|
10
version.h
10
version.h
@ -2,11 +2,11 @@
|
||||
version.h - Version defines.
|
||||
*/
|
||||
|
||||
#define PVERS L"1.85" // wide string
|
||||
#define PVERSA "1.85" // ANSI string (windres 2.16.91 didn't like L)
|
||||
#define PVERE L"185" // wide environment string
|
||||
#define PVEREA "185" // ANSI environment string
|
||||
#define PVERB 1,8,5,0 // binary (resource)
|
||||
#define PVERS L"1.86" // wide string
|
||||
#define PVERSA "1.86" // ANSI string (windres 2.16.91 didn't like L)
|
||||
#define PVERE L"186" // wide environment string
|
||||
#define PVEREA "186" // ANSI environment string
|
||||
#define PVERB 1,8,6,0 // binary (resource)
|
||||
|
||||
#ifdef _WIN64
|
||||
# define BITS L"64"
|
||||
|
Loading…
x
Reference in New Issue
Block a user