Initialize a window's ThreadListEntry as an empty list on creation and only remove the window from the list on destruction, when the entry is not an empty list. Previously the window creation could fail before the list entry was initialized and the window would get destroyed after that, resulting in a NULL pointer dereference.
According to the results of CImage testcase,
the top byte of the GetPixel() return value is
zero if the return is a valid color.
Do bitwise-AND operation if the color value is valid.
CORE-19008
This will make future syncs between those files much easier,
and fixes tons of mixed tab-space-indentation.
Please no whitespace nitpicks when reviewing this commit, it is a SYNC!
The code was passing 0 instead of SECTION_INHERIT::ViewUnmap (2). 0 isn't even a proper constant to be used here. It worked, because MmMapViewOfSection only compares against ViewShare (1) and treats everything else as ViewUnmap.
Use two longs instead of one for the first parameter of EngCreateBitmap export. Make it same as win32k export.
MSDN documentation says that 1st parameter is SIZEL (SIZE) structure, which actually contains 2 longs inside. Sice it is passed by value, it needs to take enough memory when export in dxgthk and redirect to win32k (since it's actually a win32k function).
Fixes the compilation of our dxg.sys when calling dxgthk!EngCreateBitmap from it.
Found during my DirectX investigations.
I just can't stand that whitespace-diff at those 2 if-conditions any longer,
which was introduced into co_WinPosSetWindowPos() by
0.4.13-dev-8-g cfdf36e442
Everytime I port something back, I don't know where to put that diff temporarily.
And I don't want to make the older branches worse as well.
So finally squeeze it out at right-hand-side in master head.
IS_SYSTEM_MENU():
"moved" to ntuser on 6dfa71c (r68904).
IS_SYSTEM_POPUP():
uselessly added on 6fc29cc (r8195).
IS_BITMAP_ITEM():
uses removed on 07b6ddc (r23221).
uselessly copied to ntuser on 6dfa71c (r68904).
CORE-19092
Fixes the behavior of the SPI_SETFONTSMOOTHING system parameter. This also
fixes a bug when trying to select "Use the following method to smooth edges
of screen fonts" in desk.cpl.
Instead of checking if uiParam is equal to two, treat uiParam as a Boolean
that sets font smoothing on or off. This is the correct behavior according
to Microsoft documentation.
Use SpiStoreSzInt method instead of SpiStoreSz to store the value in the registry.
bmBits is only used and assigned on output. It points (holds the address)
to the array of DIB bit values. The "Bits" parameter is however a pointer
to a variable that will receive the address of that array.
So it makes no sense to initially assign bmBits to the value of the Bits
parameter...
I intend to port back the combined work of Thomas Faber and Serge Gautherie in context of CORE 14271.
Both developers fixed wrong retval evaluations for SeSinglePrivilegeCheck() and RtlCreateUnicodeString().
Both functions do return a BOOLEAN, and therefore using NTSTATUS() on them is wrong.
Those bugs have been fixed at multiple places. That is long gone.
But Serge fixed his locations a bit more elegantly, without the need for additional variables.
Therefore this addendum adapts a few of Thomas locations to the improved Serge-ified style.
Yes: I intentionally used a space instead of a minus after the mentioned CORE 14271,
as I don't want that pure stylistic addendum to be linked with the initial ticket anymore.
That would be overkill.
The "dir /w" command didn't look good due to unaligned columns.
- Add sdk/include/reactos/cjkcode.h header file.
- Add ConGetTextWidthA/W helper functions.
- Add base/shell/cmd/wcwidth.c to implement ConGetTextWidthW.
- Use ConGetTextWidth in DirPrintWideList function.
- Adjust some STRING_DIR_HELP5, STRING_DIR_HELP6 and STRING_DIR_HELP8 resource strings to make the column aligned.
CORE-17591
CORE-8394
These caused the "Ignore-next-mouse-event" mechanism of the console
(used e.g. in QuickEdit mode for not triggering the appearance of the
context menu, etc.) to not work.
Please note that these buggy events, that arise when testing ReactOS
in VirtualBox with Mouse Integration is enabled, do not show up when
running instead Windows (2003, ...) in the same configured VM.
Addendum to commits ac51557 (r63792) and 33d8a4b (r67218).
Improved fix for the one reported in PR #5406 by contributor 'whindsaks',
as it keeps the separation between the flag that manages the working-around
of the bug, and the other flag that is used for ignoring the genuine next
mouse event that follows mouse-button-down events.
Fix CLIENTINFO usermode pointer access once again.
Based on a patch by Michael Fritscher from CORE-10017.
Addendum to 7052282507 (r68702).
CORE-18728 CORE-19014
Many thanks for Simone Lombardo for pointing to the code needing attention
and providing a working proof-of-concept solution.
CORE-12377
CORE-18084
CORE-13889
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.
These are specified for releasing the hardware resources previously
acquired by either a previous call to VideoPortVerifyAccessRanges()
or a call to VideoPortGetAccessRanges().
CORE-17561, CORE-17932, CORE-18221
Do it at each system startup instead: Remove old DirectX initialization code.
It's now outdated and not needed anymore.
Previously, the corresponding hackish intEnableReactXDriver() function
did two things: load dxg.sys and enable DirectDraw.
Now loading DirectX graphics is done during WINSRV initialization, and
enabling DirectDraw is called during each (and also first) display mode
switch, as in Windows. As debug analysis proves, there are no any other
calls in NtGdiDdCreateDirectDrawObject, besides the corresponding DXG
function.
CORE-17932
[ENG] Implement DirectDraw management in switch display mode functions
(e.g. resolution change, color depth, display frequency etc.):
- Switch DirectDraw instances between the two PDEVs (the current one and
the new one allocated by ourselves) by calling dxg!DxDdDynamicModeChange
function.
- Suspend them before and resume after the display mode switch, by calling
dxg!DxDdsuspendDirectDraw and dxg!DxDdResumeDirectDraw appropriately.
We currently don't have these functions implemented, but MS DXG has, so
it allows to properly manage DirectDraw PDEVs using this driver, similarly
to Windows.
My analysis confirms that these functions are always called in XP/2k3 on
display mode switch, even when there is no any DirectX app running at the
moment. Analyzing their prototypes show that my guesses are correct.
- Initialize hDev and dhpdev members for EDD_DIRECTDRAW_GLOBAL for newly
created surfaces, switch them during mode change and re-initialize after
it also. They are commonly used by DirectDraw stack.
In addition, enable DirectDraw for old and new PDEVs, by calling
dxg!DxDdEnableDirectDraw function.
[NTDDRAW] Additionally, fix usage of DirectDraw lock count in the PDEVOBJ
structure.
- Enable cDirectDrawDisableLocks member for storing its value, instead of
DxDd_nCount, which is marked as ROS-specific.
- Use it in win32k!DxEngGet/SetHdevData for getting/setting DirectDraw
count appropriately.
My analysis also shows that in Windows, the PDEVOBJ::cDirectDrawDisableLocks
method calls DxEngGetHdevData with type 8, which corresponds to our DxDd_nCount.
So there are no doubts that this member is used there.
- Rename DxEngGetHdevData_dd_count alias of type 8 to DxEngGetHdevData_dd_locks,
to match more accurately an actual member name. Update the enumeration
and fix all code parts appropriately.
All these changes allow to properly change display mode during executing
DirectDraw applications, when they try to switch in full-screen mode.
At least a bugcheck that happened before my changes, does no longer appear.
There are still some games that don't run correctly, as if there is no
3D acceleration (which actually exists). This requires further investigations.
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!
And remove the "!NT_SUCCESS(Status)" check which is excessive, the expected
status will always be STATUS_BUFFER_TOO_SMALL anyway. This should fix
some compilation warnings spotted by GCC. Courtesy goes to Hermes for letting
me know of these warnings.
CORE-18221
Load the DirectX graphics kernel driver (dxg.sys) by win32k at WINSRV
initialization time, in NtUserInitialize(). Keep it always loaded in
memory, as on Windows, instead of loading it only by DirectX dlls.
This fixes the problem of acessing this driver: we need only to call
DxDdEnableDirectDraw() and do other stuff when DirectDraw/Direct3D is
required by anything. In other cases, it is called from win32k PDEV
functions when changing display mode (as in Windows). Since it's used
by other things too, it needs to be always loaded.
Otherwise, if it's not loaded, its APIs are not accessible when needed,
and execution fails.
For example, it fixes display mode change problem in VMWare, when a
new mode fails to be applied. Indeed, when it manages DirectDraw stuff,
it calls DXG routines, and therefore fails if dxg.sys isn't loaded
in memory at this moment.
- Implement InitializeGreCSRSS() initialization routine, that initializes
supplemental NTGDI/GRE data once CSRSS and WINSRV are loaded:
* Call DxDdStartupDxGraphics() inside it, which loads dxg.sys.
* Additionally, move fonts and language ID initialization there, from
win32k!DriverEntry. Confirmed by analysis on Windows.
- Call InitializeGreCSRSS() in NtUserInitialize() main initialization routine
(called by WINSRV initialization).
Moved to NTGDI from previously NTUSER place:
Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
- Delete the win32ksvc-ros.h file, which was not used
- Use a separate file for x64 (based on 2k3 x64 free)
- Delete w32ksvc.db. It's unused since ages.
These must use the corresponding NtUserSetWindowWord/Long function and cannot use NtUserSetWindowLongPtr, otherwise the function can fail, when there is only space for a LONG, but not for a LONG_PTR at the specified offset.
CORE-18978
Fixes NULL pointer access when e.g. class.lpszClassName == NULL and
the class is registered. The RegisterClass(ExA/W/...) should return 0
instead of throwing an invalid access exception.
However, providing an invalid pointer will trigger a crash.
The Chinese user uses Ctrl+Space key combination to switch between the IME keyboard and the non-IME keyboard. To enable Ctrl+Space, the system has to remember the previous keyboard layout. In IntImmActivateLayout function, remember the previous keyboard layout (hklPrev) to switch back for Chinese IMEs. CORE-18950
Currently, LDEVOBJ_bUnloadImage always returns FALSE due to missing functionality in ntoskrnl.
LDEVOBJ_vFreeLDEV contains an assert that driver is correctly unloaded before freeing it.
Prevent this assert by calling LDEVOBJ_vFreeLDEV only if LDEVOBJ_bUnloadImage succeed.
This can be easily triggered if DrvEnableDriver function (called in LDEVOBJ_bEnableDriver) fails.
The changes of this PR are on EDIT controls.
- Delete composition_len and composition_start members.
- Add EDIT_ImmSetCompositionWindow helper function.
- At EDIT_SetCaretPos, set the position of the composition window.
- We don't use internal composition string. Rely on the composition window.
- Improve WM_IME_STARTCOMPOSITION, WM_IME_COMPOSITION and WM_IME_ENDCOMPOSITION message handling.
CORE-11700
- Call ImmSetCompositionFontW in WM_SETFONT handling of EDIT controls if necessary.
- If the specified font is NULL, then use DEFAULT_GUI_FONT.
CORE-11700
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
fix authored by JIRA-user "TANGaming". I do suspect that the possibility of that nullptr deref was introduced on the master branch by 0.4.13-dev-962-g 4193b8d. Doug Lyons signalled his "ok" regarding the fix in chat already. CORE-18899
The scrollbar code is now finally in a good shape.
Therefore I will port the current state back today,
and for that I want to have the formatting in good shape.
No functional changes!
Supporting KLF_SETFORPROCESS flag in ActivateKeyboardLayout function.
Implement KLF_SETFORPROCESS for co_UserActivateKeyboardLayout.
Use KLF_SETFORPROCESS flag in WM_INPUTLANGCHANGEREQUEST handling.
Add co_IntSetKeyboardLayoutForProcess helper function.
And in IntShowOwnedPopups: Remove the window owner check hack as it's no longer needed.
Based on my observation, the owner of the default IME window can change and it depends on
the window that is being focused.
CORE-18659
CORE-18768
Fix for right-clicking on 'My Computer' and selecting 'explore' and there is no 'X' for the title bar in the Folders pane
Also fixes Rapps missing toolbar combo box and edit box controls that were not displayed.
This is a complete revert of #4995 (commit 7866eb2) while still retaining its fixes.
CORE-18830, CORE-18817
Co-authored-by: I_Kill_Bugs
- Add IntIsWindowSnapEnabled helper function that reads registry value WindowArrangementActive.
- Check the registry and store the value to newly-added g_bWindowSnapEnabled global variable on startup.
- Check the global variable before Window Snap.
Win+Left, Win+Right, Win+Up, and Win+Down can be disabled by registry value WindowArrangementActive.
Snapping mouse can be also disabled. CORE-16379
Move the code that creates the default IME window, from IntCreateWindow to co_UserCreateWindowEx, just before sending WM_NCCALCSIZE message.
CORE-18723 CORE-18754 CORE-18773 CORE-18785 CORE-18802 CORE-18803
The guilty commit a2c6af0 enabled the IMM mode. So we have to take care of the default IME windows.
Using IS_WND_IMELIKE against WNDS_DESTROYED window was the cause of BSoD. CORE-18777
This allows DevExpress Ribbon Notepad sample to start.
Also add a fat DPRINT1 suggested by Timo Kreuzer,
because there is a lot wrong in the code.
CORE-18091 CORE-18558
- 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
The official definition in winddi.h always returns the result in an ULONG. This works to assign to a FLOATL on x86, which is also an ULONG, but it doesn't work on any other architecture, where FLOATL is actually a FLOAT, so the assignment would convert the ULONG encoding of the FLOAT to an actual float, which gives broken results. Work around this by simply replacing the definition with a sane one in win32k.
Rotation and shearing transformation of font/text is now available. Retrial of PR #1207.
- Rename ftGdiGetTextWidth as IntGetTextDisposition and add a Y parameter.
- Apply lfEscapement values (by multiplying matrices).
- Add IntEngFillPolygon and IntEngFillBox helper functions.
CORE-11848
- Add lfWidth member into FONTGDI structure.
- Delete IntWidthMatrix function.
- Fix IntRequestFontSize behavior for processing lfWidth value.
- Apply lfWidth in GetTextMetrics and GetCharWidth.
- Ignore the XFORM values in GetTextMetrics and GetCharWidth.
CORE-11848
- Modify FONT_CACHE_ENTRY structure to use hash.
- Use hash in ftGdiGlyphCacheGet and ftGdiGlyphCacheSet functions.
- Reduce function call overheads by using FONT_CACHE_ENTRY, in getting glyph.
CORE-11848
- Use FT_Matrix instead of MATRIX in FONT_CACHE_ENTRY structure.
- Use FtMatrixFromMx and FT_Set_Transform instead of FtSetCoordinateTransform.
CORE-11848
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
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
Classic Theme: disabled "checked" checkboxes should be grey CORE-18609
and not black, like they erroneously were.
This patch does not seem to have any impact on how they are rendered
for themed ros.
Ftr: We experimented also with COLOR_GRAYTEXT instead of COLOR_BTNSHADOW
but that did result in incorrect drawing of disabled "checked" checkboxes for
the 'High Contrast' Color Schemes.
Fixes 48 failing tests of user32:CharFuncs.
Only 12 minor failing tests are left!
Thanks to Simone Mario Lombardo for the problem analysis!
CORE-18415 CORE-18452
- Delete some IntRequestFontSize function calls.
- Enable cache on font size requests.
- Add two members into FONTGDI structure, for font size cache.
CORE-15554
Fix keyboard layout icon in taskbar notification area. JIRA issue: CORE-11700, CORE-2699, CORE-18546
- Call ActivateKeyboardLayout to select the keyboard layout correctly.
- Modify WM_INPUTLANGCHANGEREQUEST parameter.
- Modify BroadcastSystemMessageW parameter.
- Revert Taskbar Notification Area MA_NOACTIVATE HACK 8344291 . This fixes Context Menu display.
- Load the "IME File" value and set the IME icon if necessary.
- Correctly implement global hooks.
- Don't set SRVINFO_CICERO_ENABLED flag because we don't have Cicero support.
- Improve UserGetSystemMetrics for SM_DBCSENABLED and SM_IMMENABLED.
- Delete useless UserIsDBCSEnabled function.
CORE-11700
A retrial of 13868ee (#4779).
- Fill the background if necessary, and set the text color and the back mode in DrawFrameControl:DFC_MENU.
- Use UITOOLS95_DrawFrameMenu in menu drawing instead of DrawFrameControl.
CORE-18515, CORE-18417
DrawFrameControl:DFC_MENU draws the monochrome image of menu arrow or checkmark. However, the function didn't draw the entire rectangle correctly when the rectangle was not a square. CORE-18417
Add caret width value to EDITSTATE structure.
To keep the same behavior as Windows Server 2003,
we need to update dwCaretWidth when EDIT_WM_SetFocus is called.
CORE-18151
Otherwise, use software pointer functions.
This fixes graphical glitches on cursor change, when the display driver
provides accelerated pointer functions (DrvSetPointerShape/DrvMovePointer),
but refuses to handle a certain cursor.
These graphical glitches may be reproduced:
- by using Voodoo driver SFFT 1.9
- by using framebuf_new.dll instead of framebuf.dll
- by using the panning driver (setting DefaultSettings.XPanning and
DefaultSettings.YPanning in registry)
Fix 'Trying to link windows to itself' on DestroyWindow. Patch by I_Kill_Bugs.
This fixes a potential BSOD 0x50 observable in the app Localizer Editor"
Alt+Shift is a useful key combination to switch the current keyboard layout. CORE-11737
- Add ID_NEXTLAYOUT command to kbswitch.
- Send command ID_NEXTLAYOUT to kbswitch on Alt+Shift key combination in WM_SYSKEYDOWN handling of IntDefWindowProc function.
- Make IntFindWindow a non-static function.
- Fix IntLoadKeyboardLayout function to return the correct HKL value.
- Modify LAYOUT_LIST_NODE structure to add more information.
- Fix LayoutList_GetByHkl function to choose the IME HKLs correctly.
- Ignore DELETED entries correctly.
- Improve UI/UX.
CORE-11700, CORE-13244, CORE-18364
- Add IntLoadPreloadKeyboardLayouts helper function to load the layouts on log-on.
- In UpdatePerUserSystemParameters function, call CliImmInitializeHotKeys and IntLoadPreloadKeyboardLayouts functions.
CORE-16600
To recognize IME, we have to initialize pKL->piiex.
- Add co_ClientImmLoadLayout and User32CallImmLoadLayoutFromKernel functions to call imm32!ImmLoadLayout on user mode from kernel.
- Use co_ClientImmLoadLayout in NtUserLoadKeyboardLayoutEx.
- Improve Imm32LoadIME to sanitize the IME table.
CORE-11700
- Move struct _TL and TL definitions from win32.h to ntuser.h.
- Modify the type of TL.pfnFree as newly-defined TL_FN_FREE function pointer.
CORE-11700
The current Shift+Alt handling is buggy. The keyboard won't work frequently.
It dislikes system-side Alt (VK_MENU) key handling.
It seems like Shift+Alt handling should be in kernel.
CORE-10667