third_party/virtualbox/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp
/**
 * Returns the argument purge descriptor of the given argument if available.
 *
 * @retval 0 if it should not be purged.
 * @retval 1 if it only the current argument should be purged.
 * @retval 2 if the argument and the following (if present) should be purged.
 * @param   pszArg           The argument to look for.
 */
Returns the argument purge descriptor of the given argument if available.
@retval 0 if it should not be purged.
@retval 1 if it only the current argument should be purged.
@retval 2 if the argument and the following (if present) should be purged.
@param   pszArg           The argument to look for.
Returns the argument purge descriptor of the given argument if available . @retval 0 if it should not be purged . @retval 1 if it only the current argument should be purged . @retval 2 if the argument and the following ( if present ) should be purged . @param pszArg The argument to look for .
static unsigned supR3HardenedMainShouldPurgeArg(const char *pszArg)
{
    for (unsigned i = 0; i < RT_ELEMENTS(g_aSupArgPurgeDescs); i++)
    {
        size_t const cchPurge = g_aSupArgPurgeDescs[i].cchArg;
        if (!memcmp(pszArg, g_aSupArgPurgeDescs[i].pszArg, cchPurge))
        {
            if (pszArg[cchPurge] == '\0')
                return 1 + g_aSupArgPurgeDescs[i].fTakesValue;
            if (   g_aSupArgPurgeDescs[i].fTakesValue
                && (pszArg[cchPurge] == ':' || pszArg[cchPurge] == '='))
                return 1;
        }
    }
    return 0;
}
static unsigned supR3HardenedMainShouldPurgeArg ( const char * pszArg ) { for ( unsigned i = 0 ; i < RT_ELEMENTS ( g_aSupArgPurgeDescs ) ; i ++ ) { size_t const cchPurge = g_aSupArgPurgeDescs [ i ] . cchArg ; if ( ! memcmp ( pszArg , g_aSupArgPurgeDescs [ i ] . pszArg , cchPurge ) ) { if ( pszArg [ cchPurge ] == ' \0 ' ) return 1 + g_aSupArgPurgeDescs [ i ] . fTakesValue ; if ( g_aSupArgPurgeDescs [ i ] . fTakesValue && ( pszArg [ cchPurge ] == ' ' || pszArg [ cchPurge ] == ' ' ) ) return 1 ; } } return 0 ; }
Returns the argument purge descriptor of the given argument if available.
Returns the argument purge descriptor of the given argument if available .