Commit graph

82817 commits

Author SHA1 Message Date
Timo Kreuzer 6744368755 [NTDLL_APITEST] Implement NtContinue test for x64 2022-11-24 21:17:58 +02:00
Hermès Bélusca-Maïto f7024d6c72
[PSDK][NTOS:KD64] Turns out, that even Clang in MSVC mode needs the 64-bits pointer extension hack!
Addendum to commit de81021ba.
Otherwise, we get the following build error:

 \ntoskrnl\kd64\kddata.c(532,5): error: initializer element is not a compile-time constant
      PtrToUL64(RtlpBreakWithStatusInstruction),
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 \ntoskrnl\kd64\kddata.c(526,26): note: expanded from macro 'PtrToUL64'
 #define PtrToUL64(x)    ((ULPTR64)(x))
                          ^~~~~~~~~~~~
2022-11-24 13:30:43 +01:00
Katayama Hirofumi MZ 375b02f337 [NTGDI][FREETYPE] Simplify IntRequestFontSize and FONTGDI
FONTGDI.lfWidth and FONTGDI.EmHeight are not used.
Simplify code without setting these members.
CORE-11848
2022-11-24 14:18:20 +09:00
Katayama Hirofumi MZ 476f94c0fe [NTGDI][FREETYPE] Formatting code; Follow up #4865 (a620c6f)
CORE-11848
2022-11-24 12:28:10 +09:00
Thomas Faber 911153da10
[LIBXML2] Update to version 2.10.0. CORE-17766 2022-11-23 22:02:47 -05:00
Thomas Faber 608bbe1136
[MSXML3][MSXML3_WINETEST] Partial sync to Wine to enable libxml2 update. CORE-17766
xml2: Import upstream release 2.10.0.

wine commit id 015491ab32742ace5218d37b1149c58803858214 by Alexandre Julliard <julliard@winehq.org>

