* cygheap.cc (init_cygheap::manage_console_count): Revert previous change.
Handle this a different way. * external.cc (cygwin_internal): Accommodate extra hook_or_detect_cygwin argument. * hookapi.cc (cygwin_internal): Fill in subsys variable with the subsystem of the executable. * spawn.cc (av::iscui): New variable. (spawn_guts): Hide window when we don't have a console and this isn't NT/XP/2003. (av::fixup): Set iscui flag. * winsup.h (hook_or_detect_cygwin): Accommodate extra argument.
This commit is contained in:
parent
d4c8d84da6
commit
247ac234f4
|
@ -1,3 +1,17 @@
|
||||||
|
2005-12-21 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* cygheap.cc (init_cygheap::manage_console_count): Revert previous
|
||||||
|
change. Handle this a different way.
|
||||||
|
* external.cc (cygwin_internal): Accommodate extra
|
||||||
|
hook_or_detect_cygwin argument.
|
||||||
|
* hookapi.cc (cygwin_internal): Fill in subsys variable with the
|
||||||
|
subsystem of the executable.
|
||||||
|
* spawn.cc (av::iscui): New variable.
|
||||||
|
(spawn_guts): Hide window when we don't have a console and this isn't
|
||||||
|
NT/XP/2003.
|
||||||
|
(av::fixup): Set iscui flag.
|
||||||
|
* winsup.h (hook_or_detect_cygwin): Accommodate extra argument.
|
||||||
|
|
||||||
2005-12-21 Christopher Faylor <cgf@timesys.com>
|
2005-12-21 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* cygheap.cc (init_cygheap::manage_console_count): Don't call
|
* cygheap.cc (init_cygheap::manage_console_count): Don't call
|
||||||
|
|
|
@ -96,8 +96,7 @@ init_cygheap::manage_console_count (const char *something, int amount, bool avoi
|
||||||
console_count += amount;
|
console_count += amount;
|
||||||
debug_printf ("%s: console_count %d, amount %d, %s, avoid_freeing_console %d",
|
debug_printf ("%s: console_count %d, amount %d, %s, avoid_freeing_console %d",
|
||||||
something, console_count, amount, myctty (), avoid_freeing_console);
|
something, console_count, amount, myctty (), avoid_freeing_console);
|
||||||
if (wincap.pty_needs_alloc_console () && !avoid_freeing_console && amount <= 0
|
if (!avoid_freeing_console && amount <= 0 && !console_count && myself->ctty == -1)
|
||||||
&& !console_count && myself->ctty == -1)
|
|
||||||
{
|
{
|
||||||
FreeConsole ();
|
FreeConsole ();
|
||||||
debug_printf ("freed console");
|
debug_printf ("freed console");
|
||||||
|
|
|
@ -295,7 +295,8 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
||||||
{
|
{
|
||||||
const char *name = va_arg (arg, const char *);
|
const char *name = va_arg (arg, const char *);
|
||||||
const void *hookfn = va_arg (arg, const void *);
|
const void *hookfn = va_arg (arg, const void *);
|
||||||
return (unsigned long) hook_or_detect_cygwin (name, hookfn);
|
WORD subsys;
|
||||||
|
return (unsigned long) hook_or_detect_cygwin (name, hookfn, subsys);
|
||||||
}
|
}
|
||||||
case CW_ARGV:
|
case CW_ARGV:
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,7 +151,7 @@ makename (const char *name, char *&buf, int& i, int inc)
|
||||||
|
|
||||||
// Top level routine to find the EXE's imports, and redirect them
|
// Top level routine to find the EXE's imports, and redirect them
|
||||||
void *
|
void *
|
||||||
hook_or_detect_cygwin (const char *name, const void *fn)
|
hook_or_detect_cygwin (const char *name, const void *fn, WORD& subsys)
|
||||||
{
|
{
|
||||||
HMODULE hm = fn ? GetModuleHandle (NULL) : (HMODULE) name;
|
HMODULE hm = fn ? GetModuleHandle (NULL) : (HMODULE) name;
|
||||||
PIMAGE_NT_HEADERS pExeNTHdr = PEHeaderFromHModule (hm);
|
PIMAGE_NT_HEADERS pExeNTHdr = PEHeaderFromHModule (hm);
|
||||||
|
@ -159,6 +159,8 @@ hook_or_detect_cygwin (const char *name, const void *fn)
|
||||||
if (!pExeNTHdr)
|
if (!pExeNTHdr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
subsys = pExeNTHdr->OptionalHeader.Subsystem;
|
||||||
|
|
||||||
DWORD importRVA = pExeNTHdr->OptionalHeader.DataDirectory
|
DWORD importRVA = pExeNTHdr->OptionalHeader.DataDirectory
|
||||||
[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
|
[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
|
||||||
if (!importRVA)
|
if (!importRVA)
|
||||||
|
|
|
@ -294,8 +294,9 @@ class av
|
||||||
public:
|
public:
|
||||||
int argc;
|
int argc;
|
||||||
bool win16_exe;
|
bool win16_exe;
|
||||||
av (): argv (NULL) {}
|
bool iscui;
|
||||||
av (int ac_in, const char * const *av_in) : calloced (0), argc (ac_in), win16_exe (false)
|
av (): argv (NULL), iscui (false) {}
|
||||||
|
av (int ac_in, const char * const *av_in) : calloced (0), argc (ac_in), win16_exe (false), iscui (false)
|
||||||
{
|
{
|
||||||
argv = (char **) cmalloc (HEAP_1_ARGV, (argc + 5) * sizeof (char *));
|
argv = (char **) cmalloc (HEAP_1_ARGV, (argc + 5) * sizeof (char *));
|
||||||
memcpy (argv, av_in, (argc + 1) * sizeof (char *));
|
memcpy (argv, av_in, (argc + 1) * sizeof (char *));
|
||||||
|
@ -578,6 +579,11 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
||||||
si.hStdOutput = handle (1, 1); /* Get output handle */
|
si.hStdOutput = handle (1, 1); /* Get output handle */
|
||||||
si.hStdError = handle (2, 1); /* Get output handle */
|
si.hStdError = handle (2, 1); /* Get output handle */
|
||||||
si.cb = sizeof (si);
|
si.cb = sizeof (si);
|
||||||
|
if (!wincap.pty_needs_alloc_console () && newargv.iscui && !GetConsoleCP ())
|
||||||
|
{
|
||||||
|
si.dwFlags |= STARTF_USESHOWWINDOW;
|
||||||
|
si.wShowWindow = SW_HIDE;
|
||||||
|
}
|
||||||
|
|
||||||
int flags = GetPriorityClass (hMainProc);
|
int flags = GetPriorityClass (hMainProc);
|
||||||
sigproc_printf ("priority class %d", flags);
|
sigproc_printf ("priority class %d", flags);
|
||||||
|
@ -1060,11 +1066,13 @@ av::fixup (child_info_types chtype, const char *prog_arg, path_conv& real_path,
|
||||||
}
|
}
|
||||||
if (buf[0] == 'M' && buf[1] == 'Z')
|
if (buf[0] == 'M' && buf[1] == 'Z')
|
||||||
{
|
{
|
||||||
|
WORD subsys;
|
||||||
unsigned off = (unsigned char) buf[0x18] | (((unsigned char) buf[0x19]) << 8);
|
unsigned off = (unsigned char) buf[0x18] | (((unsigned char) buf[0x19]) << 8);
|
||||||
win16_exe = off < sizeof (IMAGE_DOS_HEADER);
|
win16_exe = off < sizeof (IMAGE_DOS_HEADER);
|
||||||
if (!win16_exe)
|
if (!win16_exe)
|
||||||
real_path.set_cygexec (!!hook_or_detect_cygwin (buf, NULL));
|
real_path.set_cygexec (!!hook_or_detect_cygwin (buf, NULL, subsys));
|
||||||
UnmapViewOfFile (buf);
|
UnmapViewOfFile (buf);
|
||||||
|
iscui = subsys == IMAGE_SUBSYSTEM_WINDOWS_CUI;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ extern "C" int __stdcall strcasematch (const char *s1, const char *s2) __attribu
|
||||||
extern "C" int __stdcall strncasematch (const char *s1, const char *s2, size_t n) __attribute__ ((regparm(3)));
|
extern "C" int __stdcall strncasematch (const char *s1, const char *s2, size_t n) __attribute__ ((regparm(3)));
|
||||||
extern "C" char *__stdcall strcasestr (const char *searchee, const char *lookfor) __attribute__ ((regparm(2)));
|
extern "C" char *__stdcall strcasestr (const char *searchee, const char *lookfor) __attribute__ ((regparm(2)));
|
||||||
|
|
||||||
void *hook_or_detect_cygwin (const char *, const void *) __attribute__ ((regparm (2)));
|
void *hook_or_detect_cygwin (const char *, const void *, WORD&) __attribute__ ((regparm (3)));
|
||||||
|
|
||||||
/* Time related */
|
/* Time related */
|
||||||
void __stdcall totimeval (struct timeval *, FILETIME *, int, int);
|
void __stdcall totimeval (struct timeval *, FILETIME *, int, int);
|
||||||
|
|
Loading…
Reference in New Issue