OSDN Git Service

*** empty log message ***
authorkoinec <>
Tue, 20 Mar 2012 11:32:09 +0000 (11:32 +0000)
committerkoinec <>
Tue, 20 Mar 2012 11:32:09 +0000 (11:32 +0000)
libgoblin/drd64_libgoblin.h
libgoblin/drd64_libgoblin_api_readbin.c
libgoblin/drd64_libgoblin_binfo.h
libgoblin/drd64_libgoblin_elf.c

index 79c385c..1216717 100644 (file)
@@ -43,15 +43,27 @@ Comment:
 #include<fcntl.h>
 #include<unistd.h>
 #include<assert.h>
+
+#ifdef __FreeBSD__
 #include<elf.h>
 #include<dwarf.h>
 #include<sys/stat.h>
 #include<sys/mman.h>
+#endif /* __FREEBSD__ */
+
+#ifdef __linux__
+#include<elf.h>
+#include<dwarf.h>
+#include<sys/stat.h>
+#include<sys/mman.h>
+#endif /* __FREEBSD__ */
+
 #include"../include/drd64_types.h"
 #include"../include/drd64_defines.h"
 #include"../include/drd64_error.h"
 #include"../include/drd64_conf.h"
 #include"../include/libgoblin.h"
+#include"drd64_libgoblin_sectbl.h"
 #include"drd64_libgoblin_binfo.h"
 #include"drd64_libgoblin_checkbin.h"
 #include"drd64_libgoblin_analyze.h"
index 73c0796..e0ff68b 100644 (file)
@@ -46,7 +46,6 @@ int
                char    *pstr_filepath )
 {
        int             i_bid;
-       int             i_bintype;
        int             i_err;
        int             i_fd;
        struct  stat    t_sb;
@@ -108,7 +107,6 @@ int
                DWord   dw_size )
 {
        int             i_bid;
-       int             i_bintype;
        int             i_result;
        LibGoblin_BinaryInfo    *p_bin;
 
index 92a5c7a..3fb1377 100644 (file)
@@ -67,21 +67,31 @@ Comment:
 
 
 typedef struct {
+       /* BinaryInfo Struct ID */
        int                     i_id;
 
+       /* Binary-File Info. */
        int                     i_fd;
        char            str_filepath[DRD64_MAX_PATH];
 
+       /* Binary-File Memory Image Access Info. */
        DWord           dw_size;
        Byte            *p_binary;
 
+       /* BinaryInfo Common Info. */
        Byte            b_type;
        Byte            b_endian;
        Byte            b_bits;
 
+       /* Binary-Format Depending Info. (ELF)*/
        void            *p_format;
+       /* Debug-Format Depending Info. (DWarf) */
        void            *p_debug;
        
+       /* Section Table */
+       int                     i_num_sectbl;
+       LibGoblin_SectionTable  *p_sectbl;
+
 }      LibGoblin_BinaryInfo;
 
 
index 0c031d7..399812a 100644 (file)
@@ -45,12 +45,18 @@ int
        LibGoblin_IsElf(
                Byte    *p_data )
 {
-       Elf_Ehdr        *p_elfhdr;
+       //Elf_Ehdr      *p_elfhdr;
 
        assert( NULL != p_data );
-       p_elfhdr        = (Elf_Ehdr *)p_data;
+       //p_elfhdr      = (Elf_Ehdr *)p_data;
+       if( ( ELFMAG0 == *(p_data + EI_MAG0) )
+                       && ( ELFMAG1 == *(p_data + EI_MAG1) )
+                       && ( ELFMAG2 == *(p_data + EI_MAG2) )
+                       && ( ELFMAG3 == *(p_data + EI_MAG3) ) )
+               { return 0x01; }
+       return 0x00;
 
-       return IS_ELF( *p_elfhdr );
+       //return IS_ELF( *p_elfhdr );
 }
 
 
@@ -100,7 +106,7 @@ int
        LibGoblin_AnalyzeElf(
                LibGoblin_BinaryInfo    *p_bin )
 {
-       int             i_err;
+       //int           i_err;
        Byte    *pb_data;
 
        assert( NULL != p_bin );