Note: Upstream msxml3_test has switched away from WINE_NO_LONG_TYPES, so
I've kept the old printf format specifiers for now. Once we do a full
sync, we can get rid of __ROS_LONG64__ for this test and use them
unmodified.
2022-11-23 22:02:47 -05:00
Thomas Faber 21ab4d93c7
[LIBXSLT] Update to version 1.1.36. CORE-17766
This version was released after libxml2 2.10.0, but it removes
usage of some now-deprecated functions that would break the build.
2022-11-23 22:02:43 -05:00
Katayama Hirofumi MZ a620c6f82e
[NTGDI][FREETYPE] Simplify font rendering (#4865)
- Add ftGdiGetRealGlyph and ftGdiGetTextWidth helper functions.
- Optimize font rendering.
CORE-11848
2022-11-24 11:51:04 +09:00
Hermès Bélusca-Maïto 968b264300
[NTOS:KD] Rename the private acquire/release lock functions to fix GCC compilation.
If you ask why there are two sets of functions that do the same, it's
because this file (and the kdmain.c) will very soon some day be moved to
a transport dll, outside the kernel, and it will need these functions.
2022-11-24 01:44:14 +01:00
Hermès Bélusca-Maïto ffb05406e6
[NTOS:KD64] Implement KdLogDbgPrint() for the WinDbg !dbgprint command.
See this command's documentation:
https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/-dbgprint
and the section "DbgPrint buffer and the debugger"
https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/reading-and-filtering-debugging-messages#dbgprint-buffer-and-the-debugger
for more details.

- Loosely implement the function, based on our existing circular printout
  buffers in kdio.c.
- Enable its usage in the KdpPrint() and KdpPrompt() functions.

Notice that this function will *only* capture the strings being sent **to**
the debugger, and not the strings the debugger itself produce. (This means
that we cannot use the KdPrintCircularBuffer as a replacement for our
KDBG dmesg one, for example...)

How to test:
Run ReactOS under WinDbg, and use the !dbgprint command to view the
buffer. You can also use the Memory Window, place yourself at the
address pointed by KdPrintCircularBuffer and KdPrintWritePointer, and
read its contents.

What you should observe:
Prior notice: The circular buffer in debug builds of ReactOS and Windows
is 0x8000 bytes large. In release builds, its size is down to 0x1000.
1- When you start e.g. the 2nd-stage GUI installation of ReactOS, going
   past the initial "devices installation" and letting it stabilize on
   the Welcome page, break into WinDbg and run the !dbgprint command. You
   should notice that the end of its output is weirdly truncated, compared
   to what has been actually emitted to the debug output. Comparing this
   with the actual contents of the circular buffer (via Memory Window),
   shows that the buffer contents is actually correct.
2- Copy all the text that has been output by the !dbgprint command and
   paste it in an editor; count the number of all characters appearing +
   newlines (only CR or LF), and observe that this number is "mysteriously"
   equal to 16384 == 0x4000.
3- Continue running ReactOS installation for a little while, breaking back
   back into WinDbg and looking at !dbgprint again. Its output seems to be
   still stopping at the same place as before (but the actual buffer memory
   contents shows otherwise). Continue running ROS installation, and break
   into the debugger when ROS is about to restart. You should now observe
   that the dbgprint buffer rolled over:
     dd nt!KdPrintRolloverCount shows 1.
   Carefully analysing the output of !dbgprint, however, you will notice
   that it looks a bit garbage-y: the first part of the output is actually
   truncated after 16384 characters, then you get a second part of the
   buffer showing what ReactOS was printing while shutting down. Then
   you get again what was shown at the top of the !dbgprint output.
   (Of course, comparing with the actual contents of the circular buffer
   in memory shows that its contents are fine...)

The reason of these strange observations, is because there is an intrinsic
bug in the !dbgprint command implementation (in kdexts.dll). Essentially,
it displays the contents of the circular buffer in two single dprintf()
calls: one for the "older" (bottom) part of the buffer:
  [WritePointer, EndOfBuffer]
and one for the "newer" (upper) part of the buffer:
  [CircularBuffer, WritePointer[ .
The first aspect of the bug (causing observation 3), is that those two
parts are not necessarily NULL-terminated strings (especially after
rollover), so for example, displaying the upper part of the buffer, will
potentially also display part of the buffer's bottom part.
The second aspect of the bug (explaining observations 1 and 2), is due
to the implementation of the dprintf() function (callback in dbgenv.dll).
There, it uses a fixed-sized buffer of size 0x4000 == 16384 characters.
Since the output of the circular buffer is not done by little chunks,
but by the two large parts, if any of those are larger than 0x4000 they
get truncated on display.
(This last observation is confirmed in a completely different context by
https://community.osr.com/discussion/112439/dprintf-s-max-string-length .)
2022-11-24 01:18:18 +01:00
Hermès Bélusca-Maïto 36335d9cee
[NTOS:KD64] Correctly initialize the KdPrint buffer data in KdDebuggerDataBlock so as to fix the WinDbg !dbgprint command.
Now, !dbgprint just shows an empty log (since we don't fill it), instead
of showing the following error:

  kd> !dbgprint
  Can't find DbgPrint buffer
2022-11-24 01:18:17 +01:00
Hermès Bélusca-Maïto de81021bab
[PSDK][NTOS:KD64] Rename GCC_ULONG64 to ULPTR64 to self-document the fact it stores a pointer as a 64-bit quantity.
But the underlying GCC stupidity is still there (15 years later).

However, enable it only in 32-bit GCC builds, not in 64-bits nor with MSVC.
See commit b9cd3f2d9 (r25845) for some details.

GCC is indeed still incapable of casting 32-bit pointers up to 64-bits,
when static-initializing arrays (**outside** a function) without emitting
the error:

  "error: initializer element is not constant"

(which might somehow indicate it actually tries to generate executable
code for casting the pointers, instead of doing it at compile-time).

Going down the rabbit hole, other stupidities show up:

Our PVOID64 type and the related POINTER_64 (in 32-bit archs), or the
PVOID32 and POINTER_32 (in 64-bit archs), are all silently broken in
GCC builds, because the pointer size attributes __ptr64 and __ptr32,
which are originally MSVC-specific, are defined to nothing in _mingw.h.
(And similarly for the __uptr and __sptr sign-extension attributes.)

Clang and other sane ompilers has since then implemented those (enabled
with -fms-extensions), but not GCC. The closest thing that could exist
for GCC is to do:

  #define __ptr64 __attribute__((mode(DI)))

in order to get a 64-bit-sized pointer type with

  typedef void* __ptr64 PVOID64;

but even this does not work, with the error:

  "error: invalid pointer mode 'DI'"
2022-11-24 01:18:16 +01:00
Hermès Bélusca-Maïto 1c0950b557
[PSDK][NTOS:KD64] Update the KDDEBUGGER_DATA64 structure with new fields.
Information from the Windows 10 SDK and from
https://github.com/DarthTon/Blackbone/blob/master/src/BlackBoneDrv/NativeStructs.h
2022-11-24 01:18:15 +01:00
Hermès Bélusca-Maïto 1847474aaa
[PSDK] Clarify the FIXME comment about this mysterious warning.h (here for WDK compatibility). 2022-11-24 01:18:11 +01:00
Marcin Jabłoński edb7575faa
[NTOS:KE/x64] Implement KeDisconnectInterrupt() for amd64 (#4883)
Choose the correct element of the KiUnexpectedRange array,
depending on the interrupt vector, the same way as here:
a2c6af0da4/ntoskrnl/ke/amd64/except.c (L77)

And guard KeConnectInterrupt() execution with dispatcher lock.

CORE-14922
2022-11-22 23:52:18 +03:00
Hermès Bélusca-Maïto d15f126143
[NTOS:KDBG] Fix the ANSI escape sequences used to get terminal characteristics when printing with paging.
- Line-wrapping is enabled with 'ESC[?7h' (the '?' was forgotten).
  Notice that the following reference also shows it wrong:
  https://www.cse.psu.edu/~kxc104/class/cse472/09s/hw/hw7/vt100ansi.htm

- Terminal type is actually queried with 'ESC Z' (VT52-compatible), or
  with 'ESC[c' (VT100-compatible). The antediluvian CTRL-E ('\x05')
  control code gives instead a user-configurable (usually empty) string,
  so it's not reliable.
  Also, we don't really care about the returned result, we just need to
  know that one has been sent.

Cross-checked with online documentation:
* "Digital VT100 User Guide" (EK-VT100-UG-001) (1st edition, August 1978,
  reviewed November 1978).
* https://www.real-world-systems.com/docs/ANSIcode.html
* https://geoffg.net/Downloads/Terminal/TerminalEscapeCodes.pdf
* https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
* https://en.wikipedia.org/wiki/Enquiry_character

- Retrieve the size of the *controlling terminal* with escape sequences
  only when it's a serial one: serial output is enabled *and* KDSERIAL
  is set (i.e. user input through serial). See code for the actual logic
  (the corresponding truth table is left as an exercise for the reader).

- Fix also a "Buffer" vs. "InBuffer" mismatch, that caused the whole
  code to fail.

- For fallback terminal size values, use meaningful ones when SCREEN
  is instead the controlling "terminal" (based on full-size BOOTVID
  values).

- When echoing read characters during line-cooking, do direct output by
  using KdpDprintf() instead of going through the heavy KdbpPrint() function.
  This fixes some input artifacts like: 1. extra slowdowns due to
  querying terminal size at each keypress, and 2. getting obnoxious
  "--- Press q to abort ..." prompts in the middle of typing a long
  comamnd because you are at the very bottom of the screen.
2022-11-22 02:10:55 +01:00
Hermès Bélusca-Maïto c29d6806b8
[NTOS:KD] Remove last remnant of KdpDetectConflicts, deprecated since 2007.
Addendum to commit be2645ad8 (r25987).
2022-11-22 02:10:54 +01:00
Hermès Bélusca-Maïto 9337ea6a3c
[NTOS:KDBG] Deduplicate code between KdbpPrint() and KdbpPager(). 2022-11-22 02:10:54 +01:00
Thomas Faber 8940614a78
[LIBXML2] Update to version 2.9.14. CORE-17766 2022-11-21 19:46:12 -05:00
Thomas Faber 7244e0c5c6
[LIBXML2] Update to version 2.9.13. CORE-17766 2022-11-21 19:46:12 -05:00
Thomas Faber df1adce32c
[LIBXML2] Fix forgotten config.h update. CORE-17766 2022-11-21 19:46:11 -05:00
Thomas Faber f7671c1be8
[LIBXSLT] Update to version 1.1.35. CORE-17766 2022-11-21 19:46:11 -05:00
Thomas Faber e524b1bcf6
[LIBXSLT] Improve sync with upstream. CORE-17766
Makefile.am: this hasn't been updated in a while
security.c: WIN32 -> _WIN32 to keep the ROS-diff consistent with the rest
win32config.h/libxslt.h: remove unnecessary ROS-diff
xsltwin32config.h: this was missed in the 1.1.34 sync
xsltexports.h: mark a ROS-diff as such
2022-11-21 19:46:08 -05:00
Zebediah Figura dee3e6e7cd
[WINESYNC][WORDPAD] paint_ruler(): Use GetSysColorBrush()
Import wine-4.7 commit:
dcd9376ae7

Follow-up to 0.4.15-dev-5248-g be014129a5.
2022-11-21 23:08:27 +03:00
Zebediah Figura 0828e16462
[WINESYNC][USER32] MDI_AugmentFrameMenu(): Use GetSysColorBrush()
Import applicable part of wine-4.7 commit:
8d251a1dd1

Follow-up to 0.4.15-dev-5248-g be014129a5.
2022-11-21 23:08:09 +03:00
Thomas Faber 79b0fce5dc
[NTOS:CM] Consistently use synchronous I/O for registry hives.
Our current CmpFileRead/CmpFileWrite do not wait for completion,
so will cause stack corruption if used on files opened in async
mode.
2022-11-20 16:02:39 -05:00
Jose Carlos Jesus dfb7e2d639
[TRANSLATION] Improve Portuguese (pt-PT) translation (#4886)
- [APPWIZ] Improve pt-PT translation
- [INPUT] Update pt-PT translation
- [INTL] Fix typos in pt-PT translation
- [LICCPA] Improve pt-PT translation
- [SYSDM] Update and improve pt-PT translation
- [NTOBJSHEX] Update pt-PT translation
- [ZIPFLDR] Update and improve pt-PT translation
2022-11-20 23:20:11 +03:00
Jose Carlos Jesus 685728bc24
[SHELL32] Prevent a second call to Drive Properties dialog (#4888)
CDefaultContextMenu::DoProperties provides a fallback call
to the property sheet testing the return value of the _DoCallback method,
which is ultimately the return value of SH_ShowDriveProperties().

SH_ShowDriveProperties() sometimes returns an HRESULT, however it is marked
as returning a BOOL. Then, DrivesContextMenuCallback() always handles this
result as an HRESULT.

Fix SH_ShowDriveProperties() to always return a BOOL as it is intended,
and in DrivesContextMenuCallback() handle the result accordingly.

CORE-18537
2022-11-20 21:10:11 +03:00
Jose Carlos Jesus c093d4f803
[TASKMGR] Prevent context menu on idle process (#4889)
In Win2K3, there is no context menu on the System Idle Process.

CORE-18640
2022-11-20 20:22:30 +03:00
Thamatip Chitpong f125cd1c71
[SYSDM] System Parameters: Close dialog on ESC (#4891)
CORE-18610
2022-11-19 20:08:04 +03:00
Katayama Hirofumi MZ f908d37bb3
[REGEDIT] F4, Alt+D, Tab, and Shift+Tab (#4885)
CORE-12323
2022-11-19 08:42:20 +09:00
Hermès Bélusca-Maïto ffe3109d37
[NTOS:KD] Handle work-buffer allocation failure in KdpDebugLogInit. It can be ignored in KdpScreenInit. 2022-11-18 18:48:46 +01:00
Hermès Bélusca-Maïto 271b985981
[NTOS:KD] Cleanup of some old code.
- Remove KdbInit() macro and directly use KdbpCliInit() (since the place
  where it was used was already within an #ifdef KDBG block).

- Declare KdpKdbgInit() only when KDBG is defined, move its definition
  into kdio.c and remove the legacy wrappers/kdbg.c file.
  And in KdbInitialize(), set KdpInitRoutine directly to the former,
  instead of using the KdpKdbgInit indirection.

- Don't reset KdComPortInUse in KdpDebugLogInit().

- Minor refactorings: KdpSerialDebugPrint -> KdpSerialPrint and make it
  static; argument name "Message" -> "String", "StringLength" -> "Length".
2022-11-18 18:11:30 +01:00
Hermès Bélusca-Maïto 98e585364b
[NTOS:KD] Annotate KdInitSystem and remove redundant declaration in kd.h 2022-11-18 18:11:29 +01:00
Hermès Bélusca-Maïto 4a93b0a463
[NTOS:IO] Show the captured/generated driver name in one failure path of IoCreateDriver. 2022-11-18 18:11:28 +01:00
Hermès Bélusca-Maïto 56be4eafd5
[NTOS:IO][NDK] Add the exported IoDeleteDriver to the NDK headers. 2022-11-18 18:11:26 +01:00
Joachim Henze 9c5bb096bc
[COMCTL32] Remove a rosdiff TOOLBAR_EraseBackground() (#4887)
This fixes the toolbar in FileZilla 3.8 being drawn wrong (grey)
It regressed by 0.4.15-dev-1603-g 232c45fcd7

And todays fix is a partial revert of that guilty rev.
The reverted part is not even necessarily needed for what we had in mind back then,
It was just a first tiny step with the aim to get rid of the comctl32.h changes of that commit.
But that goal was and even is far out of reach for many other reasons also.
Actually we should have reverted the toolbar.c change back then already,
before committing the "flipfix9".

CORE-18263
2022-11-18 12:42:32 +01:00
Katayama Hirofumi MZ 7cc89e520c [NTUSER] Implement IntCheckImeShowStatusInThread
CORE-11700
2022-11-17 10:27:12 +09:00
Joachim Henze bcb9abc133 [SYSDM][SMSS] Addendum to (#4843) (#4844) CORE-18574
[SYSDM] Prevent my german-teacher from getting a heart-attack by that misplaced comma.

[SMSS] Prevent myself from getting a heart-attack by that superfluous dot.

Furthermore this addendum serves the purpose of actually linking both PRs
and their 4 previous commits to the actual JIRA ticket CORE-18754, which wasn't
the case before:
0.4.15-dev-5392-g 04b2d35f5b
0.4.15-dev-5391-g a8e06d92e8

0.4.15-dev-5390-g a4274ad548
0.4.15-dev-5389-g 5dc43c0f32
2022-11-16 23:08:52 +01:00
Serge Gautherie 770b3a3ce5
[HHPCOMP:CHMC] chmc_crunch_lzx(): Disable a dead check (#4880)
CORE-18642
2022-11-16 22:19:52 +01:00
Hermès Bélusca-Maïto 04b2d35f5b
[SYSDM] Improvements for the Paging File settings dialog. (#4844)
- Implement the architecture-specific pagefile size limits.
  In particular, verify that the selected volume on which to create
  the page file can accomodate the theoretical maximum limit (e.g.
  FAT32 cannot accomodate a 16 TB pagefile on x64, and the limit must
  be lowered down to 4 GB).

- Change the IDS_WARNINITIALRANGE and IDS_WARNMAXIMUMRANGE strings
  so that the maximum limit mentioned is the dynamic one.

- Review, improve and fix other aspects of the code.

Parts of this PR: addendum to commits 4d2d2dbb2 (#2597), 3bee3b92a (#2706).
2022-11-16 21:55:23 +01:00
Hermès Bélusca-Maïto a8e06d92e8
[SYSDM] Make ResourceMessageBox() support printf-like messages. (#4844)
+ Make usage of this new functionality.
+ Cleanup precomp.h.
2022-11-16 21:55:22 +01:00
Hermès Bélusca-Maïto a4274ad548
[SMSS][NTOS:MM] Implement the architecture-specific pagefile size limits + code review. (#4843)
What we have:
- Maximum number of pagefiles: 16
- Minimum pagefile size: 256 pages (1 MB when page size = 4096 bytes)
- Maximum pagefile size:
  * 32-bit platforms: (1024 * 1024 - 1) pages (~ 4095 MB)
  * x86 with PAE support: same size as for AMD x64
  * x64 platform:  (4 * 1024 * 1024 * 1024 - 1) pages (~ 16 TB)
  * IA64 platform: (8 * 1024 * 1024 * 1024 - 1) pages (~ 32 TB)

Those are the values as supported and verified by the NT kernel.
Now,  user-mode programs (including SMSS.EXE)  have different opinions
on these, namely, they consider estimates directly in MB, respectively:
4095 MB, (16 * 1024 * 1024) MB, and (32 * 1024 * 1024) MB
(verified on Win2k3 and Win7 32 and 64 bits).
Also here, the minimum pagefile size is set to 2 MB.

Starting Windows 8+ (and 10), those values change slightly, and are
still not fully synchronized between NTOS:MM and SMSS. Finally, while
(x86 PAE and) AMD64 and ARM64 seem to share the maximum pagefile
size limit, 32-bit ARMv7 appears to use different limits than regular
x86 (2 GB instead of 4).

Please keep those values as they are for NT compatibility!

See the following references:
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/mm/modwrite/create.htm
https://techcommunity.microsoft.com/t5/ask-the-performance-team/what-is-the-page-file-for-anyway/ba-p/372608
+ Manual extraction of the values from different NT 6.2,6.3,10 builds.

[SMSS] Fill out in particular the x86-specific case for PAE.

[NTOS:MM] Some cleanup in the NtCreatePagingFile() code, namely:
- Clarify some comments;
- Validate the lower and upper bounds of the Minimum and Maximum sizes
  (based on Windows behaviour as explained by Geoff + manual tests).
- Open the pagefile in case-insensitive;
- Simplify the loop that finds an existing matching pagefile;
- Simplify some failure exit paths;
- Add a "Missing validation steps TODO" comment block explaining the
  existing code-hole.
2022-11-16 21:54:31 +01:00
Hermès Bélusca-Maïto 5dc43c0f32
[SMSS] Improve some comments. 2022-11-16 21:54:21 +01:00
Hervé Poussineau 12ef61ba10 [WIN32SS:ENG] Set VGA device as child of primary device
That way, we don't have anymore the VGA device together with primary device in device list.

Change also EngpUnlinkGraphicsDevice() function to add back VGA device to device list
when removing its parent from device list.

CORE-18522
2022-11-15 23:16:10 +01:00
Hervé Poussineau b3cdb7e713 [WIN32SS:ENG] Add EngpLinkGraphicsDevice, to add a device to gpGraphicsDeviceFirst list 2022-11-15 23:16:10 +01:00
Hervé Poussineau 3d01a103d7 [WIN32SS:ENG] Zero memory when allocating GRAPHICS_DEVICE structures 2022-11-15 23:16:10 +01:00
Hervé Poussineau ea30b96334 [WIN32SS:ENG] When VGA mode is requested, drop all graphic devices except VGA one
We don't need driver cooperation anymore to handle VGA mode request.
2022-11-15 23:15:26 +01:00
Hervé Poussineau 0ecd997bdf [WIN32SS:NTUSER] Extract InitVideo() prototype and gbBaseVideo variable to header 2022-11-15 23:15:26 +01:00
Hervé Poussineau 79f16507c4 [VGAMP/VGADDI] Be consistent in IOCTL_VIDEO_GET_CURRENT_MODE and IOCTL_VIDEO_SET_CURRENT_MODE
As IOCTL_VIDEO_GET_CURRENT_MODE returns 2 as ModeIndex, wait for the same value
in IOCTL_VIDEO_SET_CURRENT_MODE.
Also change vgaddi to send this hardcoded value.

vga_new also uses 2 as index for 640x480x16
2022-11-15 23:15:26 +01:00