Mercurial > emacs
comparison src/w32proc.c @ 90988:492971a3f31f unicode-xft-base
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 816-823)
- Update from CVS
- Merge from emacs--rel--22
* emacs--rel--22 (patch 59-69)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 237-238)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-235
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 24 Jul 2007 01:23:55 +0000 |
parents | 148920faca07 5d5dea23e4fd |
children | f55f9811f5d7 |
comparison
equal
deleted
inserted
replaced
90987:b2d8a283f27e | 90988:492971a3f31f |
---|---|
589 reap_subprocess (cp); | 589 reap_subprocess (cp); |
590 | 590 |
591 return pid; | 591 return pid; |
592 } | 592 } |
593 | 593 |
594 /* Old versions of w32api headers don't have separate 32-bit and | |
595 64-bit defines, but the one they have matches the 32-bit variety. */ | |
596 #ifndef IMAGE_NT_OPTIONAL_HDR32_MAGIC | |
597 # define IMAGE_NT_OPTIONAL_HDR32_MAGIC IMAGE_NT_OPTIONAL_HDR_MAGIC | |
598 # define IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER | |
599 #endif | |
600 | |
594 void | 601 void |
595 w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int * is_gui_app) | 602 w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int * is_gui_app) |
596 { | 603 { |
597 file_data executable; | 604 file_data executable; |
598 char * p; | 605 char * p; |
649 { | 656 { |
650 *is_dos_app = TRUE; | 657 *is_dos_app = TRUE; |
651 } | 658 } |
652 else if (nt_header->Signature == IMAGE_NT_SIGNATURE) | 659 else if (nt_header->Signature == IMAGE_NT_SIGNATURE) |
653 { | 660 { |
654 /* Look for cygwin.dll in DLL import list. */ | 661 IMAGE_DATA_DIRECTORY *data_dir = NULL; |
655 IMAGE_DATA_DIRECTORY import_dir = | 662 if (nt_header->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) |
656 nt_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; | 663 { |
657 IMAGE_IMPORT_DESCRIPTOR * imports; | 664 /* Ensure we are using the 32 bit structure. */ |
658 IMAGE_SECTION_HEADER * section; | 665 IMAGE_OPTIONAL_HEADER32 *opt |
659 | 666 = (IMAGE_OPTIONAL_HEADER32*) &(nt_header->OptionalHeader); |
660 section = rva_to_section (import_dir.VirtualAddress, nt_header); | 667 data_dir = opt->DataDirectory; |
661 imports = RVA_TO_PTR (import_dir.VirtualAddress, section, executable); | 668 *is_gui_app = (opt->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI); |
662 | 669 } |
663 for ( ; imports->Name; imports++) | 670 /* MingW 3.12 has the required 64 bit structs, but in case older |
664 { | 671 versions don't, only check 64 bit exes if we know how. */ |
665 char * dllname = RVA_TO_PTR (imports->Name, section, executable); | 672 #ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC |
666 | 673 else if (nt_header->OptionalHeader.Magic |
667 /* The exact name of the cygwin dll has changed with | 674 == IMAGE_NT_OPTIONAL_HDR64_MAGIC) |
668 various releases, but hopefully this will be reasonably | 675 { |
669 future proof. */ | 676 IMAGE_OPTIONAL_HEADER64 *opt |
670 if (strncmp (dllname, "cygwin", 6) == 0) | 677 = (IMAGE_OPTIONAL_HEADER64*) &(nt_header->OptionalHeader); |
671 { | 678 data_dir = opt->DataDirectory; |
672 *is_cygnus_app = TRUE; | 679 *is_gui_app = (opt->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI); |
673 break; | 680 } |
674 } | 681 #endif |
675 } | 682 if (data_dir) |
676 | 683 { |
677 /* Check whether app is marked as a console or windowed (aka | 684 /* Look for cygwin.dll in DLL import list. */ |
678 GUI) app. Accept Posix and OS2 subsytem apps as console | 685 IMAGE_DATA_DIRECTORY import_dir = |
679 apps. */ | 686 data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT]; |
680 *is_gui_app = (nt_header->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI); | 687 IMAGE_IMPORT_DESCRIPTOR * imports; |
688 IMAGE_SECTION_HEADER * section; | |
689 | |
690 section = rva_to_section (import_dir.VirtualAddress, nt_header); | |
691 imports = RVA_TO_PTR (import_dir.VirtualAddress, section, | |
692 executable); | |
693 | |
694 for ( ; imports->Name; imports++) | |
695 { | |
696 char * dllname = RVA_TO_PTR (imports->Name, section, | |
697 executable); | |
698 | |
699 /* The exact name of the cygwin dll has changed with | |
700 various releases, but hopefully this will be reasonably | |
701 future proof. */ | |
702 if (strncmp (dllname, "cygwin", 6) == 0) | |
703 { | |
704 *is_cygnus_app = TRUE; | |
705 break; | |
706 } | |
707 } | |
708 } | |
681 } | 709 } |
682 } | 710 } |
683 | 711 |
684 unwind: | 712 unwind: |
685 close_file_data (&executable); | 713 close_file_data (&executable); |