Skip to content

Commit 4f8ba82

Browse files
author
jvazquez-r7
committed
Make gather_pf_info return a prefetch entry
1 parent 904bd12 commit 4f8ba82

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/post/windows/gather/enum_prefetch.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ def print_timezone_key_values(key_value)
6262
end
6363
end
6464

65-
def gather_pf_info(name_offset, hash_offset, runcount_offset, filename, table)
65+
def gather_pf_info(name_offset, hash_offset, runcount_offset, filename)
6666
# We'll load the file and parse information from the offsets
6767
prefetch_file = read_file(filename)
6868
if prefetch_file.empty? or prefetch_file.nil?
6969
print_error("Couldn't read file: #{filename}")
70+
return nil
7071
else
7172
# First we'll get the filename
7273
pf_filename = prefetch_file[name_offset..name_offset+60]
@@ -85,7 +86,7 @@ def gather_pf_info(name_offset, hash_offset, runcount_offset, filename, table)
8586
last_modified = mtimes['Modified'].utc.to_s
8687
created = mtimes['Created'].utc.to_s
8788
end
88-
table << [last_modified, created, run_count, path_hash, name]
89+
return [last_modified, created, run_count, path_hash, name]
8990
end
9091
end
9192

@@ -166,7 +167,10 @@ def run
166167
next
167168
else
168169
filename = File.join(file['path'], file['name'])
169-
gather_pf_info(name_offset, hash_offset, runcount_offset, filename, table)
170+
pf_entry = gather_pf_info(name_offset, hash_offset, runcount_offset, filename)
171+
if not pf_entry.nil?
172+
table << pf_entry
173+
end
170174
end
171175
end
172176
end

0 commit comments

Comments
 (0)