tools/drdeploy.c
/* Check if the provided root directory actually has the files we
 * expect.  Returns whether a fatal problem.
 */
Check if the provided root directory actually has the files we
expect.  Returns whether a fatal problem.
Check if the provided root directory actually has the files we expect . Returns whether a fatal problem .
static bool check_dr_root(const char *dr_root, bool debug,
                          dr_platform_t dr_platform, bool preinject)
{
    int i;
    char buf[MAX_PATH];
    bool ok = true;
    const char *checked_files[] = {
        "lib32\\drpreinject.dll",
        "lib32\\release\\dynamorio.dll",
        "lib32\\debug\\dynamorio.dll",
        "lib64\\drpreinject.dll",
        "lib64\\release\\dynamorio.dll",
        "lib64\\debug\\dynamorio.dll"
    };
    const char *arch = IF_X64_ELSE("lib64", "lib32");
    if (dr_platform == DR_PLATFORM_32BIT)
        arch = "lib32";
    else if (dr_platform == DR_PLATFORM_64BIT)
        arch = "lib64";
    if (DR_dll_not_needed) {
        return true;
    }
    for (i=0; i<_countof(checked_files); i++) {
        sprintf_s(buf, _countof(buf), "%s/%s", dr_root, checked_files[i]);
        if (_access(buf, 0) == -1) {
            ok = false;
            if (!nocheck &&
                ((preinject && strstr(checked_files[i], "drpreinject")) ||
                 (!preinject && debug && strstr(checked_files[i], "debug") != NULL) ||
                 (!preinject && !debug && strstr(checked_files[i], "release") != NULL)) &&
                strstr(checked_files[i], arch) != NULL) {
                error("cannot find required file %s\n"
                      "Use -root to specify a proper DynamoRIO root directory.", buf);
                return false;
            } else {
                warn("cannot find %s: is this an incomplete installation?", buf);
            }
        }
    }
    if (!ok)
        warn("%s does not appear to be a valid DynamoRIO root", dr_root);
    return true;
}
static bool check_dr_root ( const char * dr_root , bool debug , dr_platform_t dr_platform , bool preinject ) { int i ; char buf [ MAX_PATH ] ; bool ok = true ; const char * checked_files [ ] = { " \\ " , " \\ \\ " , " \\ \\ " , " \\ " , " \\ \\ " , " \\ \\ " } ; const char * arch = IF_X64_ELSE ( " " , " " ) ; if ( dr_platform == DR_PLATFORM_32BIT ) arch = " " ; else if ( dr_platform == DR_PLATFORM_64BIT ) arch = " " ; if ( DR_dll_not_needed ) { return true ; } for ( i = 0 ; i < _countof ( checked_files ) ; i ++ ) { sprintf_s ( buf , _countof ( buf ) , " " , dr_root , checked_files [ i ] ) ; if ( _access ( buf , 0 ) == -1 ) { ok = false ; if ( ! nocheck && ( ( preinject && strstr ( checked_files [ i ] , " " ) ) || ( ! preinject && debug && strstr ( checked_files [ i ] , " " ) != NULL ) || ( ! preinject && ! debug && strstr ( checked_files [ i ] , " " ) != NULL ) ) && strstr ( checked_files [ i ] , arch ) != NULL ) { error ( " \n " " " , buf ) ; return false ; } else { warn ( " " , buf ) ; } } } if ( ! ok ) warn ( " " , dr_root ) ; return true ; }
Check if the provided root directory actually has the files we
 expect.
Check if the provided root directory actually has the files we expect .
/* assume user knows what he's doing */ /* We don't want to create a .1config file that won't be freed
                 * b/c the core is never injected
                 */