// DIE's signature file

init("protector","StarForce");

function detect(bShowType,bShowVersion,bShowOptions)
{
    if(PE.compareEP("68........FF25....63"))
    {
        sVersion="3.0";
        bDetected=1;
    }
    else if(PE.compareEP("68........FF25....57"))
    {
        sVersion="1.1";
        sOptions="ProActive";
        bDetected=1;
    }
    else if(PE.compareEP("5768..0D01006800....00E850..FFFF68......0068......0068......0068......0068......00"))
    {
        sOptions="Protection Driver";
        bDetected=1;
    }
    else if(PE.compareEP("E8........000000000000"))
    {
        sVersion="3.X";
        bDetected=1;
    }
    else if(PE.compareEP("68........FF25........0000000000"))
    {
        sVersion="3.X";
        bDetected=1;
    }
    else if(PE.isLibraryPresent("protect.dll"))
    {
        sVersion=PE.getPEFileVersion(PE.getFileDirectory()+"/protect.dll");
        if(sVersion=="")
        {
            if(PE.section[".ps4"])
            {
                sVersion="4.X-5.X";
            }
            else if(PE.section[".sforce3"])
            {
                sVersion="3.X";
            }
        }
        bDetected=1;
    }
    else
    {
        if(PE.section[".ps4"])
        {
            var sLibraryName;
            var nNumberOfImports=PE.getNumberOfImports();

            for(var i=0;i<nNumberOfImports;i++)
            {
                if(PE.getNumberOfImportThunks(i)==1
                 &&PE.getImportFunctionName(i,0)=="")
                {
                    sLibraryName=PE.getImportLibraryName(i);
                    sVersion=PE.getPEFileVersion(PE.getFileDirectory()+"/"+sLibraryName);
                    if(sVersion=="")
                    {
                        sVersion="4.X-5.X";
                    }
                    else
                    {
                        sOptions=sLibraryName;
                    }
                    bDetected=1;
                    break;
                }
            }
        }
    }

    return result(bShowType,bShowVersion,bShowOptions);
}
