https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aef566c19e57cc26c94a9…
commit aef566c19e57cc26c94a9a8dc593bf5e48a41163
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sat Oct 20 16:49:30 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sat Oct 20 19:52:07 2018 +0200
[MKHIVE] Minor code rearrangement.
---
sdk/tools/mkhive/registry.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sdk/tools/mkhive/registry.c b/sdk/tools/mkhive/registry.c
index 8ee8d36ec8..9628f67573 100644
--- a/sdk/tools/mkhive/registry.c
+++ b/sdk/tools/mkhive/registry.c
@@ -66,7 +66,7 @@ static CMHIVE BcdHive; /* \Registry\Machine\BCD00000000 */
// See http://amnesia.gtisc.gatech.edu/~moyix/suzibandit.ltd.uk/MSc/Registry%20Str…
// Appendix 12 "The Registry NT Security Descriptor" for more information.
//
-// Those SECURITY_DESCRIPTORs were obtained by dumping the security block "sk"
+// These SECURITY_DESCRIPTORs were obtained by dumping the security block "sk"
// of registry hives created by setting their permissions to be the same as
// the ones of the BCD, SOFTWARE, or SYSTEM, SAM and .DEFAULT system hives.
// A cross-check was subsequently done with the system hives to verify that
@@ -1010,10 +1010,10 @@ Quit:
static BOOL
ConnectRegistry(
IN HKEY RootKey,
+ IN PCWSTR Path,
IN PCMHIVE HiveToConnect,
IN PUCHAR SecurityDescriptor,
- IN ULONG SecurityDescriptorLength,
- IN PCWSTR Path)
+ IN ULONG SecurityDescriptorLength)
{
NTSTATUS Status;
LONG rc;
@@ -1159,10 +1159,10 @@ RegInitializeRegistry(
/* Create the registry key */
ConnectRegistry(NULL,
+ RegistryHives[i].HiveRegistryPath,
RegistryHives[i].CmHive,
RegistryHives[i].SecurityDescriptor,
- RegistryHives[i].SecurityDescriptorLength,
- RegistryHives[i].HiveRegistryPath);
+ RegistryHives[i].SecurityDescriptorLength);
/* If we happen to deal with the special setup registry hive, stop there */
// if (strcmp(RegistryHives[i].HiveName, "SETUPREG") == 0)
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=827ed4b146b17ae6a808e…
commit 827ed4b146b17ae6a808e8943bf06888b924cb69
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Oct 20 12:53:52 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Oct 20 17:27:53 2018 +0200
[NTVDM] Allow opening files with write access on CDROM
Some applications, run on a CDROM, may attempt to open
a file with write access. CDFS driver will deny such
request in ReactOS (but also in Windows NT). Then, to
restore that behavior from old Windows (9X), our ntvdm,
as Microsoft ntvdm will attempt to reopen the file only
with read access, if opening failed because of denied access
and if the file is on a CDROM.
CORE-15211
---
subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c b/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c
index d5b01ce7fb..641ab62ed9 100644
--- a/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c
+++ b/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c
@@ -161,6 +161,21 @@ static BOOLEAN DosChangeDirectory(LPSTR Directory)
return TRUE;
}
+static BOOLEAN DosIsFileOnCdRom(VOID)
+{
+ UINT DriveType;
+ CHAR RootPathName[4];
+
+ /* Construct a simple <letter>:\ string to get drive type */
+ RootPathName[0] = Sda->CurrentDrive + 'A';
+ RootPathName[1] = ':';
+ RootPathName[2] = '\\';
+ RootPathName[3] = ANSI_NULL;
+
+ DriveType = GetDriveTypeA(RootPathName);
+ return (DriveType == DRIVE_CDROM);
+}
+
/* PUBLIC FUNCTIONS ***********************************************************/
BOOLEAN DosControlBreak(VOID)
@@ -950,8 +965,19 @@ VOID WINAPI DosInt21h(LPWORD Stack)
case 0x3D:
{
WORD FileHandle;
+ BYTE AccessShareModes = getAL();
LPCSTR FileName = (LPCSTR)SEG_OFF_TO_PTR(getDS(), getDX());
- WORD ErrorCode = DosOpenFile(&FileHandle, FileName, getAL());
+ WORD ErrorCode = DosOpenFile(&FileHandle, FileName, AccessShareModes);
+
+ /*
+ * Check if we failed because we attempted to open a file for write
+ * on a CDROM drive. In that situation, attempt to reopen for read
+ */
+ if (ErrorCode == ERROR_ACCESS_DENIED &&
+ (AccessShareModes & 0x03) != 0 && DosIsFileOnCdRom())
+ {
+ ErrorCode = DosOpenFile(&FileHandle, FileName, 0);
+ }
if (ErrorCode == ERROR_SUCCESS)
{