コード例 #1
0
ファイル: nt_headers.hpp プロジェクト: geota/hadesmem
 bool IsValid() const
 {
   if (pe_file_->Is64())
   {
     return IMAGE_NT_SIGNATURE == GetSignature() &&
            IMAGE_NT_OPTIONAL_HDR64_MAGIC == GetMagic() &&
            IMAGE_FILE_MACHINE_AMD64 == GetMachine();
   }
   else
   {
     return IMAGE_NT_SIGNATURE == GetSignature() &&
            IMAGE_NT_OPTIONAL_HDR32_MAGIC == GetMagic() &&
            IMAGE_FILE_MACHINE_I386 == GetMachine();
   }
 }
コード例 #2
0
ファイル: common.cpp プロジェクト: buddha17/datax
int FileType( const char* pFileName )
{
       const int mNum = 2;
       size_t magic[mNum][4] = 
       {
       	    {0,    2,     8093,     2}, 
       	    {0,    4,     529205256,3}  
       };

       char szHDFS[16] = {0};
       if( sscanf(pFileName, "%4s", szHDFS) > 0 && 0 == strncmp("hdfs", szHDFS, 4))
           return 4;	// hdfs file
       
       FILE* pFile = fopen(pFileName,"r+b");
       if ( pFile == NULL )
       {
             return -1;
       }
       char buff[10];
       int n = -1;

       while ( ++n < mNum )
       {
             fseek( pFile, magic[n][0], SEEK_SET );
             if( fread(buff,sizeof(char),magic[n][1],pFile) )
             {
                   buff[magic[n][1]] = '\0';
                   if ( GetMagic(buff) == magic[n][2] )
                   {
                         break;
                   }
             }
       }
       fclose(pFile);
       
       if ( n < mNum)
       {
             return magic[n][3];
       }
       else  return 1; 
}
コード例 #3
0
ファイル: NSBContext.cpp プロジェクト: FGRE/libnpengine-new
uint32_t NSBContext::Advance()
{
    GetFrame()->SourceLine++;
    return GetMagic();
}
コード例 #4
0
 bool IsValid() const
 {
   return IMAGE_DOS_SIGNATURE == GetMagic();
 }