Commit Graph

149 Commits

Author SHA1 Message Date
Hermès Bélusca-Maïto
03b1e240bf [VIDEOPRT] Deduplicate the IntIsVgaSaveDriver(Name) functionality (#8718)
- Initialize the device extension `IsVgaDriver` field with a single
  `IntIsVgaSaveDriver()` call when the video device extension is first
  initialized in `IntVideoPortCreateAdapterDeviceObject()`.

- The `IsVgaDriver` field can then be used wherever we previously
  invoked `IntIsVgaSaveDriver()` (see e.g. in resource.c)

NOTE: It may be possible to move the `IsVgaDriver` field to the driver
extension structure instead, if it's not possible for miniport drivers
to influence this during calls `VideoPortInitialize()` with a custom-made
registry path (2nd parameter) containing a "\\VgaSave" substring...
(To be investigated.)

Addendum to commits 08a6834075 and 0511e9d869.
2026-03-08 17:24:20 +01:00
Hermès Bélusca-Maïto
1de8b4f0ce [DDK][VIDEOPRT] VideoPortDebugPrint(): Fix the debug filter being used; update SAL annotations (#8718)
- Use the `DPFLTR_VIDEO_ID` debug filter ID, which is the same as what
  Windows' videoprt.sys uses, so that tools and people who debug can
  easily interoperate between the two.
  Addendum to commits 11c95f7b5d (r19801) and 5b799176ba (r31477).

- Use SAL2 annotations.
2026-03-08 15:25:09 +01:00
Hermès Bélusca-Maïto
e6f7e89ccd [VIDEOPRT] Fix a debug print newline (#8718) 2026-03-08 15:24:55 +01:00
Hermès Bélusca-Maïto
f4786c1b91 [VIDEOPRT] Fix INT10h support initialization (#8717)
This problem was noticed by Zombiedeth.

Addendum to commit 89d5a3dbb8 (PR #8451).

There exist buggy 3rd-party miniport drivers, like those for the NVIDIA GeForce
8400 GS card (`nv4_mini.sys` from `181.22_geforce_winxp_32bit_english_whql.exe`)
that invoke the VideoPort Int10 routines (either `VideoPortInt10()`, or the
INT10 interface via `VideoPortQueryServices()`) from their `HwFindAdapter()`
callback (invoked via `VideoPortInitialize()`) or from their `DriverEntry()`.

However, at this point, the VideoPort Int10 services are not fully initialized:
on the x86 port, the VDM memory isn't mapped until later, when the `\Device\VideoX`
is opened by Win32k as part of its initialization in the context of the CSRSS process.

Additionally on the x86 ReactOS port since commit 89d5a3dbb8 (PR #8451), the
X86 emulator is used by default, unless either a registry setting is set to
disable the emulator, or the HAL (e.g. the NT5.x HAL) doesn't export the X86
emulator routines; in these cases the VDM is employed instead.
In the NT5.x builds VideoPort imports the HAL X86 emulator routines at runtime,
since it has to handle their possible absence. However, this importing was
previously delayed up until VideoPort initialized the Int10 services (when
`\Device\VideoX` is opened the first time by Win32k from CSRSS), meaning,
these services and the X86 emulator imports weren't initialized until then.
When booting ReactOS in these conditions with the NVIDIA driver installed,
its too-early `VideoPortInt10()` call was invoking the X86 emulator with no
imports set up, which resulted in the invocation of a NULL function pointer,
leading to a BSOD.

## Proposed changes

- Make the existing `IntInitializeInt10()` function support two invocations:
  * When invoked the first time, it initializes the X86 emulator support, by
    importing the HAL emulator routines, if applicable.
  * When invoked the second+ time, it maps the VDM memory space (done when
    `Device\VideoX` is opened by Win32k/CSRSS initialization).

- Actually perform the first `IntInitializeInt10()` invocation in the
  `if (!FirstInitialization)` block of `VideoPortInitialize()`.

- Set a `VDMAddressSpaceInitialized` flag to TRUE only when the VDM memory
  space is mapped (during the second `IntInitializeInt10()` invocation).
  Check this flag in both `IntInt10CallBiosV86()` and `IntInt10CallBiosEmu()`
  (x86 build only).

- Adjust two returned status values in `IntInitializeVideoAddressSpace()`.
2026-03-08 15:13:54 +01:00
Adam Słaboń
4a7d370d93 [VIDEOPRT] VideoPortVerifyAccessRanges: Fix use after free (#8648)
Fixes a crash when booting with special pool enabled
Addendum to 0511e9d869
2026-02-01 14:02:06 +01:00
Justin Miller
bc690cfe43 [VIDEOPRT] Allow later nvidia cards to load (#8646)
Clear out the miniport owned extension and assign the slot iD properly
2026-01-30 11:23:00 +00:00
Timo Kreuzer
07de64139a [GCC_SSP] Turn the GCC stack protector lib into a normal library
Stop pointless target_sources(xxx PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>). The only effect it has is to force the object file into the target, which was already done by specifying the libraries as OBJECT libraries, which is also pointless, and only leads to problems.
2026-01-29 17:13:40 +02:00
Justin Miller
a08d639b22 [WIN32SS:NTGDI][VIDEOPRT] Multimonitor on RealHW fixes (#8638)
This commit attempts to resolve two regressions and improve realhw behavior
A PNP_DETECTED_FATAL_ERROR bug check caused by the monitor device instance being duplicated.
https://jira.reactos.org/browse/CORE-20410
this is mostly due to ChildID being overwritten with the same bus/slot when 2 monitors are attached to one GPU
And video drivers failing to startup after calling VideoPortCreateSecondaryDisplay

Co-authored-by: Dmitry Borisov <di.sean@protonmail.com>
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2026-01-29 04:29:55 +00:00
Justin Miller
0511e9d869 [VIDEOPRT] Expand how resource usage is handled in videoprt (#8272)
Allows our upcoming PCIX driver to work correctly with it, and now the arbiter on Windows with our videoprt actually matches the behavior and improves video driver compatibility
2026-01-19 09:04:55 -08:00
Hervé Poussineau
5a43991392 [BOCHSMP] Support up to 2 graphic cards in LiveCD 2026-01-08 22:48:24 +01:00
Dmitry Borisov
c8e1772109 [BOOTVID:PC98][PC98VID] Disable the text layer when setting mode (#8539)
The previous approach was causing the contents of TVRAM to be visible after boot:
https://github.com/user-attachments/assets/df6d2782-4d54-41ab-b4c9-caeb170c4e1e

Fixes a regression introduced in 0fa49018cd.

CORE-17977
2025-12-28 14:40:17 +03:00
Hermès Bélusca-Maïto
46fb20d406 [VIDEOPRT] registry.c: Minor code enhancements
- Add and use `CONST_STR_SIZE/LEN` macros to get the number of bytes and
  characters for a static const string buffer, instead of invoking e.g.
  `wcslen()`, which may or may NOT be optimized out (e.g. MSVC debug builds).

- Use `UNICODE_NULL` instead of `0`.

- Transform a `DPRINT` into an `INFO_(VIDEOPRT, ...)`

- Fix an x64 warning
  `registry.c(689): warning C4267: '=': conversion from 'size_t' to 'USHORT', possible loss of data`
2025-11-19 16:37:55 +01:00
Hermès Bélusca-Maïto
9a478189e5 [VIDEOPRT] registry.c: Uniformize some error debug traces 2025-11-19 15:48:35 +01:00
Hermès Bélusca-Maïto
89d5a3dbb8 [VIDEOPRT] Implement support for dynamically choosing V86 vs. X86 emulator on x86 32-bit builds (#8451)
The choice is done by looking for the presence or absence of the
`HKLM\System\CurrentControlSet\Control\GraphicsDrivers\DisableEmulator`
registry key. For more details, see:
https://www.geoffchappell.com/studies/windows/km/hal/api/x86bios/call.htm

By default, use V86 in 32-bit Win2k3-compatible builds, otherwise
(Vista+) check the presence of the registry key.

The X86 emulator routines are exported by the HAL.DLL. They are always
exported by the non-x86 HAL. However, they may or may not be exported by
the x86 (32-bit) HAL: on NT 5.2 and below they are not exported, while
on NT 6.x (Vista+) they are.

Therefore:

- in our NT <= 5.2 x86 builds, we load the routines at runtime. If they
  aren't found, we fail emulator support initialization and fall back to
  VDM V86 support.

- in our NT 6.x (x86 or not) builds, we always directly link with the HAL
  routines, since they are guaranteed to be present there.
2025-11-18 17:01:26 +01:00
Hervé Poussineau
59ae6b3e15 [VIDEOPRT] Handle VIDEO_MEMORY_SPACE_P6CACHE flag
JIRA issue: CORE-20298
2025-11-09 09:30:19 +01:00
Hermès Bélusca-Maïto
24e88af972 [VIDEOPRT][DDK] services.c: Reformat; update/fix SAL annotations (#8450)
NOTA: 2nd parameter `AgpServices` of `VideoPortGetAgpServices()` is
documented as "In", but should be "Out" as it receives information.
2025-11-06 22:36:42 +01:00
Hermès Bélusca-Maïto
267e3d8cf0 [VIDEOPRT] Improve IntAttachToCSRSS/IntDetachFromCSRSS() prototypes (#8449)
- Make `IntAttachToCSRSS()` return a BOOLEAN to distinguish calls made
  prior to `CsrProcess` being initialized.

- Adjust the callers of `IntAttachToCSRSS()` and make them returning a
  proper error value if attaching failed (if `CsrProcess == NULL`).

- Make `IntDetachFromCSRSS()` just take a `PKPROCESS` parameter instead a
  pointer to `PKPROCESS` -- the function won't need to modify its value.
  Adjust its callers to reflect the change.
2025-11-06 22:32:09 +01:00
Hermès Bélusca-Maïto
824a51e303 [VIDEOPRT] Minor maintenance for IntVideoPortGetProcAddress() (#8444)
- SAL-ify `IntVideoPortGetProcAddress()`. Sadly its 2nd parameter needs
  to stay `PUCHAR` to comply with the `PVIDEO_PORT_GET_PROC_ADDRESS` type.

- Append `VideoPortQuerySystemTime` to the array of exports (Vista+ compatibility).

Note that probably because of a copy-pasta error, Windows' VideoPrt
duplicates the `VideoPortMapDmaMemory` entry in between those of
`VideoPortFreeCommonBuffer` and `VideoPortReleaseBuffer`.
2025-11-04 19:50:23 +01:00
Mikhail Tyukin
44931d742b [VIDEOPRT] Fix incorrect return status (#8433)
IntVideoPortMapMemory incorrectly returned a successful result if it
failed to map video memory. This caused a bugcheck when using VirtualBox
with Guest Additions with more than 128MB of VRAM assigned to VM.

- Return ERROR_NOT_ENOUGH_MEMORY instead of NO_ERROR
  when mapping memory fails.
- Also add debug logging to help troubleshoot when MmMapIoSpace fails.

https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/video/nf-video-videoportmapmemory#return-value

This fixes the crash, however the desktop does not render correctly.
Using videoprt.sys from Windows XP still results in the same behavior.

CORE-12130
2025-11-04 13:30:12 +03:00
Timo Kreuzer
6d321562c9 [NTOS][NTDLL][UCRTBASE] Use new setjmp/longjmp
This fixes 2 todo tests
2025-08-22 09:12:51 +03:00
Timo Kreuzer
011ce7088c [PSEH] Use _setjmp3 with custom unwind function 2025-08-22 09:12:51 +03:00
Hervé Poussineau
29b5003455 [VIDEOPRT] Implement IOCTL_VIDEO_ENUM_MONITOR_PDO 2025-05-27 20:34:37 +02:00
Hervé Poussineau
dca369cf41 [WIN32SS:ENG] Rework EngpUpdateGraphicsDeviceList
- choose VGA adapter outside of driver initialization loop
- choose primary adapter outside of driver initialization loop
- link VGA adapter to primary adapter at the end
- only set DISPLAY_DEVICE_PRIMARY_DEVICE in this function

Also mark VgaSave driver as SystemStart instead of Disabled,
so it is available if main display driver doesn't work.
2025-05-12 18:24:55 +02:00
Hervé Poussineau
a36bf31a0d [VGAMP] Correctly initialize interface before calling VideoPortInitialize 2025-05-08 21:48:14 +02:00
Katayama Hirofumi MZ
1e6e5529c6 [FREETYPE][FTFD][DOC] Update FreeType to 2.10.0 from 2.9 (#7786)
Modernize font engine modules.
JIRA issue: CORE-16084
- Update FreeType to 2.10.0 from 2.9.
- Delete useless files.
- Add technical notes (TechNote.txt) on freetype.
- DbgPrint became FT_Message.
2025-04-04 20:50:25 +09:00
Timo Kreuzer
dca5194279 [FTFD] Fix malloc/realloc/free wrappers
On x64 malloc needs to return a 16 byte aligned buffer, the previous code used an 8 byte header, making the allocations unaligned. This is now fixed with an improved header structure.
Also simplify realloc a bit and make it handle Object == NULL.
2025-04-03 16:22:09 +00:00
Hervé Poussineau
cfde03ec9b [VIDEOPRT] Write monitor EDID to registry
This will be used later by win32k to give only valid display modes
to user mode.
2025-03-28 23:10:42 +01:00
Katayama Hirofumi MZ
fe11f7a2e5 [REACTOS] Refresh old URLs (#7632)
URLs are getting old. We have to
update URLs for documentation
purpose.
JIRA issue: CORE-19963
- Refresh old URLs.
- Add " (DEAD_LINK)" labels
  to dead links.
- Use MS Learn links rather
  than MSDN ones.
- Some dead links revived by
  Web Archive.
- Don't change Wine Tests
  and Wine Sync.
- Don't change 3rd party libraries.
- Don't append "redirected" labels.
2025-01-28 13:36:45 +09:00
Katayama Hirofumi MZ
bb7cf5a5b7 [FREETYPE][FTFD][NTGDI] Split FT_Bitmap_Convert hack (#7628)
Our FT_Bitmap_Convert function had a hack to make the
bitmap image compatible to ReactOS. I think the hack on
FT_Bitmap_Convert should be separated from our font
engine.
JIRA issue: CORE-16047
- Add FT_Bitmap_Convert_ReactOS_Hack function, that is
  based on FT_Bitmap_Convert, and split the hack of
  FT_Bitmap_Convert.
- Use FT_Bitmap_Convert_ReactOS_Hack in
  IntGetBitmapGlyphWithCache function instead of
  FT_Bitmap_Convert.
- Modify ftfd.spec to add 
  FT_Bitmap_Convert_ReactOS_Hack.
2025-01-22 10:57:40 +09:00
Hermès Bélusca-Maïto
01a10da73d [VIDEOPRT] VideoPortInitialize(): Display the invalid and expected struct sizes on error 2024-12-09 13:42:44 +01:00
Hervé Poussineau
08a6834075 [VIDEOPRT] Allow conflicting resources if this is the video base driver
CORE-18960
2024-10-11 20:35:23 +02:00
Hermès Bélusca-Maïto
c77a5ff99b Revert my last commits that break build.
Revert "[PSDK][AFD][VGADDI] Further build and MS PSDK compatibility fixes."
This reverts commit 99efc2ae50.

Revert "[PSDK] Sync winresrc.h with wine-8.20"
This reverts commit 3e83562aa7.

Revert "[OSK][PROGMAN] Fix resource file build."
This reverts commit 84e4ad0a82.

Revert "[PSDK] Use the new .rh files in winresrc.h"
This reverts commit f6fb7c48c9.
2023-11-23 17:20:47 +01:00
Hermès Bélusca-Maïto
99efc2ae50 [PSDK][AFD][VGADDI] Further build and MS PSDK compatibility fixes.
- windows.h:
  * should define _WINDOWS_ and _INC_WINDOWS instead of _WINDOWS_H
  * include winresrc.h if RC_INVOKED and not NOWINRES (Wine also agrees
    with that)
  * also, some .h included from there should _not_ be included if their
    respective NO*** flags are defined.

- batclass.h: Use correct _WINDOWS_ guard.

- winsnmp.h:
  * should define _INC_WINSNMP instead of _WINSNMP_H
  * use _INC_WINDOWS instead of _WINDOWS_H

- afd.h, vgaddi.h: Use the correct guards.

- winnt.rh: Define the (SUB)LANG_* exactly as they are in the winnt.h,
  otherwise we get macro redefinition compile errors.

NOTE: Ideally these .rh files should be auto-generated from their
corresponding .h files.

- afxres.h: Do not include the whole windows.h, but instead, only
  the winres.h file, and only if RC_INVOKED is defined.

NOTE: Both afxres.h and winres.h do not really belong to the PSDK,
but belong instead to MFC. The reason why we have them here is twofold:

1. Wine used to have also winres.h (from where we got ours). This is
   because the .rc resource files of some non-MFC modules were generated
   with Visual Studio, which always includes afxres.h for these, and the
   solution was to use a slightly less MFC-specific header: winres.h
   (Wine commit cb08c82244673f26842e7a0766de90f091b5a493).
   However, this winres.h has been since removed from Wine tree
   (Wine commit 197f4059ab2af5f13f9c56faa26e3b4af902f869).

2. Few of our modules either use afxres.h or winres.h in their resource
   files, and we still want to be able to compile them.
2023-11-23 16:26:30 +01:00
Serge Gautherie
24757e30e9 [NTDDRAW][NTGDI][VGADDI] Add missing \n to DPRINT() calls (#5952)
Add missing \n to DPRINT() calls and demote some DPRINT1().
2023-11-15 21:07:27 +01:00
Serge Gautherie
bac646f9fe [VMX_SVGA] Demote 3 DPRINT1() and define NDEBUG (#5843)
Addendum to 486e587 (r45778).
2023-11-13 11:11:10 +01:00
Andriy Shevchenko
2ea03b5b22 [REACTOS] Fix typos in comments (#5591)
Fixing typos in code comments enhances code readability and comprehension for developers and collaborators.
2023-08-22 16:20:29 +03:00
Hermès Bélusca-Maïto
5cb2b73988 [VIDEOPRT] VideoPortGetAccessRanges: Return ERROR_MORE_DATA if there exist more device access ranges that can be returned than what is specified by NumAccessRanges. 2023-06-28 17:22:01 +02:00
Hermès Bélusca-Maïto
122eaeb6ad [VIDEOPRT] VideoPortGetAccessRanges: Add doxygen doc, SAL annotations and minor formatting. 2023-06-28 17:22:00 +02:00
Hermès Bélusca-Maïto
61c77d1f87 [XBOXVMP] Real OG XBOX NVidia GPU exposes 3 access ranges, so retrieve them.
CORE-19011

Fix a "bug" I introduced in commit 61012eb54.
VideoPortGetAccessRanges() expects the caller to specify at least the
total number of ranges the hardware exposes, otherwise it fails with
ERROR_MORE_DATA. (Tested also with the help of Windows' videoprt.sys.)

On real original XBOX there are three:
```
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation NV2A [XGPU] [10de:02a0] (rev a1)
    Subsystem: Unknown [0000:0000]
    Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 03
    Memory at fd000000 (32-bit, non-prefetchable) [size=16M]
    Memory at f0000000 (32-bit, prefetchable) [size=128M]
    Memory at 00000000 (32-bit, prefetchable) [size=512K]
```

Thanks to Stanislav and Daniel for tests on the real XBOX.
2023-06-28 17:21:58 +02:00
Hermès Bélusca-Maïto
3121aee56e [VIDEOPRT] Honour NumAccessRanges == 0 / AccessRanges == NULL in VideoPortVerifyAccessRanges()
These are specified for releasing the hardware resources previously
acquired by either a previous call to VideoPortVerifyAccessRanges()
or a call to VideoPortGetAccessRanges().
2023-06-25 21:25:08 +02:00
Hermès Bélusca-Maïto
de6313d89e [VIDEOPRT] Reformat VideoPortVerifyAccessRanges()
Fix indentation, add SAL annotations and Doxygen description.
2023-06-25 21:25:07 +02:00
Hermès Bélusca-Maïto
7eca194709 [VIDEOPRT] In legacy detection, don't guess the maximum number of buses of a certain type.
Use whatever number there is on the system.
Also ensure that vpStatus is correctly initialized.
2023-06-25 21:25:07 +02:00
Victor Perevertkin
38e4b859e2 [FRAMEBUFACC] Remove the driver
This is an unfinished attempt to rewrite the driver by Magnus Olsen,
dating back to 2007.
2023-06-19 13:58:46 +03:00
Victor Perevertkin
cdb130420e [FRAMEBUF_NEW] Remove the driver
It doesn't seem to be better than the current "framebuf", and has an
unfriendly license (NT4 DDK Sample).
2023-06-19 13:58:46 +03:00
Victor Perevertkin
b9b2608bfb [FRAMEBUF] Return the "old" driver back
It has a better license (GPL) and does not have visible drawbacks
compared to framebuf_new.
2023-06-19 13:58:43 +03:00
Hermès Bélusca-Maïto
61012eb544 [XBOXVMP] Fix in VideoPortGetAccessRanges call: missing Slot parameter.
Contrary to what is (badly) written on MSDN, this parameter is
*mandatory* when the ranges looked for are on a PCI adapter.

Detected when testing with MS Windows' videoprt.sys on XBOX emulator;
thanks to Simone Lombardo for assistance!
2023-06-14 12:10:55 +02:00
hpoussin
1bdefebc9e Enable framebuf_new driver (#4775)
Replace framebuf display driver by framebuf_new display driver
Compile framebuf_new as framebuf.dll, and add it to bootcd/livecd
Remove old framebuf from compilation, to not conflict
2023-04-02 23:33:15 +09:00
Joachim Henze
83e1363065 [INF] More deduplication and style harmonization (#4952)
- deduplication of manufacturer strings
- at some places harmonizes the different length of separator lines within the same file, centers the words (as requested by hbelusca during review), harmonizes those lines to 74characters length each
- moving some strings that are not to be localized into the non-localization string section
- other minor formatting preferences coauthored by StasM
2022-12-28 02:26:17 +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
Hervé Poussineau
d117765e71 [BOCHSMP] Move related registry entries to bochsmp directory 2022-11-11 15:14:13 +01:00