Commit graph

86709 commits

Author SHA1 Message Date
Timo Kreuzer
bfb4d2076e HACK: Enable callbacks for x86 2025-02-03 16:33:51 +02:00
Timo Kreuzer
4edc818331 [NTOS:KE] Use callout stacks for user callback stack expansion (optional)
This is a Windows 7+ feature, which allows deeper recursion of user mode callbacks for win32k. It is required for some modern applications, like latest versions of Chrome.
2025-02-03 16:33:51 +02:00
Timo Kreuzer
5d03d26812 [NTOS:KE] Implement mechanism for callout-stacks 2025-02-03 16:33:51 +02:00
Timo Kreuzer
6fe60acc1d [NTOS:MM] Implement MmCreateKernelStackEx
This allows to specify the amount of committed bytes.
2025-02-03 16:10:03 +02:00
Timo Kreuzer
cb31f810c5 [NTOS:MM] Improve MmGrowKernelStackEx 2025-02-03 16:10:03 +02:00
Timo Kreuzer
de3a6706e7 [UCRT] fenv.h: Fix GCC build of _Fenv1 2025-01-30 11:30:32 +02:00
Timo Kreuzer
a438d7c3b8 [UCRT] Add GCC compatible definition of _CRT_STDIO_INLINE
In C99 mode GCC emits global symbols for inline functions, as soon as the compilation unit contains a declaration that marks the function as "extern". A number of functions like printf are implicitly declared as extern by GCC, which seemingly cannot be disabled. This would lead to the inline function being emitted as a global symbol in every compilation unit. Using static inline prevents duplicate symbol errors.
2025-01-30 11:30:32 +02:00
Timo Kreuzer
4ca68ffb1c [UCRT] Make __local_stdio_printf/scanf_options GCC compatible 2025-01-30 11:30:32 +02:00
Timo Kreuzer
bb9392e4e1 [CMAKE] Define _CRT_SUPPRESS_RESTRICT on GCC builds
This prevents the use of __declspec(restrict) in UCRT headers.
2025-01-30 11:30:32 +02:00
Hervé Poussineau
70bf3bb8fa [NTOS:KDBG] Add back 'cregs' command
This command was removed in commit baa47fa5e0
because there was no way to get the CRx registers from a CONTEXT structure.
Previous code was also displaying current GDTR/LDTR and IDT.

