Skip to content

Refactor and enhance Disassembler with tests and error handling#8

Merged
AlienDwarf merged 9 commits into
mainfrom
unit-tests
Mar 14, 2026
Merged

Refactor and enhance Disassembler with tests and error handling#8
AlienDwarf merged 9 commits into
mainfrom
unit-tests

Conversation

@AlienDwarf
Copy link
Copy Markdown
Owner

Testing and Reliability Improvements:

  • Added comprehensive unit tests for memory protection, trampoline allocation, disassembly/relocation, and thread enumeration in src/mem.rs, src/alloc.rs, src/disasm.rs, and src/threads.rs, respectively. These tests verify correct memory permissions, allocation behavior, instruction relocation, and thread enumeration, improving reliability and maintainability.

Instruction Relocation Enhancements:

  • Refactored the Disassembler::relocate method to return a new RelocationMapping struct, which includes written length and instruction offset mappings. This enables more precise tracking and debugging of relocated instructions.
  • Updated transaction logic in src/transaction.rs to store redirect maps in InlineData, allowing hooks to retain instruction offset information for better gateway and trampoline management.

API and Module Visibility Adjustments:

  • Changed several modules from public to internal (mod) in src/lib.rs, and updated public exports to expose only relevant API functions and types, clarifying the library's external interface. Also added a compile-time error for non-Windows platforms.

Minor Cleanups:

  • Removed the unused is_relative method from Disassembler, as its functionality is now covered by improved relocation logic.

@AlienDwarf AlienDwarf merged commit 030798b into main Mar 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant