core/win32/os.c
/* validate we are the rightful owner */
/* Note. we assume all calls to os_validate_owner_equals are on the same volume as
 * DYNAMORIO_VAR_CACHE_ROOT.
 * Handle needs to have READ_CONTROL access (FILE_GENERIC_READ provides that).
 */
validate we are the rightful owner
Note. we assume all calls to os_validate_owner_equals are on the same volume as
DYNAMORIO_VAR_CACHE_ROOT.
Handle needs to have READ_CONTROL access (FILE_GENERIC_READ provides that).
validate we are the rightful owner Note . we assume all calls to os_validate_owner_equals are on the same volume as DYNAMORIO_VAR_CACHE_ROOT . Handle needs to have READ_CONTROL access ( FILE_GENERIC_READ provides that ) .
bool
os_validate_user_owned(HANDLE file_or_directory_handle)
{
    PSID process_SID = get_process_primary_SID();
    if (os_validate_owner_equals(file_or_directory_handle, process_SID)) {
        return true;
    }
    if (!os_user_directory_supports_ownership()) {
        ASSERT(os_validate_owner_equals(file_or_directory_handle, get_Everyone_SID()));
        return true;
    }
    ASSERT_CURIOSITY(false && "unauthorized user tried to forge our files");
    return false;
}
bool os_validate_user_owned ( HANDLE file_or_directory_handle ) { PSID process_SID = get_process_primary_SID ( ) ; if ( os_validate_owner_equals ( file_or_directory_handle , process_SID ) ) { return true ; } if ( ! os_user_directory_supports_ownership ( ) ) { ASSERT ( os_validate_owner_equals ( file_or_directory_handle , get_Everyone_SID ( ) ) ) ; return true ; } ASSERT_CURIOSITY ( false && " " ) ; return false ; }
validate we are the rightful owner
Note.
validate we are the rightful owner Note .
/* note that Creator and Owner don't have to match, but we expect
     * that we'll be creating new files with current token as owner
     */ /* Note we only trust the primary token!  If we are impersonating,
     * we also need ACLs allowing us to open other files created by
     * the primary token */ /* Although on FAT32 there is no owner (or any other ACLs), we
         * get as owner Everyone.  Since file ACLs are unsupported by
         * file system on the system drive (where we install), we can
         * assume that privilege escalation is irrelevant for this
         * host.
         */ /* nobody really cares about this owner validation on FAT32 */