Rewrite the code to use KdSystemDebugControl(SysDbgReadControlSpace, ...)
to get CRx, GDTR/LDTR and IDT values just before entering debugger.
2025-01-29 18:25:24 +01:00
Katayama Hirofumi MZ
2f23e70ad5
Revert "[NTUSER] Enable SM_CXICON etc. settings from registry (#7679)" (#7682)
This reverts commit 3b3741c10a of #7679 .
It seems like the shell icon size is not the
system icon size.

The wide string L"Shell Small Icon Size" is detected in
shell32.dll and themeui.dll.
No L"Shell Small Icon Size" in win32k.sys found.
JIRA issue: CORE-12905
2025-01-29 21:34:19 +09:00
Katayama Hirofumi MZ
3b3741c10a
[NTUSER] Enable SM_CXICON etc. settings from registry (#7679)
Improve usability.
JIRA issue: CORE-12905
- Add nIconSize and nSmallIconSize
  values to SPIVALUES structure.
- Load "Shell Icon Size" and "Shell
  Small Icon Size" values from registry.
- Enable changing of SM_CXICON,
  SM_CYICON, SM_CXSMICON, and
  SM_CYSMICON settings.
2025-01-29 20:20:25 +09:00
Justin Miller
a8da29e888
[ACPI] Move CMBATT and COMPBATT out of the acpi directory (#7599)
Move these out of ACPI in preparation for ACPI_NEW so they keep their juicy commit history.
Also both ACPIs can coexist for awhile as I don't see the old driver getting removed anytime soon.
2025-01-29 00:49:35 -08:00
Whindmar Saksit
b35becef2e
[RAPPS] Set working directory for zip generated shortcuts (#7674)
Some applications are broken and assume the working directory is the
same as the .exe directory (xrick etc).
2025-01-29 00:46:11 +01:00
Hervé Poussineau
b9852e83d2
[NTOS:EX] HACK: on livecd, disable security features in NtSystemDebugControl
WinDBG can do some local debugging using 'windbg -kl'. In that case,
WinDBG tries to directly use NtSystemDebugControl. If this function
returns an error, WinDBG extracts a driver from its resources.
WinDBG will send IOCTLs to this driver, and this driver will call
KdSystemDebugControl.

However, on livecd (where %SYSTEMROOT% is read-only), WinDBG is unable
to extract the driver from its resources, and can't use the driver to
call KdSystemDebugControl.

As a work-around, allow all control classes in NtSystemDebugControl
in case of livecd.
WinDBG local debugging now also works on livecd (windbg -kl).
2025-01-28 22:00:56 +01:00
Hervé Poussineau
5547b74717
[NTOS:KD64] Fix freezes on first chance exception when KDBG is enabled and KdIgnoreUmExceptions is TRUE
This fixes the following use case:
- Execute 'kdbgctrl.exe -du'
- Execute 'kdbgctrl.exe -cu'
- See that last command never finishes
2025-01-28 22:00:55 +01:00
Hermès Bélusca-Maïto
7068a790b2
[NTOS:KD64] Add a missing KdEnteredDebugger reset in KdExitDebugger() 2025-01-28 22:00:54 +01:00
Hervé Poussineau
6b89a0da11
[NTOS:EX] Implement NtSystemDebugControl: SysDbgGetKdBlockEnable/SysDbgSetKdBlockEnable 2025-01-28 22:00:53 +01:00
Hervé Poussineau
d4546753f6
[NTOS:EX] Implement NtSystemDebugControl: SysDbgGetKdUmExceptionEnable/SysDbgSetKdUmExceptionEnable 2025-01-28 22:00:53 +01:00
Hervé Poussineau
734a043b22
[NTOS:EX] Implement NtSystemDebugControl: SysDbgGetPrintBufferSize 2025-01-28 22:00:51 +01:00
Hervé Poussineau
4dc0e5cc81
[NTOS:EX] Implement NtSystemDebugControl: SysDbgGetAutoKdEnable/SysDbgSetAutoKdEnable 2025-01-28 22:00:50 +01:00
Hervé Poussineau
4bae44e412
[NTOS:EX] Implement NtSystemDebugControl: SysDbgEnableKernelDebugger/SysDbgDisableKernelDebugger 2025-01-28 22:00:49 +01:00
Hervé Poussineau
7b4d618994
[NTOS:EX] Implement NtSystemDebugControl: SysDbgBreakPoint 2025-01-28 22:00:48 +01:00
Hervé Poussineau
1db1bceaa7
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgCheckLowMemory 2025-01-28 22:00:48 +01:00
Hervé Poussineau
2fe3de6c69
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadBusData/SysDbgWriteBusData 2025-01-28 22:00:47 +01:00
Hervé Poussineau
19046a253b
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadMsr/SysDbgWriteMsr 2025-01-28 22:00:46 +01:00
Hervé Poussineau
b187662f39
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadIoSpace/SysDbgWriteIoSpace 2025-01-28 22:00:46 +01:00
Hervé Poussineau
0589c178ba
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadControlSpace/SysDbgWriteControlSpace 2025-01-28 22:00:45 +01:00
Hervé Poussineau
42e038f227
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadPhysical/SysDbgWritePhysical 2025-01-28 22:00:43 +01:00
Hervé Poussineau
2efaa5ea1e
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadVirtual/SysDbgWriteVirtual 2025-01-28 22:00:42 +01:00
Hervé Poussineau
9f97f0b284
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgQueryVersion 2025-01-28 22:00:40 +01:00
Hervé Poussineau
6338d51353
[NTOS:EX] In NtSystemDebugControl, check for SeDebugPrivilege 2025-01-28 22:00:39 +01:00
Hervé Poussineau
9e7c3770e3
[NTOS:EX] Improve NtSystemDebugControl
- Add SEH probing for user buffer
- Mark some classes as i386 only
- Explicitly return STATUS_NOT_IMPLEMENTED on disabled classes (must use KdSystemDebugControl instead)
- Explicitly return STATUS_NOT_IMPLEMENTED on not implemented classes
- Return STATUS_INVALID_INFO_CLASS on all other classes
2025-01-28 22:00:38 +01:00
Hervé Poussineau
0f36ef3392
[NTOS:KD64] Improve KdSystemDebugControl
- Explicitly return STATUS_NOT_IMPLEMENTED on not implemented classes
- Return STATUS_INVALID_INFO_CLASS on all other classes
2025-01-28 22:00:37 +01:00
Hermès Bélusca-Maïto
a0b009f1ed
[NTOS:EX:KD64] Add Doxygen documentation for Nt/KdSystemDebugControl.
Based from external documentation:
https://www.ivanlef0u.tuxfamily.org/?p=21
https://www.ivanlef0u.tuxfamily.org/?p=382
http://pds8.egloos.com/pds/200807/09/51/Subverting_Windows_2003_Service_Pack_1_Kernel_Integrity_Protection.pdf
http://www.nynaeve.net/?p=114
https://media.defcon.org/DEF%20CON%2030/DEF%20CON%2030%20presentations/Eran%20Segal%20-%20The%20COW%20%28Container%20On%20Windows%29%20Who%20Escaped%20the%20Silo.pdf
https://vidstromlabs.com/blog/memory-dumping-with-ntsystemdebugcontrol/
https://www.kernelmode.info/forum/viewtopic0aa3.html?t=5317
2025-01-28 22:00:36 +01:00
Hermès Bélusca-Maïto
317f1e8391
[NDK][NTOS:EX:KD64] Add SAL annotations to Kd/Nt/ZwSystemDebugControl. 2025-01-28 22:00:35 +01:00
Hermès Bélusca-Maïto
5d78952024
[NTOS:KD64] Simplify some code in debugging helpers 2025-01-28 22:00:34 +01:00
Hermès Bélusca-Maïto
1c61d4ce90
[NTOS:KD64] Add annotations to debugger control routines used in Kd/Nt/ZwSystemDebugControl 2025-01-28 22:00:33 +01:00
Hervé Poussineau
20bd5e8a9c
[NTOS:MM] Allow not providing MMDBG_COPY_UNSAFE in MmDbgCopyMemory
Replace an assert by a log, as this works most of the times.
2025-01-28 22:00:31 +01:00
Hervé Poussineau
69cd1e107a
[NTOS:EX] Allow calling ExLockUserBuffer up to DISPATCH_LEVEL 2025-01-28 22:00:30 +01:00
Hervé Poussineau
d8e25f06b1
[NTOS:EX] Add prototypes for ExLockUserBuffer/ExUnlockUserBuffer 2025-01-28 22:00:29 +01:00
Hermès Bélusca-Maïto
2c59b5b8cf
[NDK] SYSDBG: Add SysDbgKdPullRemoteFile enum value and structure (Win10 19041+)
From https://github.com/processhacker/phnt/
2025-01-28 22:00:28 +01:00
Hermès Bélusca-Maïto
4d37135884
[NDK] SYSDBG: Add SysDbgGetLiveKernelDump enum value and structures for kernel live dump.
For more information, see:
https://crashdmp.wordpress.com/2014/08/04/livedump-1-0-is-available/
https://github.com/lilhoser/livedump
https://gary-nebbett.blogspot.com/2016/04/examining-windows-kernel-mode-stacks.html
https://github.com/processhacker/phnt
2025-01-28 22:00:28 +01:00
Hermès Bélusca-Maïto
b5007e09b1
[NDK] SYSDBG: Add versioning info for Vista+ commands. 2025-01-28 22:00:27 +01:00
Timo Kreuzer
ae0fa8ba49 [UCRTSUPPORT] Add wine c++ exception code 2025-01-28 22:50:04 +02:00
Timo Kreuzer
e2d69ad98c [CRT] Split MSVC C++ aliases from cpp.s to cpp_alias.s 2025-01-28 22:50:04 +02:00
Hermès Bélusca-Maïto
40ea081198
[KMTESTS] Temporarily disable the debugger disable/reenable tests (#7424)
They will be re-enabled ONCE our KDBG and KDCOM dlls correctly support
disabling and re-enabling.
2025-01-28 15:54:04 +01:00
Hermès Bélusca-Maïto
94cb4d6c0c
[KMTESTS] Add tests for KdSystemDebugControl and NtSystemDebugControl (#7424)
Tested on Windows 2003 SP1.
Partially tested (but not completely) on higher versions.
2025-01-28 15:53:58 +01:00
Hermès Bélusca-Maïto
6ede6ac246
[KMTESTS] Remove "EnablePrivilege*" helpers + Fix typo
Their functionality is already ensured by RtlAdjustPrivilege().
2025-01-28 15:37:10 +01:00
Hermès Bélusca-Maïto
cf2cbe6ff6
[MOUNTMGR_APITEST] Add custom DesiredAccess to GetMountMgrHandle()
This will allow any future tests, employing IOCTL_MOUNTMGR_*
that require read or write accesses, to also use this helper.
2025-01-28 15:29:41 +01:00