Commit Graph

69 Commits

Author SHA1 Message Date
ahm3dgg
49ae9ef68a Add dummy stub for NtFlushInstructionCache 2026-01-07 20:21:19 +02:00
ahm3dgg
fdcc7455a1 Separated KnownDLLs and KnownDLLs32 2026-01-07 19:37:36 +02:00
ahm3dgg
72ea3e0f0d format fix 2026-01-07 09:35:13 +02:00
ahm3dgg
200b39359e Fix 2026-01-07 09:33:06 +02:00
ahm3dgg
c92e7bff5f fix cast 2026-01-07 09:15:57 +02:00
ahm3dgg
6958954f82 Fix another warning 2026-01-07 09:04:37 +02:00
ahm3dgg
741dadfced Remove redundant code 2026-01-07 08:54:05 +02:00
ahm3dgg
4dadc42284 weird c++ moments 2026-01-07 08:36:01 +02:00
ahm3dgg
6c508eb15e formatting fix 2026-01-07 08:30:13 +02:00
ahm3dgg
d4b59cc3cd Fix 2026-01-07 08:27:25 +02:00
ahm3dgg
c3a760dace Fixed Formatting 2026-01-07 08:23:00 +02:00
ahm3dgg
1806eeb2e0 Fix types 2026-01-07 08:18:08 +02:00
ahm3dgg
4f8745ce1b Support for KnownDLLs and Some Refactoring 2026-01-07 08:06:19 +02:00
ahm3dgg
f54bc3467f Support for KnownDLLs and Some Refactoring 2026-01-07 07:34:34 +02:00
Maurice Heumann
d3af3c781c Add support for user_object/user_handle_table (#677)
Fixes #641

This PR is my attempt to add support for user32 objects and the user32
handle table. I also added a test, but as expected, it fails on Windows
2022. I’ll try to fix that another day, but feel free to review the code
😄
2026-01-06 10:21:58 +01:00
ahm3dgg
67e130a3b8 Check if the known dll path exists first 2026-01-06 09:57:33 +02:00
ahm3dgg
725c7e3e9c Pass file_system to process_context::setup 2026-01-06 09:16:45 +02:00
ahm3dgg
b642486bc4 Add Support for KnownDLLs 2026-01-06 08:34:41 +02:00
Igor Pissolati
90b38b3bff Fix user_handle_table initialization 2026-01-05 09:01:05 -03:00
Igor Pissolati
5d59700ec7 Remove parse_number 2026-01-05 09:00:45 -03:00
Igor Pissolati
7112d619b4 Fix clang tidy 2026-01-04 16:28:30 -03:00
Igor Pissolati
5302900a9d Fix for older Windows builds 2026-01-04 16:01:13 -03:00
ahm3dgg
e17204552f fix warning 2026-01-04 20:59:02 +02:00
ahm3dgg
a3d019c759 Set PEB64/32 HeapSegmentReserve & HeapSegmentCommit from Executable. 2026-01-04 20:24:22 +02:00
Igor Pissolati
de491ade0e Add support for user_object/user_handle_table 2026-01-02 19:46:04 -03:00
ssvine
7724b0d416 Refactor emulator_object 2026-01-02 19:03:54 +03:00
Maurice Heumann
1f936c024d Fix thread support (#640)
This PR fixes several things related to threads emulation:

1. Support `SameTebFlags.InitialThread`
This flag is needed to support emulation of .net executables (not yet
fully supported) that don't have an entry point set in `PE` header. This
applies to both `PE32` and `PE64` executables. If `InitialThread` is set
the loader substitutes an entry point of the .net executable with
`mscoree.dll!_CorExeMain`.

2. Fix static thread local storage for `WOW64`
This fix resolves `shell32.dll` initialization on `WOW64`. This fix also
uses correct structure and field names that are obtained from the
corresponding `.pdb` files.

3. Fix dynamic thread local storage for `WOW64`

4. Fix setting argument of a `WOW64` thread start proc

5. Fix creating suspended thread and parse create_flags
Currently creating suspended thread doesn't work because
`NtCreateThreadEx` handler uses invalid flag `CREATE_SUSPENDED`. This PR
fixes that, and moreover it carefully parses create_flags of the
`NtCreateThreadEx` call.

6. Fix `FS` and `GS` handling
This PR fixes several problems with `GS` and `FS` segments:

    * Wrong GDT descriptor for selector 0x53
* Update GDT descriptor for selector 0x53 for a `WOW64` process every
context switch like Windows does
* Set `GS` base when `GS` segment register is updated in 64-bit code
(code selector is `0x33`). When `GS` segment register is loaded with
correct selector (`0x2b`) `GS` base is set to 0. So, when the code
accesses something like `gs:[0]`, a page fault occurs. `KiPageFault`
handles this situation and sets correct `GS` base.

Also, take into account that `teb64.ExceptionList` initially contains
`teb32` address for `WOW64` process. This is used to setup `FS` base
when `wrfsbase` instruction is available. We can enable this instruction
using `kusd.ProcessorFeatures.arr[PF_RDWRFSGSBASE_AVAILABLE] = 1;` and
this work perfectly with `unicorn` backend. Unfortunately `icicle`
backend does not support `wrfsbase`, so I don't enable this instruction
by default.
2025-12-30 17:56:30 +01:00
ssvine
57ad277158 Fix creating suspended thread and parse create_flags 2025-12-30 15:18:55 +03:00
ssvine
fea27338bb Support SameTebFlags.InitialThread
This flag is needed to suport emulation of .net executables
that don't have an entry point set in PE header. This applies
to both PE32 and PE64 executables. If InitialThread is set
the loader substitutes an entry point of the .net executable
with mscoree.dll!_CorExeMain.
2025-12-30 13:44:21 +03:00
66hh
ecc00216d6 Support ProcessInstrumentationCallback 2025-12-27 17:17:23 +08:00
ssvine
3686625fb1 Fix PEB32 2025-12-25 13:42:20 +03:00
brian
5171ef63dc Fix deserialization of optional WOW64 emulator_object members (PEB32/params32) 2025-12-05 20:21:25 +08:00
brian
65eecf1cfd Comprehensive WOW64 subsystem implementation 2025-10-13 19:55:50 +08:00
momo5502
5a3d05c64c Fix compilation 2025-08-18 19:16:43 +02:00
momo5502
8e984b8b29 Keep GDTR readable for now 2025-08-18 19:07:12 +02:00
momo5502
2cef0a5511 Make sure GDTR is page aligned 2025-08-18 19:01:09 +02:00
momo5502
584b770def Store previous IP per thread 2025-08-17 07:32:26 +02:00
momo5502
b2eef2bf46 Align processor counts 2025-08-17 07:31:37 +02:00
momo5502
7d6648ade0 Extend clang-format column limit to 140 2025-08-16 14:55:07 +02:00
3fault
e5e5d05d05 Add temp environment variables to fix GetTempPath(2)W 2025-06-10 09:59:34 -04:00
momo5502
da4a4f90c9 Cleanup exception callbacks 2025-06-07 07:54:11 +02:00
momo5502
802e295bcc Adapt more printing 2025-06-07 07:29:30 +02:00
momo5502
da658e5178 Prepare timer support 2025-06-01 13:56:45 +02:00
momo5502
67031b40ea More UI syscalls 2025-05-18 10:35:22 +02:00
momo5502
0fbd563e8c Support window creation 2025-05-18 09:51:28 +02:00
momo5502
bd4e27469f Add more ui syscall stubs 2025-05-17 18:28:53 +02:00
Igor Pissolati
bab8c55ed3 Disable Trap Test on icicle 2025-04-28 19:27:56 -03:00
Igor Pissolati
b67a512ea6 Properly expand REG_EXPAND_SZ keys 2025-04-28 15:24:49 -03:00
Igor Pissolati
9d5338b168 Load environment variables from registry 2025-04-28 12:46:36 -03:00
robert-yates
b2296930d3 prepare 32bit support with name and class inheritance modifications 2025-04-22 12:01:40 +02:00