Type Function FileInformationIterator [src]
Helper for iterating a byte buffer of FILE_*_INFORMATION structures (from
things like NtQueryDirectoryFile calls).
Prototype
pub fn FileInformationIterator(comptime FileInformationType: type) type
Parameters
FileInformationType: type
Source
pub fn FileInformationIterator(comptime FileInformationType: type) type {
return struct {
byte_offset: usize = 0,
buf: []u8 align(@alignOf(FileInformationType)),
pub fn next(self: *@This()) ?*FileInformationType {
if (self.byte_offset >= self.buf.len) return null;
const cur: *FileInformationType = @ptrCast(@alignCast(&self.buf[self.byte_offset]));
if (cur.NextEntryOffset == 0) {
self.byte_offset = self.buf.len;
} else {
self.byte_offset += cur.NextEntryOffset;
}
return cur;
}
};
}