aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/w32proc.c')
-rw-r--r--src/w32proc.c63
1 files changed, 34 insertions, 29 deletions
diff --git a/src/w32proc.c b/src/w32proc.c
index 0aa248a6f7b..76af55f9985 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1622,38 +1622,43 @@ w32_executable_type (char * filename,
1622 /* Look for Cygwin DLL in the DLL import list. */ 1622 /* Look for Cygwin DLL in the DLL import list. */
1623 IMAGE_DATA_DIRECTORY import_dir = 1623 IMAGE_DATA_DIRECTORY import_dir =
1624 data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT]; 1624 data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT];
1625 IMAGE_IMPORT_DESCRIPTOR * imports =
1626 RVA_TO_PTR (import_dir.VirtualAddress,
1627 rva_to_section (import_dir.VirtualAddress,
1628 nt_header),
1629 executable);
1630 1625
1631 for ( ; imports->Name; imports++) 1626 /* Import directory can be missing in .NET DLLs. */
1632 { 1627 if (import_dir.VirtualAddress != 0)
1633 IMAGE_SECTION_HEADER * section = 1628 {
1634 rva_to_section (imports->Name, nt_header); 1629 IMAGE_IMPORT_DESCRIPTOR * imports =
1635 char * dllname = RVA_TO_PTR (imports->Name, section, 1630 RVA_TO_PTR (import_dir.VirtualAddress,
1636 executable); 1631 rva_to_section (import_dir.VirtualAddress,
1637 1632 nt_header),
1638 /* The exact name of the Cygwin DLL has changed with 1633 executable);
1639 various releases, but hopefully this will be 1634
1640 reasonably future-proof. */ 1635 for ( ; imports->Name; imports++)
1641 if (strncmp (dllname, "cygwin", 6) == 0)
1642 {
1643 *is_cygnus_app = TRUE;
1644 break;
1645 }
1646 else if (strncmp (dllname, "msys-", 5) == 0)
1647 { 1636 {
1648 /* This catches both MSYS 1.x and MSYS2 1637 IMAGE_SECTION_HEADER * section =
1649 executables (the DLL name is msys-1.0.dll and 1638 rva_to_section (imports->Name, nt_header);
1650 msys-2.0.dll, respectively). There doesn't 1639 char * dllname = RVA_TO_PTR (imports->Name, section,
1651 seem to be a reason to distinguish between 1640 executable);
1652 the two, for now. */ 1641
1653 *is_msys_app = TRUE; 1642 /* The exact name of the Cygwin DLL has changed with
1654 break; 1643 various releases, but hopefully this will be
1644 reasonably future-proof. */
1645 if (strncmp (dllname, "cygwin", 6) == 0)
1646 {
1647 *is_cygnus_app = TRUE;
1648 break;
1649 }
1650 else if (strncmp (dllname, "msys-", 5) == 0)
1651 {
1652 /* This catches both MSYS 1.x and MSYS2
1653 executables (the DLL name is msys-1.0.dll and
1654 msys-2.0.dll, respectively). There doesn't
1655 seem to be a reason to distinguish between
1656 the two, for now. */
1657 *is_msys_app = TRUE;
1658 break;
1659 }
1655 } 1660 }
1656 } 1661 }
1657 } 1662 }
1658 } 1663 }
1659 } 1664 }