diff --git a/ANSI.c b/ANSI.c index a7147ea..ba09088 100644 --- a/ANSI.c +++ b/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, diff --git a/ansicon.c b/ansicon.c index b141fbf..9f9ab29 100644 --- a/ansicon.c +++ b/ansicon.c @@ -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" diff --git a/ansicon.h b/ansicon.h index f670098..52612cf 100644 --- a/ansicon.h +++ b/ansicon.h @@ -23,6 +23,9 @@ #include #include +#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 diff --git a/readme.txt b/readme.txt index 0518284..6d3401f 100644 --- a/readme.txt +++ b/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. diff --git a/version.h b/version.h index e16637a..2c5109c 100644 --- a/version.h +++ b/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"