예제 #1
0
def get_file_basic_info(file_name, file_handle):
    file_attributes = GetFileAttributesW(file_name)
    file_size = GetFileSize(file_handle)
    logging.debug("Compressed: %r",
                  bool(file_attributes & FILE_ATTRIBUTE_COMPRESSED))
    logging.debug("Encrypted: %r",
                  bool(file_attributes & FILE_ATTRIBUTE_ENCRYPTED))
    logging.debug("Sparse: %r",
                  bool(file_attributes & FILE_ATTRIBUTE_SPARSE_FILE))
    return file_size, bool(file_attributes & (FILE_ATTRIBUTE_COMPRESSED
                                              | FILE_ATTRIBUTE_ENCRYPTED
                                              | FILE_ATTRIBUTE_SPARSE_FILE))
예제 #2
0
def get_file_basic_info(file_name, file_handle):
    file_attributes = GetFileAttributesW(file_name)
    file_size = GetFileSize(file_handle)
    is_compressed = bool(file_attributes & FILE_ATTRIBUTE_COMPRESSED)
    is_encrypted = bool(file_attributes & FILE_ATTRIBUTE_ENCRYPTED)
    is_sparse = bool(file_attributes & FILE_ATTRIBUTE_SPARSE_FILE)
    is_special = is_compressed | is_encrypted | is_sparse
    if is_special:
        logger.debug('{}: {} {} {}'.format(
            file_name, 'compressed' if is_compressed else '',
            'encrypted' if is_encrypted else '',
            'sparse' if is_sparse else ''))
    return file_size, is_special