https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9021a14f4af8eff8cf990…
commit 9021a14f4af8eff8cf990a2812876505a10c0887
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sat Oct 7 22:11:39 2023 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Oct 8 17:11:25 2023 +0200
[NDK] Fix weird "ntstatus.s" statement (#5771)
Spotted by Serge Gautherie.
---
sdk/include/ndk/readme.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sdk/include/ndk/readme.txt b/sdk/include/ndk/readme.txt
index 0b67c2dd0bc..b9fe54b90d7 100644
--- a/sdk/include/ndk/readme.txt
+++ b/sdk/include/ndk/readme.txt
@@ -172,7 +172,7 @@ remain anonymous, simply do not include this statement.
* User Mode Application requiring Native Types:
- #define WIN32_NO_STATUS /* Tell Windows headers you'll use ntstatus.s from NDK */
+ #define WIN32_NO_STATUS /* Tell Windows headers you'll use ntstatus.h from PSDK */
#include "windows.h" /* Declare Windows Headers like you normally would */
#include "ntndk.h" /* Declare the NDK Headers */
@@ -188,7 +188,7 @@ remain anonymous, simply do not include this statement.
* You may also include only the files you need (example for User-Mode application):
- #define WIN32_NO_STATUS /* Tell Windows headers you'll use ntstatus.s from NDK */
+ #define WIN32_NO_STATUS /* Tell Windows headers you'll use ntstatus.h from PSDK */
#include "windows.h" /* Declare Windows Headers like you normally would */
#include "rtlfuncs.h" /* Declare the Rtl* Functions */
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce08851758fa938650fd3…
commit ce08851758fa938650fd3faae7d9b2ef499175e1
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Oct 5 22:41:16 2023 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sat Oct 7 22:17:58 2023 +0200
[DESK] Use MultiByteToWideChar instead of the private pSetupMultiByteToUnicode function (#5765)
This avoids having desk.cpl depend on a private function that may change
or disappear, and increase the probability of being able to use that CPL
across different Windows versions.
(Note: this pSetupMultiByteToUnicode was one of those whose name changed
between Windows 2000 and XP+)
---
dll/cpl/desk/desk.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/dll/cpl/desk/desk.c b/dll/cpl/desk/desk.c
index 7a34e2420b4..0bbfc7a4a0e 100644
--- a/dll/cpl/desk/desk.c
+++ b/dll/cpl/desk/desk.c
@@ -8,8 +8,11 @@
*/
#include "desk.h"
+
#include <shellapi.h>
#include <cplext.h>
+#include <winnls.h>
+
#include <debug.h>
#define NUM_APPLETS (1)
@@ -364,6 +367,7 @@ InstallScreenSaverA(
IN UINT nCmdShow)
{
LPWSTR lpwString;
+ int nLength;
if (!pszFile)
{
@@ -371,16 +375,32 @@ InstallScreenSaverA(
SetLastError(ERROR_INVALID_PARAMETER);
return;
}
- DPRINT("InstallScreenSaver() Install from file %s\n", pszFile);
- lpwString = pSetupMultiByteToUnicode(pszFile, 0);
+
+ /* Convert the string to unicode */
+ lpwString = NULL;
+ nLength = MultiByteToWideChar(CP_ACP, 0, pszFile, -1, NULL, 0);
+ if (nLength != 0)
+ {
+ lpwString = LocalAlloc(LMEM_FIXED, nLength * sizeof(WCHAR));
+ if (lpwString)
+ {
+ if (!MultiByteToWideChar(CP_ACP, 0, pszFile, -1, lpwString, nLength))
+ {
+ LocalFree(lpwString);
+ lpwString = NULL;
+ }
+ }
+ }
if (!lpwString)
{
DPRINT("InstallScreenSaver() not enough memory to convert string to unicode\n");
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return;
}
+
+ /* Call the unicode function */
InstallScreenSaverW(hWindow, hInstance, lpwString, nCmdShow);
- MyFree(lpwString);
+
+ LocalFree(lpwString);
}
BOOL WINAPI
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e685b25e35c9d6dfbe213…
commit e685b25e35c9d6dfbe2139ac71f7378b1f9e6d0f
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Thu Sep 28 20:29:43 2023 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Oct 7 10:58:30 2023 +0300
[NTOS:MM/x64] Temporarily release AddressCreationLock in MmCreateVirtualMappingUnsafeEx
This is a hack, because the kernel mode path can incur a recursive page fault with the AddressCreationLock acquired, which would lead to a recursive acquisition, once we do proper locking in MmAccessFault.
To properly fix this the PDE must be made valid, similar to the user mode path, but that is not that simple...
---
ntoskrnl/mm/i386/page.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/ntoskrnl/mm/i386/page.c b/ntoskrnl/mm/i386/page.c
index df13cb013e2..eeccef94346 100644
--- a/ntoskrnl/mm/i386/page.c
+++ b/ntoskrnl/mm/i386/page.c
@@ -637,6 +637,9 @@ MmCreateVirtualMappingUnsafeEx(
PMMPTE PointerPte;
MMPTE TempPte;
ULONG_PTR Pte;
+#ifdef _M_AMD64
+ BOOLEAN LockReleased = FALSE;
+#endif
DPRINT("MmCreateVirtualMappingUnsafe(%p, %p, %lu, %x)\n",
Process, Address, flProtect, Page);
@@ -665,6 +668,15 @@ MmCreateVirtualMappingUnsafeEx(
if (!MiSynchronizeSystemPde(MiAddressToPde(Address)))
MiFillSystemPageDirectory(Address, PAGE_SIZE);
#endif
+
+#ifdef _M_AMD64
+ /* This is a temporary hack, because we can incur a recursive page fault when accessing the PDE */
+ if (PsIdleProcess->AddressCreationLock.Owner == KeGetCurrentThread())
+ {
+ MmUnlockAddressSpace(MmGetKernelAddressSpace());
+ LockReleased = TRUE;
+ }
+#endif
}
else
{
@@ -715,6 +727,15 @@ MmCreateVirtualMappingUnsafeEx(
MiIncrementPageTableReferences(Address);
MiUnlockProcessWorkingSetUnsafe(Process, PsGetCurrentThread());
}
+#ifdef _M_AMD64
+ else
+ {
+ if (LockReleased)
+ {
+ MmLockAddressSpace(MmGetKernelAddressSpace());
+ }
+ }
+#endif
return(STATUS_SUCCESS);
}
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d96b3cd45c888d7e37c92…
commit d96b3cd45c888d7e37c9207dbb44321fc47bfec9
Author: Oleg Dubinskiy <oleg.dubinskij30(a)gmail.com>
AuthorDate: Fri Oct 6 12:36:09 2023 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Oct 6 12:36:09 2023 +0200
[KS] Fix bug in KsStreamIo (#4663)
Properly set output buffer length in IO Stack Location of the current IRP, since it is passed to KsProbeStreamIrp when calling KsStreamIo, so it fails if the length isn't set properly.
Don't set an input buffer length and the buffer itself, since it isn't passed anywhere, so setting it makes no sense. Moreover, MSDN says that for IOCTL_KS_READ/WRITE_STREAM, only output buffer (and its length) is needed to be set, but not an input one. So it indeed is more correct.
It fixes buffer overflow in KsProbeStreamIrp when attempting to perform the streaming via KsStreamIo. I discovered this bug during my audio refactoring from PR #4660.
---
drivers/ksfilter/ks/irp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/ksfilter/ks/irp.c b/drivers/ksfilter/ks/irp.c
index ab5d1b21523..91302e67299 100644
--- a/drivers/ksfilter/ks/irp.c
+++ b/drivers/ksfilter/ks/irp.c
@@ -634,8 +634,7 @@ KsStreamIo(
IoStack = IoGetNextIrpStackLocation(Irp);
/* setup stack parameters */
IoStack->FileObject = FileObject;
- IoStack->Parameters.DeviceIoControl.InputBufferLength = Length;
- IoStack->Parameters.DeviceIoControl.Type3InputBuffer = StreamHeaders;
+ IoStack->Parameters.DeviceIoControl.OutputBufferLength = Length;
IoStack->Parameters.DeviceIoControl.IoControlCode = (Flags == KSSTREAM_READ ? IOCTL_KS_READ_STREAM : IOCTL_KS_WRITE_STREAM);
if (CompletionRoutine)