Commit Graph

1195 Commits

Author SHA1 Message Date
Elias Bachaalany
651c020b87 Use stack-allocated ctx_t array instead of heap allocation
- Initialize ctxs[i] directly with aggregate initialization
- Pass address of stack object to CreateThread
- Use dot notation instead of arrow for member access
- Remove delete calls since no heap allocation

Co-authored-by: Maurice Heumann <momo5502@gmail.com>
2025-12-02 15:53:37 -08:00
Elias Bachaalany
4a905d562a Update src/samples/test-sample/test.cpp
Co-authored-by: Maurice Heumann <MauriceHeumann@gmail.com>
2025-12-02 15:44:21 -08:00
Elias Bachaalany
7cb92a662b test: add Windows API threads test
Add test_threads_winapi() that creates threads using CreateThread
and WaitForMultipleObjects to complement the existing std::thread
based test, verifying Windows threading API emulation works correctly.
2025-11-26 17:30:43 -08:00
momo5502
8c75475f0d Stub more syscalls 2025-11-20 18:43:20 +01:00
momo5502
2be5f73755 Support ProcessPriorityClass in NtQueryInformationProcess 2025-11-20 18:25:33 +01:00
Maurice Heumann
934e11a311 Archive gdiplus.dll 2025-11-20 18:13:38 +01:00
Maurice Kayser
db67ac5a03 Collect SysWOW64 files in create-root.bat 2025-11-18 00:00:00 +00:00
Maurice Kayser
36b151177e Add WOW64 related entries to create-root.bat 2025-11-18 00:00:00 +00:00
Maurice Kayser
889dea066e Sort create-root.bat entries alphabetically 2025-11-18 00:00:00 +00:00
momo5502
ed7c7085b4 Fix formatting 2025-11-01 10:34:26 +01:00
dependabot[bot]
2468a03da0 Build(deps): Bump icicle-vm
Bumps [icicle-vm](https://github.com/icicle-emu/icicle-emu) from `ebb9bd1` to `0ce707e`.
- [Commits](ebb9bd1969...0ce707edd1)

---
updated-dependencies:
- dependency-name: icicle-vm
  dependency-version: 0ce707edd10f7a099426cf02a9fdf8eda3f57768
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-31 20:21:48 +00:00
momo5502
42630afac0 Remove randomness 2025-10-31 18:23:35 +01:00
momo5502
0e5bbdd8cc Fix serialization issues 2025-10-30 20:21:28 +01:00
momo5502
98eb1f92d1 Better formatting 2025-10-26 18:48:51 +01:00
momo5502
3bf037876c Remove logging 2025-10-26 18:48:43 +01:00
momo5502
cb4fe6c30f Merge remote-tracking branch 'origin/main' into wow64 2025-10-25 11:06:03 +02:00
Maurice Heumann
eb0ba686cd Bugfixes - minidump load, memory tail boundary (#568)
Minor change to allow minidump load to work with pages with copy
permission set.

File was probing memory via VirtualQuery incrementally, previously this
ran forever as Sogen doesn't replicate Windows behaviour.

Added exclusive allocation end boundary so that allocation / info check
on last page of user space VA works. Modified
memory_manager::find_free_allocation_base and
memory_manager::get_region_info to use exclusive boundary.
Added check to NtQueryVirtualMemory - now correctly returns
STATUS_INVALID_PARAMETER when run against memory outside of user space
VA. Kernel modules should use ZwQueryVirtualMemory not the user land
API.
2025-10-25 10:55:18 +02:00
CarlTSpeak
22df3e7889 Fix format issue 2025-10-24 11:13:55 +01:00
CarlTSpeak
064df5b6ef Revert earlier rdtsc changes, implement fixes 2025-10-24 10:59:28 +01:00
Igor Pissolati
b6d7a012d7 Fix issue in NtUserEnumDisplayDevices and NtUserEnumDisplaySettings 2025-10-23 16:02:53 -03:00
CarlTSpeak
96169a01a8 Merge branch 'main' of https://github.com/momo5502/sogen 2025-10-23 19:00:50 +01:00
Igor Pissolati
3c6c2e2dde Apply review suggestion 2025-10-23 11:19:35 -03:00
Igor Pissolati
2c82277b5e Add FileIdInformation file info class 2025-10-23 11:19:17 -03:00
Igor Pissolati
83aa3b663a Optimize module_manager::get_module 2025-10-22 17:21:34 -03:00
Igor Pissolati
46b97fd91c Don't request 'file_size' for directories 2025-10-22 17:21:04 -03:00
Igor Pissolati
c07f541528 Stub NtSetSecurityObject 2025-10-22 17:20:38 -03:00
Igor Pissolati
d20da12052 Add '\??\pipe\' prefix to is_named_pipe_path 2025-10-22 17:19:51 -03:00
Igor Pissolati
1c89c4e3b3 Initialize StaticUnicodeString in TEB 2025-10-22 17:18:41 -03:00
Igor Pissolati
0d06e6822a Add support for SHA256 in KSecDD 2025-10-22 17:17:57 -03:00
Igor Pissolati
4fbd65a302 Fix DISPLAY_DEVICEW value 2025-10-22 17:17:02 -03:00
Igor Pissolati
54ebbe27c2 Implement NtUserEnumDisplaySettings syscall 2025-10-22 17:16:10 -03:00
Igor Pissolati
c8a18cf61c Add FileIsRemoteDeviceInformation file info class 2025-10-22 17:14:51 -03:00
Igor Pissolati
c0fd8ebf51 Add FileFsAttributeInformation fs info class 2025-10-22 17:14:19 -03:00
momo5502
effd2f7a02 Merge remote-tracking branch 'origin/main' into wow64 2025-10-21 20:45:29 +02:00
momo5502
11ef37758c Fix casing 2025-10-21 20:43:29 +02:00
Maurice Heumann
b84ae7475f Implement ALPC port abstraction and implement DNS resolver port (#558)
This PR introduces an abstraction for ALPC ports to make them easier to
manage in the future, and implements the DNS resolver port, at least
enough to get host address queries working.
There's a lot of code in this PR that I'm not very confident about, so
don't hesitate on the feedback 😄

<img width="1377" height="624" alt="image"
src="https://github.com/user-attachments/assets/4d56b84d-4b87-42ed-9bfa-be04dbbf3735"
/>
2025-10-21 20:42:26 +02:00
momo5502
829836c333 Enable serialization tests 2025-10-21 20:41:53 +02:00
Maurice Heumann
7799f3dd74 Small timing fix (#563) 2025-10-21 20:35:19 +02:00
momo5502
652f8d7f17 Fix formatting 2025-10-21 20:15:20 +02:00
Maurice Heumann
304dbcc661 Comprehensive WOW64 subsystem implementation (#555)
# Major Features Implemented
**Core WOW64 Architecture**
1. Full TEB, PEB, and Windows structure implementations for 32-bit
processes
2. Proper thread context switching with 32-bit stack allocation
3. Configurable memory allocation with 32-bit/64-bit address space
handling
4. Automatic WOW64 process identification and handling
5. Heaven's Gate Implementation for handling exceptions

**Enhanced Emulation Features**
1. Fixed GDT setup and segment management for WOW64
2. Multi-architecture PE loading with proper import resolution
3. Segment-aware disassembly with WOW64 debugging capabilities

**Testing & Validation**
**32-bit Test Sample**: Minimal "hello" executable with full ASM source

# TODO
Needs more testing, currently in very early stages.
2025-10-21 20:13:01 +02:00
momo5502
8ef9349c37 Small timing fix 2025-10-21 20:12:28 +02:00
momo5502
facf997120 Small timing fix 2025-10-21 20:12:04 +02:00
Igor Pissolati
dc3a0e6fd4 Small improvements 2025-10-21 11:23:57 -03:00
CarlTSpeak
b64f780ff6 Merge branch 'main' of https://github.com/momo5502/sogen 2025-10-21 11:20:08 +01:00
Igor Pissolati
1a97f3b2e2 Fix failed check 2025-10-20 23:19:24 -03:00
Igor Pissolati
65de67b24f Use hard-coded values instead of calling __cpuidex 2025-10-20 22:52:56 -03:00
Igor Pissolati
6fe93375e6 Disable SSE4.x 2025-10-20 22:26:15 -03:00
Maurice Heumann
0e158b6064 Implement file renaming and relative path handling in NtQueryAttributesFile (#557)
This PR introduces several enhancements, mainly to the file system
syscalls:

- Implements file renaming via `NtSetInformationFile` by adding a
deferred rename mechanism to `file_handle`. The rename operation occurs
when the file handle is closed.
- Adds support for the `RootDirectory` parameter in
`NtQueryAttributesFile` to handle relative file paths.
- Adds support for opening the console output device (`\\??\\CONOUT$`).
- Stubs out the `NtLockVirtualMemory` syscall.
- Fixes an incorrect assertion in `socket_wrapper` that could fire on
`recvfrom` errors.
2025-10-20 15:08:37 +02:00
AlexGuo1998
66c7c3126d Fix std::chrono::system_clock::now()
In `ntdll!RtlGetSystemTimePrecise`, `kusd.SystemTime` is queried first, and QPC offset (`QPC() - kusd.BaselineSystemTimeQpc`) is added if it's larger than 0.
Setting `kusd.BaselineSystemTimeQpc` to `UINT64_MAX` avoids the adjustment, so incorrect adjustments won't happen.
Alternatively, We can update `kusd.BaselineSystemTimeQpc` to be the QPC value just when `kusd.SystemTime` changes, but that's not possible, because we cannot monitor `kusd.SystemTime` for change.
2025-10-20 10:30:44 +08:00
Igor Pissolati
248c09d554 Implement ALPC port abstraction and implement DNS resolver port 2025-10-19 23:23:29 -03:00