From d8f904c44ae8550f6e73edc685d3fab49215476f Mon Sep 17 00:00:00 2001 From: w1tcher <10086+bowen.sun@users.noreply.github.com> Date: Tue, 7 Jul 2026 17:37:59 +0800 Subject: [PATCH] Fix FLS FiberManager writing last_error to a dead attribute FiberManager.free/set/get set `self.last_error` on the FiberManager instance, but nothing ever reads that attribute. The Windows last-error that GetLastError returns lives on `ql.os.last_error`, so FlsFree, FlsSetValue and FlsGetValue never actually reported ERROR_INVALID_PARAMETER for an invalid FLS index. Route the three writes to `self.ql.os.last_error`, consistent with every other kernel32 hook. Co-Authored-By: Claude Opus 4.8 (1M context) --- qiling/os/windows/fiber.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qiling/os/windows/fiber.py b/qiling/os/windows/fiber.py index 098620763..f75fad161 100644 --- a/qiling/os/windows/fiber.py +++ b/qiling/os/windows/fiber.py @@ -33,7 +33,7 @@ def alloc(self, cb: Optional[int] = None) -> int: def free(self, idx: int) -> bool: if idx not in self.fibers: - self.last_error = ERROR_INVALID_PARAMETER + self.ql.os.last_error = ERROR_INVALID_PARAMETER return False fiber = self.fibers[idx] @@ -99,7 +99,7 @@ def __invoke_callback(self, fiber: Fiber): def set(self, idx: int, data: int) -> bool: if idx not in self.fibers: - self.last_error = ERROR_INVALID_PARAMETER + self.ql.os.last_error = ERROR_INVALID_PARAMETER return False self.fibers[idx].data = data @@ -108,7 +108,7 @@ def set(self, idx: int, data: int) -> bool: def get(self, idx: int) -> int: if idx not in self.fibers: - self.last_error = ERROR_INVALID_PARAMETER + self.ql.os.last_error = ERROR_INVALID_PARAMETER return 0 return self.fibers[idx].data