Commit Graph

107 Commits

Author SHA1 Message Date
ahm3dgg
3db0eacc92 Better names and Fixing a Potential Race condition while reading File 2026-01-13 19:41:12 +02:00
ahm3dgg
0438b7a62b Update module_load_count when unmapping 2026-01-13 01:44:36 +02:00
ahmed
0eae0cac56 Merge branch 'main' into knowndlls-patch 2026-01-11 01:47:34 +02:00
ahm3dgg
73d82d9ee9 NtOpenSection: Do Case-Insensitive String Comparison And Some Refactoring 2026-01-11 01:41:17 +02:00
ahm3dgg
d54c8bf9ca NtOpenSection: Do Case-Insensitive String Comparison 2026-01-11 01:37:55 +02:00
ahm3dgg
fc0853aab6 NtOpenSection: Do Case-Insensitive String Comparison 2026-01-11 00:15:22 +02:00
ahm3dgg
8481cdfb5d Use std::map instead of std::unordered_map for data that will be serialized 2026-01-09 03:09:42 +02:00
ahm3dgg
fdcc7455a1 Separated KnownDLLs and KnownDLLs32 2026-01-07 19:37:36 +02:00
ahm3dgg
4f8745ce1b Support for KnownDLLs and Some Refactoring 2026-01-07 08:06:19 +02:00
Igor Pissolati
9fdc2a4ce6 Add support for user callbacks 2026-01-06 10:14:02 -03: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
5302900a9d Fix for older Windows builds 2026-01-04 16:01:13 -03:00
Igor Pissolati
de491ade0e Add support for user_object/user_handle_table 2026-01-02 19:46:04 -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
momo5502
effd2f7a02 Merge remote-tracking branch 'origin/main' into wow64 2025-10-21 20:45:29 +02:00
Igor Pissolati
248c09d554 Implement ALPC port abstraction and implement DNS resolver port 2025-10-19 23:23:29 -03:00
brian
65eecf1cfd Comprehensive WOW64 subsystem implementation 2025-10-13 19:55:50 +08:00
momo5502
584b770def Store previous IP per thread 2025-08-17 07:32:26 +02:00
momo5502
7d6648ade0 Extend clang-format column limit to 140 2025-08-16 14:55:07 +02: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
bc77faec3d Move more logging into callbacks 2025-06-06 20:03:53 +02:00
momo5502
da658e5178 Prepare timer support 2025-06-01 13:56:45 +02:00
momo5502
86dbd11008 Fix serialization of atoms 2025-05-18 12:48:17 +02:00
momo5502
67031b40ea More UI syscalls 2025-05-18 10:35:22 +02:00
momo5502
6241c10f02 Support window props 2025-05-18 09:51:46 +02:00
momo5502
d08bcbae9c Add window object 2025-05-18 09:13:26 +02:00
Maurice Heumann
6cb571f496 Prepare web debugger (#247) 2025-04-29 09:51:15 +02:00
momo5502
1beb95c2b2 Support thread-switch callback 2025-04-29 09:25:45 +02: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
Igor Pissolati
657bf6121a Apply suggested changes 2025-04-22 03:44:45 -03:00
Igor Pissolati
5f2c15e642 Fix x86 build 2025-04-22 02:51:19 -03:00
Igor Pissolati
7e93f5d7f6 Improvements to locale syscalls and fix TimeZone query 2025-04-22 01:48:52 -03:00
Igor Pissolati
6deefb932f Add NtUserGetAtomName syscall 2025-04-22 01:19:05 -03:00
Igor Pissolati
3dfad0f789 Add more atom-related syscalls 2025-04-19 13:52:13 -03:00
momo5502
a8926592bc Prepare APC dispatching 2025-04-13 13:39:09 +02:00
RektInator
8bc49bdd03 refactor(windows-emulator/syscalls): partial refactor of syscalls.cpp, splits syscall implementations over multiple files 2025-04-11 16:42:00 +02:00
momo5502
3c58c1af98 Log debug strings 2025-04-07 21:03:57 +02:00
momo5502
af6492be6d Unify setting segment base 2025-03-29 10:44:41 +01:00
momo5502
53fb2f9116 Support more syscalls 2025-03-22 19:53:53 +01:00
momo5502
bf01b125ac Fix clang-tidy warnings 2025-03-18 20:40:14 +01:00
Maurice Heumann
95c7ffbf91 Move executed instructions into windows emulator 2025-03-18 12:35:38 +01:00