const nt = @import("nt.zig");
export fn _start(inData: [*c]u64) callconv(.Win64) void {
const PsInitialSystemProcess: u64 = inData[8];
while(true) {
var currentEntry = PsInitialSystemProcess;
while(true) {
const list: nt.PLIST_ENTRY = @ptrFromInt(currentEntry + 0x2F0);
currentEntry = @intFromPtr(list.*.Flink) - 0x2F0;
if (currentEntry == PsInitialSystemProcess) break;
}
}
}
Compiling this code with
zig build-exe main.zig -O ReleaseSmall -fstrip -fomit-frame-pointer -fsingle-threaded -fno-stack-check -fno-unwind-tables -fPIC -target x86_64-freestanding crashes the zig compiler. its only output is the
Segmentation fault (core dumped)