// DIE's signature file

init("packer","PECompact");

function detect(bShowType,bShowVersion,bShowOptions)
{
    if(PE.compareEP("EB0668........C39C60BD........B902......B0908DBD........F3AA01AD........FFB5"))
    {
        sVersion="0.90-0.92";
        bDetected=1;
    }
    else if(PE.compareEP("EB0668........C39C60E8........5D555881ED........2B85........0185........50B902"))
    {
        sVersion="0.94";
        bDetected=1;
    }
    else if(PE.compareEP("EB$$9C60E8$$$$$$$$8BC483....938BE38B....81EB........87DD8B85........0185........66C785"))
    {
        sVersion="1.68-1.84";
        bDetected=1;
    }
    else if(PE.compareEP("33C08BC483C004938BE38B5BFC81"))
    {
        sVersion="1.84";
        bDetected=1;
    }
    else if(PE.compareEP("B8........05........5064FF350000000064892500000000CC90909090"))
    {
        sVersion="2.0 beta";
        bDetected=1;
    }
    else if(PE.compareEP("B8........80002840"))
    {
        sVersion="2.x beta version";
        bDetected=1;
    }
    else if(PE.compareEP("B8........5064FF35000000006489250000000033C08908'PECompact2'00"))
    {
        sVersion="3.02.2 or 3.03.21 beta";
        bDetected=1;
    }
    else if(PE.compareEP("B8........5064FF..........6489..........33C08908'PECo'"))
    {
        sVersion="2.20";
        bDetected=1;
    }
    else if(PE.compareEP("B8........5064FF35000000006489250000000033C08908'PEC'"))
    {
        sVersion="2.X";
        if(PE.compareEP("32",27))
        {
            sOptions="Slim Loader";
        }
        bDetected=1;
    }
    else if(PE.compareEP("B8........5553515756528D98........8B5318528BE86A406800100000FF7304"))
    {
        sVersion="2.53-2.76";
        bDetected=1;
    }
    else if(PE.compareEP("B8........5064ff35........648925........33c0890800000000"))
    {
        sVersion="2.78a-3.11";
        bDetected=1;
    }
    if(bDetected)
    {
         var nOffset=PE.findString(0,0x600,"PEC2");
         if(nOffset!=-1)
         {
            var nBuildNumber=PE.readDword(nOffset+4);
            switch(nBuildNumber)
            {
                case 20206:     sVersion="2.70";        break;
                case 20240:     sVersion="2.78a";       break;
                case 20243:     sVersion="2.79b1";      break;
                case 20245:     sVersion="2.79bB";      break;
                case 20247:     sVersion="2.79bD";      break;
                case 20252:     sVersion="2.80b1";      break;
                case 20256:     sVersion="2.80b5";      break;
                case 20261:     sVersion="2.82";        break;
                case 20285:     sVersion="2.92.0";      break;
                case 20288:     sVersion="2.93b3";      break;
                case 20294:     sVersion="2.96.2";      break;
                case 20295:     sVersion="2.97b1";      break;
                case 20296:     sVersion="2.98";        break;
                case 20300:     sVersion="2.98.04";     break;
                case 20301:     sVersion="2.98.05";     break;
                case 20302:     sVersion="2.98.06";     break;
                case 20303:     sVersion="2.99b";       break;
                case 20308:     sVersion="3.00.2";      break;
                case 20312:     sVersion="3.01.3";      break;
                case 20317:     sVersion="3.02.1";      break;
                case 20318:     sVersion="3.02.2";      break;
                case 20323:     sVersion="3.03.5b";     break;
                case 20327:     sVersion="3.03.9b";     break;
                case 20329:     sVersion="3.03.10b";    break;
                case 20334:     sVersion="3.03.12b";    break;
                case 20342:     sVersion="3.03.18b";    break;
                case 20343:     sVersion="3.03.19b";    break;
                case 20344:     sVersion="3.03.20b";    break;
                case 20345:     sVersion="3.03.21b";    break;
                case 20348:     sVersion="3.03.23b";    break;
                default:
                {
                    if(nBuildNumber)
                    {
                        sVersion=nBuildNumber
                    }
                }
            }
         }
    }
    else if(PE.isNET())
    {
        if(PE.isSignaturePresent(0,512,"00'PEC2XO'000000000000..0000..'.rsrc'00"))
        {
            sVersion="2.X-3.X";
            bDetected=1;
        }
        else if(PE.isSignatureInSectionPresent(0,"'mscoree.dll'000000'CorBindToRuntimeEx'"))
        {
            sVersion="2.X-3.X";
            bDetected=1;
        }
    }

    return result(bShowType,bShowVersion,bShowOptions);
}
