Commit graph

83503 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto 7b53126375
[TASKMGR] Completely reformat perfpage.c, perfpage.h, procpage.h and trayicon.c
- Rename also these stupidly long "hPerformancePageBlablabla" variables.
- Remove unnecessary global variables in procpage.c/h.
2023-06-15 12:44:13 +02:00
Hermès Bélusca-Maïto da7dcec6a0
[TASKMGR] Reformat the files' headers. Add Valerij in graphctl.c/h who rewrote most of the graph control. 2023-06-15 12:44:01 +02:00
Hermès Bélusca-Maïto 3fc702b588
Revert "[TASKMGR] Follow-up of 'Refactor trayicon.c' (99fb812)"
This reverts commit ec93c2340d.

Revert "[TASKMGR] Refactor trayicon.c"

This reverts commit 99fb812be4.
2023-06-15 12:43:36 +02:00
Katayama Hirofumi MZ 36aea8e56e [TASKMGR] affinity.c: Use _countof instead of sizeof/sizeof
CORE-18991
2023-06-15 16:22:43 +09:00
Katayama Hirofumi MZ 9a6c85f68a [TASKMGR] Fix PerfDataDeallocCommandLineCache
Do not leak memory. CORE-18014
2023-06-15 15:36:19 +09:00
Katayama Hirofumi MZ 7989e3f26c [TASKMGR] GraphCtrl_Dispose: Delete hdcGraph first
The pen might be selected at GraphCtrl_Dispose.
Do not delete a drawing object (pen or brush) while it is still selected into a DC.
CORE-18014
2023-06-15 15:14:32 +09:00
Katayama Hirofumi MZ dc14a9f6e0 [TASKMGR] GraphCtrl: Use DeleteDC instead of DeleteObject to delete inst->hdcGraph
This reduces handle leak.
CORE-18014
2023-06-15 14:55:25 +09:00
Katayama Hirofumi MZ 2441e86963
[TASKMGR] Report any memory leaks on exit (#5340)
Use the power of CRT debug to detect memory leaks.
- Define _CRTDBG_MAP_ALLOC and include <crtdbg.h> after <stdlib.h>.
- Call _CrtSetDbgFlag at prologue of wWinMain.
CORE-18014
2023-06-15 14:27:06 +09:00
Katayama Hirofumi MZ ec93c2340d [TASKMGR] Follow-up of 'Refactor trayicon.c' (99fb812) 2023-06-15 14:18:45 +09:00
Katayama Hirofumi MZ 99fb812be4 [TASKMGR] Refactor trayicon.c 2023-06-15 13:26:20 +09:00
Katayama Hirofumi MZ ad61c574f4 [MSPAINT] Fix two handle leaks
CORE-18867
2023-06-15 10:55:59 +09:00
Katayama Hirofumi MZ 5675604d28 [MSPAINT] CMiniatureWindow: Avoid too small
CORE-18867
2023-06-14 20:17:49 +09: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
Katayama Hirofumi MZ bfd42c67a1
[MSPAINT] Improve CMiniatureWindow (#5337)
- Save the position and size of the miniature window.
- Improve drawing of the miniature window.
- Sync with the canvas.
CORE-18867
2023-06-14 18:51:40 +09:00
Hermès Bélusca-Maïto 113656563a
[HALX86] Minor fixes in HaliFindBusAddressTranslation()
- Remove ContextValue variable. This variable erroneously truncated
  *Context value (that can contain a pointer value) to 32 bits.

- Gracefully fail instead of asserting.
2023-06-14 11:27:24 +02:00
Hermès Bélusca-Maïto 4f41000714
[FLOPPY] "zero" parameters in IoQueryDeviceDescription() call are NULL pointers. 2023-06-14 11:24:47 +02:00
Hermès Bélusca-Maïto 84b4a80beb
[NTOS:IO] Fix some bugs in the IoQueryDeviceDescription helpers (#5320)
- Add missing ExAllocatePool NULL checks.

- Fix order of KeBugCheckEx parameters for PNP_DETECTED_FATAL_ERROR.

- The Controller and Peripheral numbers are zero-based, so if the caller
  wants to inspect controller (or peripheral) zero, let it be so!
  The original code was treating controller number zero for enumerating
  controllers of a given class within the different buses, which is
  wrong. See the diff'ed trace below.
  Tested with Windows' videoprt.sys VideoPortGetDeviceData().

```diff
 IoQueryDeviceDescription()
     BusType:          0xB093C224 (0)
     BusNumber:        0xB093C228 (0)
     ControllerType:   0xF9D01030 (19)
     ControllerNumber: 0xF9D01038 (0)
     PeripheralType:   0x00000000 (4294967295)
     PeripheralNumber: 0x00000000 (4294967295)
     CalloutRoutine:   0xF9CF74E4
     Context:          0xF9D5A340
 --> Query: 0xF9D5A22C

 IopQueryBusDescription(Query: 0xF9D5A22C)
     RootKey: '\REGISTRY\MACHINE\HARDWARE\DESCRIPTION\SYSTEM'
     RootKeyHandle: 0x00000598
     KeyIsRoot: TRUE
     Bus: 0xF9D5A290 (4294967295)
     Seen: 'CentralProcessor'
     Seen: 'FloatingPointProcessor'
     Seen: 'MultifunctionAdapter'
     SubRootRegName: '\REGISTRY\MACHINE\HARDWARE\DESCRIPTION\SYSTEM\MultifunctionAdapter'

 IopQueryBusDescription(Query: 0xF9D5A22C)
     RootKey: '\REGISTRY\MACHINE\HARDWARE\DESCRIPTION\SYSTEM\MultifunctionAdapter'
     RootKeyHandle: 0x00000590
     KeyIsRoot: FALSE
     Bus: 0xF9D5A290 (4294967295)
     Seen: '0'
     SubRootRegName: '\REGISTRY\MACHINE\HARDWARE\DESCRIPTION\SYSTEM\MultifunctionAdapter\0'
     Getting bus value: 'Identifier'
     Getting bus value: 'Configuration Data'
     Getting bus value: 'Component Information'
     --> Getting device on Bus #0 : '\REGISTRY\MACHINE\HARDWARE\DESCRIPTION\SYSTEM\MultifunctionAdapter\0'

 IopQueryDeviceDescription(Query: 0xF9D5A22C)
     RootKey: '\REGISTRY\MACHINE\HARDWARE\DESCRIPTION\SYSTEM\MultifunctionAdapter\0'
     RootKeyHandle: 0x00000590
     Bus: 0
-    Enumerating controllers in '\REGISTRY\MACHINE\HARDWARE\DESCRIPTION\SYSTEM\MultifunctionAdapter\0\DisplayController'...
+    Getting controller #0
+    Retrieving controller '\REGISTRY\MACHINE\HARDWARE\DESCRIPTION\SYSTEM\MultifunctionAdapter\0\DisplayController\0'
```
2023-06-14 11:20:56 +02:00
Katayama Hirofumi MZ 318b2e786d [MSPAINT] Trivial improvements
- Use SetPixelV instead of SetPixel.
- BI_RGB is zero.
- Use CS_HREDRAW and CS_VREDRAW.
CORE-18867
2023-06-14 17:42:21 +09:00
Katayama Hirofumi MZ 3b4422b41b [MSPAINT] drawing.cpp: Refactor Erase, Replace and Airbrush 3
CORE-18867
2023-06-14 17:14:41 +09:00
Katayama Hirofumi MZ 0334498068 [MSPAINT] drawing.cpp: Refactor Erase, Replace and Airbrush 2
CORE-18867
2023-06-14 17:03:22 +09:00
Katayama Hirofumi MZ 78c8df8393 [MSPAINT] drawing.cpp: Refactor Erase, Replace and Airbrush
CORE-18867
2023-06-14 16:44:54 +09:00
Katayama Hirofumi MZ 6d9b7f77ad [MSPAINT] mouse.cpp: Use override keywords
CORE-18867
2023-06-14 16:01:10 +09:00
Katayama Hirofumi MZ 2b623c1d04
[MSPAINT] Refactor ImageModel (#5335)
- Unify ImageModel::Insert and ImageModel::CopyPrevious to ImageModel::PushImageForUndo.
- Delete useless stuffs.
- Fix some memory leaks.
- Fix IDM_IMAGECROP.
CORE-17969, CORE-18867
2023-06-13 23:23:48 +09:00
Katayama Hirofumi MZ 70f897e4c9 [FONTVIEW] Add Japanese translation (ja-JP) 2023-06-13 22:04:44 +09:00
Stanislav Motylkov 8d8e81ee7a [FONTVIEW] Update Russian (ru-RU) translation
Addendum to 5ef3f347. CORE-18952
2023-06-13 14:40:46 +03:00
Nikita Piatygorskiy 5ef3f347ad
[FONTVIEW] Make hardcoded messages localizable (#5305)
- Move messages from OnInstall procedure to en-US resource file.
- Applied the same changes to all language files, now it's available
  for translation into other languages.

CORE-18952

Signed-off-by: Nikita Piatygorskiy <generalhammond16@gmail.com>
2023-06-13 14:12:26 +03:00
Stanislav Motylkov 2e836fb339 [FONTVIEW] Formatting only (for PR #5305) 2023-06-13 12:44:46 +03:00
Katayama Hirofumi MZ fa4c3bd560 [MSPAINT] s/HasUndoSteps/CanUndo/ and s/HasRedoSteps/CanRedo/
CORE-18867
2023-06-13 18:24:42 +09:00
Katayama Hirofumi MZ 1a88607387
[MSPAINT] Move selection by arrow keys (#5334)
Improve keyboard usability.
- Add CCanvasWindow::MoveSelection.
- Modify CMainWindow::OnKeyDown.
- If Esc key is pressed, then the selection will land to canvas.
- If any arrow key is pressed, then the selection will move a bit.
CORE-18867
2023-06-13 16:31:18 +09:00
Katayama Hirofumi MZ 0087ea6597 [MSPAINT] Set CC_RGBINIT to CMainWindow::ChooseColor
It had failed to set initial color. CORE-18867
2023-06-13 15:51:52 +09:00
Katayama Hirofumi MZ cb245ff711 [MSPAINT] Scrolled canvas has defects in dragging a selection
CORE-18990, CORE-18867
2023-06-13 14:57:59 +09:00
Katayama Hirofumi MZ 62b6859a67 [MSPAINT] Follow-up of #5332 (9ff9580)
Simplify the epilogue code of CCanvasWindow::OnSetCursor by using bHandle variable. CORE-18867
2023-06-13 14:18:12 +09:00
Jose Carlos Jesus 9ff9580fb0
[MSPAINT] Fix the type of cursor displayed when overlaying scrollbars (#5332)
When the window size is smaller than the image size in both directions, the wrong cursor is displayed when hovering the mouse over the scrollbars.

Readjust position for file date and file size objects, to fit all text.

CORE-18867
2023-06-13 13:01:39 +09:00
Thamatip Chitpong 3da25b73c2
[MMSYS] Use PWSTR instead of PWCHAR for string (#5333)
Use PWSTR instead of PWCHAR for string
Constify some function arguments
2023-06-12 21:52:56 +02:00
Katayama Hirofumi MZ 83762575e1 [MSPAINT] Add (CS_HREDRAW | CS_VREDRAW) style to CCanvasWindow
Reduce repainting defects. CORE-18867
2023-06-12 21:12:37 +09:00
Joachim Henze d3164a0f55
[SHELL32] Strip leftover in CDefView::FillFileMenu() (#5330)
In 0.4.14-dev-955-g 1cf564c25f
Katayama experimented with populating explorers file-menu when no object is selected.

Later we found out, that none of the new entries introduced by that commit really
made sense and even created duplicates. So the commit was reverted by
0.4.15-dev-6039-g 0fa4edebd9 'Revert CDefView::FillFileMenu (#5278)' CORE-18429

But it seems that not all parts were properly reverted back then,
maybe because 6 lines of new code were written between the two lines in the meantime.
2023-06-11 20:53:25 +02:00
George Bișoc 0f9be53985
[WIN32K:NTUSER] Fix an unintialized user's token variable case
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.
2023-06-11 18:14:02 +02:00
Stanislav Motylkov 7d5e159131 [NTOS:PNP] Assign correct PnP IDs to the devices detected by bootloader
Based on a commit by Vadim Galyant:
5ef5c11e7f

Also fix a minor type conversion warning. CORE-18963 CORE-17977

Co-authored-by: Vadim Galyant <vgal@rambler.ru>
2023-06-11 16:19:02 +03:00
Oleg Dubinskiy 114bc2b96e
[NTGDI][NTUSER] Load DirectX graphics driver at system startup (#4551)
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>
2023-06-11 13:44:56 +02:00
Sophie Lemos 29a706fc5a [NTOS:PNP] Fix bug causing all devices be considered as already existing
We should compare against DeviceObject as DeviceInstance is never NULL.
Fix a resource leak as well. The bug CORE-18983 seems to lay somewhere
else though, I just stumbled upon this one while researching it.

Note there is a BSOD in the PnP manager on reboot after the driver
installation failure, but it seems it was uncovered by the fix
as opposed to caused by it.
2023-06-11 13:13:11 +03:00
Andrei Miloiu fa388640ca
[GETUNAME] Update Romanian translation (#5323) 2023-06-10 20:03:23 +00:00
Andrei Miloiu 0887c1c040
[GETUNAME] Update Romanian translation (#5323) 2023-06-10 21:47:35 +02:00
Jose Carlos Jesus ed22908780
[MSPAINT] Update Portuguese (pt-PT) translation (#5319) 2023-06-10 16:21:54 +00:00
Milan Raymakers 4782c314d4 [TRANSLATION] Improve Dutch (nl-NL) translation (#4765)
- [NOTEPAD] Improve Dutch (nl-NL) translation
- [TASKMGR] Improve Dutch (nl-NL) translation
- [WELCOME] Improve Dutch (nl-NL) translation
- [EXPLORER] Improve Dutch (nl-NL) translation

Reviewed-by: Mark Jansen <mark.jansen@reactos.org>
2023-06-10 18:32:03 +03:00
Eric Kohl c3db5e9c8e [ADVAPI32][SECLOGON] CreateProcessWithLogonW: Pass the environment to the callee 2023-06-10 14:10:14 +02:00
George Bișoc 59e74584ac
[NTOS:SE] Refactor SeTokenCanImpersonate
- Refactor most of the code, since there's quite some stuff that don't make much sense.
For instance ImpersonationLevel is basically the requested impersonation level a
server asks for. PsImpersonateClient doesn't explicitly say that SecurityAnonymous
and SecurityIdentification are not allowed. If the server was to give such levels
it simply means it doesn't want to impersonate the client.

Another thing that doesn't make much sense is that we check if the client is
associated with an anonymous token, then avoid impersonating regular anonymous
tokens that weren't created by the system. Only system can create such tokens
and an anonymous token basically means a token with hidden security info.

- Check that the server is within the same client logon session.

- If the server is granted the SeImpersonatePrivilege privilege, allow impersonation
regardless of the conditions we want to check for.

- Update the documentation and code comments.
2023-06-09 11:53:56 +02:00
George Bișoc 8e2fe925f2
[NTOS:PS] Do not reference the copied token twice and properly assign the impersonation level in case the server can't impersonate
As it currently stands the PsImpersonateClient routine does the following approach.
If impersonation couldn't be granted to a client the routine will make a copy
of the client's access token. As it makes a copy of the said token PsImpersonateClient
will reference the copied token after impersonation info have been filled out.
In the same code path we are assigning the desired level for impersonation to thread
impersonation info.

This is wrong for two reasons:

- On a copy situation the SeCopyClientToken routine holds a reference as the object
has been created. Referencing it at the bottom of the PsImpersonateClient routine
will make it that the token is referenced twice and whenever a server stops
impersonation the token still has an extra reference count which keeps the token
still alive in object database and memory space.

- If client impersonation is not possible the thread impersonation info should
have been assigned SecurityIdentification level to further indicate that the
actual impersonation of the thread is not currently in force but instead we
are assigning the impersonation level that is supplied by the caller. For instance
if the requested level is SecurityDelegation but impersonation is not possible
the level will be assigned that of SecurityDelegation yet the token has an
impersonation level of SecurityIdentification. This could lead to erratic behaviors
as well as potential impersonation escalation.

Fix the aforementioned issues by avoiding a double reference and properly assign
the impersonation level to SecurityIdentification if the server is not able to
impersonate the target client.
2023-06-09 11:53:55 +02:00
George Bișoc f483e42f89
[NTOS:SE] Grant the SYSTEM process the missing privileges
- Add the missing privileges to the SYSTEM privileges which might be needed,
notably SeUndockPrivilege, SeManageVolumePrivilege, SeCreateGlobalPrivilege and
SeImpersonatePrivilege.

Specifically SeImpersonatePrivilege is important here because with it we
allow system components of the core OS to perform certain system tasks.

- Declare the Groups array with a maximum of 3 elements in SepCreateSystemProcessToken
and 1 element in SepCreateSystemAnonymousLogonToken respectively, because previously
this array was oversized with most of free space left as a waste.

- Avoid hardcoding the size value of the Privilege array, instead initialize it
by hand and compute the exact number of elements with RTL_NUMBER_OF.
2023-06-09 11:53:51 +02:00
George Bișoc d8bfe2a261
[GITHUB] Draft PRs should be exempt from closure by the stale PR bot 2023-06-09 11:43:04 +02:00
George Bișoc 56a450147c
[GITHUB] Temporarily disable MSBuild
Due to a update of MSBuild build worker, MSBuild keeps failing which is a nuisance.
Temporarily disable that worker until a proper fix is shipped.

CORE-18911
2023-06-06 20:06:01 +02:00