// DIE's signature file
// Author: Rinat Aminow <rinat84.a@gmail.com>

init("archive","Coff library");

function detect(bShowType,bShowVersion,bShowOptions)
{
    if(Binary.compare("'!<arch>'0A2F"))
    {
        var nOffset=Binary.readDword(72);
        nOffset=Binary.swapBytes(nOffset)+58;

        // short format
        if(Binary.compare("600A4C01",nOffset))
        {
            sOptions="I386";
            bDetected=1;
        }
        if(Binary.compare("600A6486",nOffset))
        {
            sOptions="AMD64";
            bDetected=1;
        }

        // long format
        if(Binary.compare("600A0000FFFF....4C01",nOffset))
        {
            sOptions="I386";
            bDetected=1;
        }
        if(Binary.compare("600A0000FFFF....6486",nOffset))
        {
            sOptions="AMD64";
            bDetected=1;
        }
    }
    return result(bShowType,bShowVersion,bShowOptions);
}
