Fix unloading

This commit is contained in:
Jason Hood 2017-10-26 21:46:53 +10:00
parent bff5e90eda
commit 3fb6b5aa65
3 changed files with 32 additions and 16 deletions

16
ANSI.c
View File

@ -151,6 +151,9 @@
join multibyte characters split across separate writes; join multibyte characters split across separate writes;
remove wcstok, avoiding potential interference with the host; remove wcstok, avoiding potential interference with the host;
similarly, use a private heap instead of malloc. similarly, use a private heap instead of malloc.
v1.80, 26 October, 2017:
fix unloading.
*/ */
#include "ansicon.h" #include "ansicon.h"
@ -1598,6 +1601,8 @@ BOOL HookAPIAllMod( PHookFn Hooks, BOOL restore, BOOL indent )
if (me.hModule == hDllInstance || me.hModule == hKernel) if (me.hModule == hDllInstance || me.hModule == hKernel)
continue; continue;
if (!restore)
{
// Don't scan what we've already scanned. // Don't scan what we've already scanned.
if (*(PDWORD)((PBYTE)me.hModule + 36) == 'ISNA') // e_oemid, e_oeminfo if (*(PDWORD)((PBYTE)me.hModule + 36) == 'ISNA') // e_oemid, e_oeminfo
{ {
@ -1612,6 +1617,17 @@ BOOL HookAPIAllMod( PHookFn Hooks, BOOL restore, BOOL indent )
*(PDWORD)((PBYTE)me.hModule + 36) = 'ISNA'; *(PDWORD)((PBYTE)me.hModule + 36) = 'ISNA';
VirtualProtect( (PBYTE)me.hModule + 36, 4, pr, &pr ); VirtualProtect( (PBYTE)me.hModule + 36, 4, pr, &pr );
} }
}
else
{
if (*(PDWORD)((PBYTE)me.hModule + 36) != 'ISNA' &&
*(PDWORD)((PBYTE)me.hModule + 0x3C) >= 0x40)
{
if (log_level & 16)
DEBUGSTR( 2, "%s%s %S", sp, zSkipping, me.szModule );
continue;
}
}
if (search_env( L"ANSICON_EXC", me.szModule )) if (search_env( L"ANSICON_EXC", me.szModule ))
{ {
DEBUGSTR( 2, "%s%s %S", sp, zIgnoring, me.szModule ); DEBUGSTR( 2, "%s%s %S", sp, zIgnoring, me.szModule );

View File

@ -87,7 +87,7 @@
add error codes to some message. add error codes to some message.
*/ */
#define PDATE L"24 December, 2015" #define PDATE L"26 October, 2017"
#include "ansicon.h" #include "ansicon.h"
#include "version.h" #include "version.h"

View File

@ -2,11 +2,11 @@
version.h - Version defines. version.h - Version defines.
*/ */
#define PVERS L"1.72" // wide string #define PVERS L"1.80" // wide string
#define PVERSA "1.72" // ANSI string (windres 2.16.91 didn't like L) #define PVERSA "1.80" // ANSI string (windres 2.16.91 didn't like L)
#define PVERE L"172" // wide environment string #define PVERE L"180" // wide environment string
#define PVEREA "172" // ANSI environment string #define PVEREA "180" // ANSI environment string
#define PVERB 1,7,2,0 // binary (resource) #define PVERB 1,8,0,0 // binary (resource)
#ifdef _WIN64 #ifdef _WIN64
# define BITS L"64" # define BITS L"64"