https://git.reactos.org/?p=reactos.git;a=commitdiff;h=731eddfe40a0ae641a6a4…
commit 731eddfe40a0ae641a6a4b99273a9564a5b4ddc0
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sat Oct 17 16:40:50 2020 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Fri Oct 30 01:58:16 2020 +0100
[BASESRV] Re-enable and actually fix the CsrValidateMessageBuffer() checks in BaseSrvDefineDosDevice(). (#3304)
Addendum to commit 0a392b18.
The actual problem that existed all along was that the buffers being
validated with CsrValidateMessageBuffer() were not the correct ones!
What had to be checked is the string buffer **INSIDE** the UNICODE_STRING
structures! Indeed, it is these buffers that we are allocating on client side,
see https://github.com/reactos/reactos/blob/9b421af1/dll/win32/kernel32/client/…
Dedicated to Pierre Schweitzer.
---
subsystems/win/basesrv/dosdev.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/subsystems/win/basesrv/dosdev.c b/subsystems/win/basesrv/dosdev.c
index 958dceca8ee..85cb0d79b57 100644
--- a/subsystems/win/basesrv/dosdev.c
+++ b/subsystems/win/basesrv/dosdev.c
@@ -514,22 +514,21 @@ CSR_API(BaseSrvDefineDosDevice)
PWSTR InterPtr;
BOOLEAN RemoveFound;
-#if 0
- /* FIXME: Check why it fails.... */
if (!CsrValidateMessageBuffer(ApiMessage,
- (PVOID*)&DefineDosDeviceRequest->DeviceName,
+ (PVOID*)&DefineDosDeviceRequest->DeviceName.Buffer,
DefineDosDeviceRequest->DeviceName.Length,
- 1) ||
+ sizeof(BYTE)) ||
(DefineDosDeviceRequest->DeviceName.Length & 1) != 0 ||
!CsrValidateMessageBuffer(ApiMessage,
- (PVOID*)&DefineDosDeviceRequest->TargetPath,
- (DefineDosDeviceRequest->TargetPath.Length != 0 ? sizeof(UNICODE_NULL) : 0) + DefineDosDeviceRequest->TargetPath.Length,
- 1) ||
+ (PVOID*)&DefineDosDeviceRequest->TargetPath.Buffer,
+ DefineDosDeviceRequest->TargetPath.Length +
+ (DefineDosDeviceRequest->TargetPath.Length != 0
+ ? sizeof(UNICODE_NULL) : 0),
+ sizeof(BYTE)) ||
(DefineDosDeviceRequest->TargetPath.Length & 1) != 0)
{
return STATUS_INVALID_PARAMETER;
}
-#endif
DPRINT("BaseSrvDefineDosDevice entered, Flags:%d, DeviceName:%wZ (%d), TargetPath:%wZ (%d)\n",
DefineDosDeviceRequest->Flags,
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f4279fc356df67bce5cfe…
commit f4279fc356df67bce5cfefa7b29fb05e722e5b00
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Fri Oct 30 01:08:23 2020 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Fri Oct 30 01:55:16 2020 +0100
[CSRSRV] Clarify few comments, and use MAXULONG.
---
subsystems/win32/csrsrv/api.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/subsystems/win32/csrsrv/api.c b/subsystems/win32/csrsrv/api.c
index 62bb06b3eba..a0b3de17c55 100644
--- a/subsystems/win32/csrsrv/api.c
+++ b/subsystems/win32/csrsrv/api.c
@@ -1240,7 +1240,7 @@ CsrCaptureArguments(IN PCSR_THREAD CsrThread,
BufferDistance = (ULONG_PTR)ServerCaptureBuffer - (ULONG_PTR)ClientCaptureBuffer;
/*
- * All the pointer offsets correspond to pointers which point
+ * All the pointer offsets correspond to pointers that point
* to the server data buffer instead of the client one.
*/
// PointerCount = ServerCaptureBuffer->PointerCount;
@@ -1355,7 +1355,7 @@ CsrReleaseCapturedArguments(IN PCSR_API_MESSAGE ApiMessage)
BufferDistance = (ULONG_PTR)ServerCaptureBuffer - (ULONG_PTR)ClientCaptureBuffer;
/*
- * All the pointer offsets correspond to pointers which point
+ * All the pointer offsets correspond to pointers that point
* to the client data buffer instead of the server one (reverse
* the logic of CsrCaptureArguments()).
*/
@@ -1438,7 +1438,7 @@ CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage,
* of non-trivial size and that we don't overflow.
*/
if (!Buffer || ElementSize == 0 ||
- (ULONGLONG)ElementCount * ElementSize > (ULONGLONG)0xFFFFFFFF)
+ (ULONGLONG)ElementCount * ElementSize > (ULONGLONG)MAXULONG)
{
return FALSE;
}
@@ -1451,10 +1451,7 @@ CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage,
/* Check if we have no capture buffer */
if (!CaptureBuffer)
{
- /*
- * In this case, check only the Process ID
- * and if there is a match, we succeed.
- */
+ /* In this case, succeed only if the caller is CSRSS */
if (NtCurrentTeb()->ClientId.UniqueProcess ==
ApiMessage->Header.ClientId.UniqueProcess)
{
@@ -1463,7 +1460,7 @@ CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage,
}
else
{
- /* Make sure that there is still space left in the buffer */
+ /* Make sure that there is still space left in the capture buffer */
if ((CaptureBuffer->Size - (ULONG_PTR)*Buffer + (ULONG_PTR)CaptureBuffer) >=
(ElementCount * ElementSize))
{
@@ -1473,8 +1470,8 @@ CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage,
while (PointerCount--)
{
/*
- * The pointer offset must be equal to the delta between
- * the addresses of the buffer and of the API message.
+ * Find in the array, the pointer offset (from the
+ * API message) that corresponds to the buffer.
*/
if (*OffsetPointer == BufferDistance)
{
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b2cf5a4c03a31b48b6167…
commit b2cf5a4c03a31b48b6167aeba3465ff33b866c5f
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Mon Oct 26 18:11:55 2020 +0100
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Mon Oct 26 18:13:50 2020 +0100
Revert "[CMAKE] Make unattended bootcd configurable via cmake"
This reverts commit cfd4ef9384eb1f2b55a5b195ee39475f015c8a7c.
This was way more controversial than I would have thought
---
boot/bootdata/CMakeLists.txt | 2 +-
boot/bootdata/bootcd/CMakeLists.txt | 42 ----------------------
.../bootcd/{unattend.inf.in => unattend.inf} | 30 ++++++++--------
3 files changed, 16 insertions(+), 58 deletions(-)
diff --git a/boot/bootdata/CMakeLists.txt b/boot/bootdata/CMakeLists.txt
index 90a54bdc60b..f1e6153f8a7 100644
--- a/boot/bootdata/CMakeLists.txt
+++ b/boot/bootdata/CMakeLists.txt
@@ -1,6 +1,5 @@
add_subdirectory(packages)
-add_subdirectory(bootcd)
# Common hives
@@ -62,6 +61,7 @@ add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/hybridcd.ini DESTINATION root NAME_
# Unattend
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcdregtest/unattend.inf DESTINATION reactos NO_CAB FOR regtest)
+add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd/unattend.inf DESTINATION reactos NO_CAB FOR bootcd)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/livecd/unattend.inf DESTINATION reactos NO_CAB FOR livecd)
# LiveCD shortcuts
diff --git a/boot/bootdata/bootcd/CMakeLists.txt b/boot/bootdata/bootcd/CMakeLists.txt
deleted file mode 100644
index 8c164f7b687..00000000000
--- a/boot/bootdata/bootcd/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-set(UNATTENDED_BOOTCD "no" CACHE STRING "Whether to build a self-installing bootcd (yes/no)")
-
-function(add_unattended_bootcd_option _var _default _doc)
- if (UNATTENDED_BOOTCD STREQUAL "yes")
- set(${_var} "${_default}" CACHE STRING ${_doc})
- endif()
-endfunction()
-
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_DestinationDiskNumber "0"
- "The Disk Number ReactOS will be installed on during bootcd unattended setup")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_DestinationPartitionNumber "1"
- "The Partition Number ReactOS will be installed on during bootcd unattended setup")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_InstallationDirectory "ReactOS"
- "The directory ReactOS will be installed in during bootcd unattended setup")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_MBRInstallType "2"
- "MBR installation type during bootcd unattended setup: 0: skip, 1: On floppy, 2: On HDD")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_FullName "MyName"
- "The user name used for unattended bootcd installation")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_OrgName ""
- "The organisation name used for unattended bootcd installation (None if empty)")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_ComputerName "MYCOMPUTERNAME"
- "The computer name used for unattended bootcd installation")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_AdminPassword ""
- "The administrator password used for unattended bootcd installation (None if empty)")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_FormatPartition "1"
- "Whether to format the partition during bootcd unattended setup. 0: Don't format, 1: Format)")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_AutoPartition "1"
- "Whether to automatically create the partition during bootcd unattended setup. 0: Don't create partition, 1: Create partition")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_FsType "0"
- "The filesystem used during bootcd unattended setup. 0: FAT, 1: BTRFS")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_DisableGeckoInst "no"
- "Whether to disable the Gecko module installation. (yes/no)")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_LocaleID "409"
- "The locale used during bootcd unattended setup. See hivesys.inf for values")
-add_unattended_bootcd_option(UNATTENDED_BOOTCD_ProductOption "0"
- "The product installed during bootcd unattended setup. 0: Server, 1: WorkStation")
-
-if (UNATTENDED_BOOTCD STREQUAL "yes")
- configure_file(unattend.inf.in unattend.inf @ONLY)
- add_cd_file(FILE ${CMAKE_CURRENT_BINARY_DIR}/unattend.inf DESTINATION reactos NO_CAB FOR bootcd)
-endif()
-
diff --git a/boot/bootdata/bootcd/unattend.inf.in b/boot/bootdata/bootcd/unattend.inf
similarity index 67%
rename from boot/bootdata/bootcd/unattend.inf.in
rename to boot/bootdata/bootcd/unattend.inf
index 651d6fa022e..ce5593788e2 100644
--- a/boot/bootdata/bootcd/unattend.inf.in
+++ b/boot/bootdata/bootcd/unattend.inf
@@ -4,22 +4,22 @@ Signature = "$ReactOS$"
; Set UnattendSetupEnabled to yes in order to get unattended setup working
; yes - unattend setup enabled
; no - unattend setup disabled
-UnattendSetupEnabled = @UNATTENDED_BOOTCD@
+UnattendSetupEnabled = no
; Install to \Device\Harddisk0\Partition1\ReactOS
-DestinationDiskNumber = @UNATTENDED_BOOTCD_DestinationDiskNumber@
-DestinationPartitionNumber = @UNATTENDED_BOOTCD_DestinationPartitionNumber@
-InstallationDirectory=@UNATTENDED_BOOTCD_InstallationDirectory@
+DestinationDiskNumber = 0
+DestinationPartitionNumber = 1
+InstallationDirectory=ReactOS
; MBRInstallType=0 skips MBR installation
; MBRInstallType=1 install MBR on floppy
; MBRInstallType=2 install MBR on hdd
-MBRInstallType=@UNATTENDED_BOOTCD_MBRInstallType@
+MBRInstallType=2
-FullName="@UNATTENDED_BOOTCD_FullName@"
-OrgName="@UNATTENDED_BOOTCD_OrgName@"
-ComputerName="@UNATTENDED_BOOTCD_ComputerName@"
-AdminPassword="@UNATTENDED_BOOTCD_AdminPassword@"
+FullName="MyName"
+;OrgName="MyOrg"
+ComputerName="MYCOMPUTERNAME"
+;AdminPassword="MyPassword"
; TimeZone is set GMT as default
TimeZoneIndex=85
@@ -30,33 +30,33 @@ TimeZoneIndex=85
; enable this setting to format the selected partition
; 1 - format enabled
; 0 - format disabled
-FormatPartition=@UNATTENDED_BOOTCD_FormatPartition@
+FormatPartition=1
; enable this setting to automatically create a partition
; during installation
; 1 - enabled
; 0 - disabled
-AutoPartition = @UNATTENDED_BOOTCD_AutoPartition@
+AutoPartition = 1
; choose default file system type
; 0 - FAT
; 1 - BtrFS
-FsType = @UNATTENDED_BOOTCD_FsType@
+FsType = 0
; enable this setting to disable Gecko install
; yes - disabled
; no - enabled
-DisableGeckoInst = @UNATTENDED_BOOTCD_DisableGeckoInst@
+DisableGeckoInst = no
; set this option to automatically
; specify language in 2nd mode setup
; see hivesys.inf for available languages
-LocaleID = @UNATTENDED_BOOTCD_LocaleID@
+LocaleID = 409
; set product option
; 0: ReactOS Server
; 1: ReactOS Workstation
-ProductOption = @UNATTENDED_BOOTCD_ProductOption@
+ProductOption = 0
; enable this section to automatically launch programs
; after 3rd boot