* hookapi.cc (rvadelta): Change argument to DWORD to eliminate a compiler
warning. * path.h (path_conv::set_cygexec): New function. * spawn.cc (av::iscygwin): Eliminate. (av::av): Don't initialize iscygwin. (spawn_guts): Just use real_path.iscygexec for all tests. (av::fixup): Short circuit test if .exe extension and known cygexec. Set cygexec flag appropriately if we find that program uses cygwin1.dll.
This commit is contained in:
parent
31fcc87ed9
commit
70d0243ce9
@ -1,3 +1,15 @@
|
|||||||
|
2005-09-07 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* hookapi.cc (rvadelta): Change argument to DWORD to eliminate a
|
||||||
|
compiler warning.
|
||||||
|
|
||||||
|
* path.h (path_conv::set_cygexec): New function.
|
||||||
|
* spawn.cc (av::iscygwin): Eliminate.
|
||||||
|
(av::av): Don't initialize iscygwin.
|
||||||
|
(spawn_guts): Just use real_path.iscygexec for all tests.
|
||||||
|
(av::fixup): Short circuit test if .exe extension and known cygexec.
|
||||||
|
Set cygexec flag appropriately if we find that program uses cygwin1.dll.
|
||||||
|
|
||||||
2005-09-06 Christopher Faylor <cgf@timesys.com>
|
2005-09-06 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* dcrt0.cc (initial_env): Don't attempt stracing if dynamically loaded.
|
* dcrt0.cc (initial_env): Don't attempt stracing if dynamically loaded.
|
||||||
|
@ -39,7 +39,7 @@ PEHeaderFromHModule (HMODULE hModule)
|
|||||||
}
|
}
|
||||||
|
|
||||||
long
|
long
|
||||||
rvadelta (PIMAGE_NT_HEADERS pnt, long import_rva)
|
rvadelta (PIMAGE_NT_HEADERS pnt, DWORD import_rva)
|
||||||
{
|
{
|
||||||
PIMAGE_SECTION_HEADER section = (PIMAGE_SECTION_HEADER) (pnt + 1);
|
PIMAGE_SECTION_HEADER section = (PIMAGE_SECTION_HEADER) (pnt + 1);
|
||||||
for (int i = 0; i < pnt->FileHeader.NumberOfSections; i++)
|
for (int i = 0; i < pnt->FileHeader.NumberOfSections; i++)
|
||||||
|
@ -151,6 +151,13 @@ class path_conv
|
|||||||
int is_lnk_special () const {return is_fs_device () || isfifo () || is_lnk_symlink ();}
|
int is_lnk_special () const {return is_fs_device () || isfifo () || is_lnk_symlink ();}
|
||||||
int issocket () const {return dev.devn == FH_UNIX;}
|
int issocket () const {return dev.devn == FH_UNIX;}
|
||||||
int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;}
|
int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;}
|
||||||
|
void set_cygexec (bool isset)
|
||||||
|
{
|
||||||
|
if (isset)
|
||||||
|
path_flags |= PATH_CYGWIN_EXEC;
|
||||||
|
else
|
||||||
|
path_flags &= ~PATH_CYGWIN_EXEC;
|
||||||
|
}
|
||||||
bool isro () const {return !!(path_flags & PATH_RO);}
|
bool isro () const {return !!(path_flags & PATH_RO);}
|
||||||
bool exists () const {return fileattr != INVALID_FILE_ATTRIBUTES;}
|
bool exists () const {return fileattr != INVALID_FILE_ATTRIBUTES;}
|
||||||
bool has_attribute (DWORD x) const {return exists () && (fileattr & x);}
|
bool has_attribute (DWORD x) const {return exists () && (fileattr & x);}
|
||||||
|
@ -277,9 +277,8 @@ class av
|
|||||||
int error;
|
int error;
|
||||||
int argc;
|
int argc;
|
||||||
bool win16_exe;
|
bool win16_exe;
|
||||||
bool iscygwin;
|
|
||||||
av (): argv (NULL) {}
|
av (): argv (NULL) {}
|
||||||
av (int ac_in, const char * const *av_in) : calloced (0), error (false), argc (ac_in), win16_exe (false), iscygwin (false)
|
av (int ac_in, const char * const *av_in) : calloced (0), error (false), argc (ac_in), win16_exe (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 *));
|
||||||
@ -459,7 +458,6 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
one_line.add (argv[2]);
|
one_line.add (argv[2]);
|
||||||
strcpy (real_path, argv[0]);
|
strcpy (real_path, argv[0]);
|
||||||
null_app_name = true;
|
null_app_name = true;
|
||||||
newargv.iscygwin = false;
|
|
||||||
goto skip_arg_parsing;
|
goto skip_arg_parsing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +475,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
if (res)
|
if (res)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (real_path.iscygexec () || newargv.iscygwin)
|
if (real_path.iscygexec ())
|
||||||
newargv.dup_all ();
|
newargv.dup_all ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -624,7 +622,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
cygheap->user.deimpersonate ();
|
cygheap->user.deimpersonate ();
|
||||||
|
|
||||||
moreinfo->envp = build_env (envp, envblock, moreinfo->envc, real_path.iscygexec ());
|
moreinfo->envp = build_env (envp, envblock, moreinfo->envc, real_path.iscygexec ());
|
||||||
ciresrv.set (chtype, newargv.iscygwin);
|
ciresrv.set (chtype, real_path.iscygexec ());
|
||||||
ciresrv.moreinfo = moreinfo;
|
ciresrv.moreinfo = moreinfo;
|
||||||
|
|
||||||
si.lpReserved2 = (LPBYTE) &ciresrv;
|
si.lpReserved2 = (LPBYTE) &ciresrv;
|
||||||
@ -1019,8 +1017,9 @@ spawnvpe (int mode, const char *file, const char * const *argv,
|
|||||||
int
|
int
|
||||||
av::fixup (child_info_types chtype, const char *prog_arg, path_conv& real_path, const char *ext)
|
av::fixup (child_info_types chtype, const char *prog_arg, path_conv& real_path, const char *ext)
|
||||||
{
|
{
|
||||||
/* If the file name ends in either .exe, .com, .bat, or .cmd we assume
|
bool exeext = strcasematch (ext, ".exe");
|
||||||
that it is NOT a script file */
|
if (exeext && real_path.iscygexec ())
|
||||||
|
return 0;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
HANDLE h = CreateFile (real_path, GENERIC_READ,
|
HANDLE h = CreateFile (real_path, GENERIC_READ,
|
||||||
@ -1044,7 +1043,7 @@ av::fixup (child_info_types chtype, const char *prog_arg, path_conv& real_path,
|
|||||||
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)
|
||||||
iscygwin = hook_or_detect_cygwin (buf, NULL);
|
real_path.set_cygexec (!!hook_or_detect_cygwin (buf, NULL));
|
||||||
UnmapViewOfFile (buf);
|
UnmapViewOfFile (buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1092,10 +1091,7 @@ av::fixup (child_info_types chtype, const char *prog_arg, path_conv& real_path,
|
|||||||
if (!pgm)
|
if (!pgm)
|
||||||
{
|
{
|
||||||
if (strcasematch (ext, ".com"))
|
if (strcasematch (ext, ".com"))
|
||||||
{
|
break;
|
||||||
iscygwin = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pgm = (char *) "/bin/sh";
|
pgm = (char *) "/bin/sh";
|
||||||
arg1 = NULL;
|
arg1 = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user