mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
win32.c: check by module handles
* win32/win32.c (console_emulator_p): check by comparison between module handle of WriteConsoleW and kernel32.dll. * configure.in, win32/Makefile.sub, win32/setup.mak: no longer need psapi.lib. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8ac4f421e1
commit
d66c5768ca
5 changed files with 25 additions and 43 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Thu Oct 17 17:11:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/win32.c (console_emulator_p): check by comparison between
|
||||||
|
module handle of WriteConsoleW and kernel32.dll.
|
||||||
|
|
||||||
|
* configure.in, win32/Makefile.sub, win32/setup.mak: no longer need
|
||||||
|
psapi.lib.
|
||||||
|
|
||||||
Thu Oct 17 16:53:30 2013 Koichi Sasada <ko1@atdot.net>
|
Thu Oct 17 16:53:30 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* gc.c, internal.h: add new internal memory mangement functions.
|
* gc.c, internal.h: add new internal memory mangement functions.
|
||||||
|
|
|
@ -933,7 +933,7 @@ main()
|
||||||
AC_CHECK_FUNCS(cygwin_conv_path)
|
AC_CHECK_FUNCS(cygwin_conv_path)
|
||||||
AC_LIBOBJ([langinfo])
|
AC_LIBOBJ([langinfo])
|
||||||
],
|
],
|
||||||
[mingw*], [ LIBS="-lshell32 -lws2_32 -lpsapi -liphlpapi -limagehlp -lshlwapi $LIBS"
|
[mingw*], [ LIBS="-lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi $LIBS"
|
||||||
ac_cv_header_a_out_h=no
|
ac_cv_header_a_out_h=no
|
||||||
ac_cv_header_pwd_h=no
|
ac_cv_header_pwd_h=no
|
||||||
ac_cv_header_utime_h=no
|
ac_cv_header_utime_h=no
|
||||||
|
|
|
@ -232,7 +232,7 @@ LIBS = oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib
|
||||||
!if $(MSC_VER) >= 1400
|
!if $(MSC_VER) >= 1400
|
||||||
LIBS = $(LIBS) iphlpapi.lib
|
LIBS = $(LIBS) iphlpapi.lib
|
||||||
!endif
|
!endif
|
||||||
LIBS = $(LIBS) psapi.lib imagehlp.lib shlwapi.lib $(EXTLIBS)
|
LIBS = $(LIBS) imagehlp.lib shlwapi.lib $(EXTLIBS)
|
||||||
!endif
|
!endif
|
||||||
!if !defined(MISSING)
|
!if !defined(MISSING)
|
||||||
MISSING = acosh.obj cbrt.obj crypt.obj erf.obj ffs.obj langinfo.obj lgamma_r.obj strlcat.obj strlcpy.obj tgamma.obj win32/win32.obj win32/file.obj setproctitle.obj
|
MISSING = acosh.obj cbrt.obj crypt.obj erf.obj ffs.obj langinfo.obj lgamma_r.obj strlcat.obj strlcpy.obj tgamma.obj win32/win32.obj win32/file.obj setproctitle.obj
|
||||||
|
@ -308,9 +308,6 @@ STACK = $(STACK),$(STACK_COMMIT)
|
||||||
!endif
|
!endif
|
||||||
ORGLIBPATH = $(LIB)
|
ORGLIBPATH = $(LIB)
|
||||||
|
|
||||||
!if !defined(HAVE_PSAPI_H)
|
|
||||||
HAVE_PSAPI_H = 0
|
|
||||||
!endif
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
|
|
||||||
LIBRUBY_A = $(RUBY_SO_NAME)-static.lib
|
LIBRUBY_A = $(RUBY_SO_NAME)-static.lib
|
||||||
|
@ -681,9 +678,6 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
|
||||||
#define HAVE_DAYLIGHT 1
|
#define HAVE_DAYLIGHT 1
|
||||||
#define HAVE_GMTIME_R 1
|
#define HAVE_GMTIME_R 1
|
||||||
#define HAVE_TYPE_NET_LUID 1
|
#define HAVE_TYPE_NET_LUID 1
|
||||||
!if $(HAVE_PSAPI_H)
|
|
||||||
#define HAVE_PSAPI_H 1
|
|
||||||
!endif
|
|
||||||
#define SETPGRP_VOID 1
|
#define SETPGRP_VOID 1
|
||||||
#define RSHIFT(x,y) ((x)>>(int)y)
|
#define RSHIFT(x,y) ((x)>>(int)y)
|
||||||
#define HAVE_RB_FD_INIT 1
|
#define HAVE_RB_FD_INIT 1
|
||||||
|
|
|
@ -100,7 +100,7 @@ int main(void) {FILE *volatile f = stdin; return 0;}
|
||||||
@$(WIN32DIR:/=\)\rtname conftest.exe >>$(MAKEFILE)
|
@$(WIN32DIR:/=\)\rtname conftest.exe >>$(MAKEFILE)
|
||||||
@$(WIN32DIR:/=\)\rm.bat conftest.*
|
@$(WIN32DIR:/=\)\rm.bat conftest.*
|
||||||
|
|
||||||
-headers-: check-psapi.h
|
-headers-: nul
|
||||||
|
|
||||||
check-psapi.h: nul
|
check-psapi.h: nul
|
||||||
($(CC) -MD <<conftest.c psapi.lib -link && echo>>$(MAKEFILE) HAVE_PSAPI_H=1) & $(WIN32DIR:/=\)\rm.bat conftest.*
|
($(CC) -MD <<conftest.c psapi.lib -link && echo>>$(MAKEFILE) HAVE_PSAPI_H=1) & $(WIN32DIR:/=\)\rm.bat conftest.*
|
||||||
|
|
|
@ -39,12 +39,6 @@
|
||||||
#include <share.h>
|
#include <share.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <mbstring.h>
|
#include <mbstring.h>
|
||||||
#ifdef HAVE_PSAPI_H
|
|
||||||
#include <psapi.h>
|
|
||||||
# define CHECK_CONSOLE_EMULATOR 1
|
|
||||||
#else
|
|
||||||
# define CHECK_CONSOLE_EMULATOR 0
|
|
||||||
#endif
|
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#if _MSC_VER >= 1400
|
#if _MSC_VER >= 1400
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
|
@ -611,11 +605,7 @@ static CRITICAL_SECTION select_mutex;
|
||||||
static int NtSocketsInitialized = 0;
|
static int NtSocketsInitialized = 0;
|
||||||
static st_table *socklist = NULL;
|
static st_table *socklist = NULL;
|
||||||
static st_table *conlist = NULL;
|
static st_table *conlist = NULL;
|
||||||
#if CHECK_CONSOLE_EMULATOR
|
|
||||||
#define conlist_disabled ((st_table *)-1)
|
#define conlist_disabled ((st_table *)-1)
|
||||||
#else
|
|
||||||
#define conlist_disabled ((st_table *)NULL)
|
|
||||||
#endif
|
|
||||||
static char *envarea;
|
static char *envarea;
|
||||||
static char *uenvarea;
|
static char *uenvarea;
|
||||||
|
|
||||||
|
@ -5843,36 +5833,26 @@ rb_w32_pipe(int fds[2])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CHECK_CONSOLE_EMULATOR
|
|
||||||
/* License: Ruby's */
|
/* License: Ruby's */
|
||||||
static int
|
static int
|
||||||
console_emulator_p(void)
|
console_emulator_p(void)
|
||||||
{
|
{
|
||||||
HMODULE module_buf[10], *pmodule = module_buf;
|
#ifdef _WIN32_WCE
|
||||||
DWORD nmodule = numberof(module_buf), needed = 0, i;
|
return FALSE;
|
||||||
HANDLE proch = GetCurrentProcess();
|
|
||||||
|
|
||||||
if (!EnumProcessModules(proch, pmodule, nmodule * sizeof(HMODULE), &needed))
|
|
||||||
return FALSE;
|
|
||||||
if (needed / sizeof(HMODULE) > nmodule) {
|
|
||||||
nmodule = needed / sizeof(HMODULE);
|
|
||||||
pmodule = alloca(sizeof(HMODULE) * nmodule);
|
|
||||||
if (!EnumProcessModules(proch, pmodule, needed, &needed))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
for (i = 0; i < nmodule; i++) {
|
|
||||||
WCHAR modname[MAX_PATH];
|
|
||||||
|
|
||||||
if (GetModuleBaseNameW(proch, pmodule[i], modname, numberof(modname))) {
|
|
||||||
if (PathMatchSpecW(modname, L"conemu*.dll")) return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#define console_emulator_p() 0
|
const void *const func = WriteConsoleW;
|
||||||
|
HMODULE k;
|
||||||
|
MEMORY_BASIC_INFORMATION m;
|
||||||
|
|
||||||
|
memset(&m, 0, sizeof(m));
|
||||||
|
if (!VirtualQuery(func, &m, sizeof(m))) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
k = GetModuleHandle("kernel32.dll");
|
||||||
|
if (!k) return FALSE;
|
||||||
|
return (HMODULE)m.AllocationBase != k;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* License: Ruby's */
|
/* License: Ruby's */
|
||||||
static struct constat *
|
static struct constat *
|
||||||
|
|
Loading…
Reference in a new issue