Added patch to emulate \Device\Null using /dev/null.

This commit is contained in:
Sebastian Lackner 2015-05-02 21:00:56 +02:00
parent f23ff69f86
commit b182064bef
6 changed files with 219 additions and 33 deletions

View File

@ -39,11 +39,12 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [7]:**
**Bug fixes and features included in the next upcoming release [8]:**
* Add stub for D3DXFrameFind ([Wine Bug #38334](https://bugs.winehq.org/show_bug.cgi?id=38334))
* Add stub for advapi32.ImpersonateAnonymousToken
* Add stub for d3d11.D3D11CreateDeviceAndSwapChain ([Wine Bug #33153](https://bugs.winehq.org/show_bug.cgi?id=33153))
* Emulate \Device\Null using /dev/null ([Wine Bug #38107](https://bugs.winehq.org/show_bug.cgi?id=38107))
* Fix regression caused by blacklisting supported OpenGL extensions ([Wine Bug #38480](https://bugs.winehq.org/show_bug.cgi?id=38480))
* Ignore garbage after decoding gif lines ([Wine Bug #32227](https://bugs.winehq.org/show_bug.cgi?id=32227))
* Return failure in NtProtectVirtualMemory when last argument is omitted ([Wine Bug #38495](https://bugs.winehq.org/show_bug.cgi?id=38495))

1
debian/changelog vendored
View File

@ -8,6 +8,7 @@ wine-staging (1.7.42) UNRELEASED; urgency=low
* Added patch with stub for d3d11.D3D11CreateDeviceAndSwapChain.
* Added patch with stub for D3DXFrameFind.
* Added patch to return failure in NtProtectVirtualMemory when last argument is omitted.
* Added patch to emulate \Device\Null using /dev/null.
* Removed patch to avoid crash when trying to bind mshtml event scripts to window (fixed upstream).
* Removed patch for stub of ntdll.WinSqmIsOptedIn (fixed upstream).
* Removed patch to fix issues with invalid console handles for new processes (accepted upstream).

View File

@ -0,0 +1,106 @@
From 6428642ac8f1e129d623d4a47cfbe6b09b7bbb39 Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Fri, 13 Mar 2015 03:56:22 +0800
Subject: mountmgr.sys: Added Null Device.
---
dlls/mountmgr.sys/device.c | 40 ++++++++++++++++++++++++++++++++++++++++
dlls/mountmgr.sys/mountmgr.c | 7 +++++++
dlls/mountmgr.sys/mountmgr.h | 1 +
3 files changed, 48 insertions(+)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 5003d4d..990e6b5 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -972,6 +972,19 @@ static NTSTATUS WINAPI harddisk_ioctl( DEVICE_OBJECT *device, IRP *irp )
return STATUS_SUCCESS;
}
+static NTSTATUS WINAPI null_ioctl( DEVICE_OBJECT *device, IRP *irp )
+{
+ IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
+ ULONG code = irpsp->Parameters.DeviceIoControl.IoControlCode;
+
+ FIXME("Unsupported ioctl %x (device=%x access=%x func=%x method=%x)\n",
+ code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3);
+ irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
+
+ IoCompleteRequest( irp, IO_NO_INCREMENT );
+ return STATUS_SUCCESS;
+}
+
/* driver entry point for the harddisk driver */
NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
{
@@ -987,3 +1000,30 @@ NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *pa
return STATUS_SUCCESS;
}
+
+/* driver entry point for the null driver */
+NTSTATUS WINAPI null_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
+{
+ static const WCHAR device_nullW[] = {'\\','D','e','v','i','c','e','\\','N','u','l','l',0};
+ static const WCHAR link_nullW[] = {'\\','?','?','\\','N','u','l','l',0};
+ UNICODE_STRING nameW, linkW;
+ DEVICE_OBJECT *device;
+ NTSTATUS status;
+
+ TRACE("(%p, %s)\n", driver, debugstr_w(path->Buffer));
+
+ driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = null_ioctl;
+ RtlInitUnicodeString( &nameW, device_nullW );
+ RtlInitUnicodeString( &linkW, link_nullW );
+
+ if (!(status = IoCreateDevice( driver, 0, &nameW, 0, 0, FALSE, &device )))
+ status = IoCreateSymbolicLink( &linkW, &nameW );
+
+ if (status)
+ {
+ FIXME( "failed to create device error %x\n", status );
+ return status;
+ }
+
+ return STATUS_SUCCESS;
+}
diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c
index 10286dc..ea12313 100644
--- a/dlls/mountmgr.sys/mountmgr.c
+++ b/dlls/mountmgr.sys/mountmgr.c
@@ -422,6 +422,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
static const WCHAR devicemapW[] = {'H','A','R','D','W','A','R','E','\\','D','E','V','I','C','E','M','A','P',0};
static const WCHAR parallelW[] = {'P','A','R','A','L','L','E','L',' ','P','O','R','T','S',0};
static const WCHAR serialW[] = {'S','E','R','I','A','L','C','O','M','M',0};
+ static const WCHAR nullW[] = {'N','u','l','l',0};
UNICODE_STRING nameW, linkW;
DEVICE_OBJECT *device;
@@ -460,6 +461,12 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
RtlInitUnicodeString( &nameW, harddiskW );
status = IoCreateDriver( &nameW, harddisk_driver_entry );
+ if (!status)
+ {
+ RtlInitUnicodeString( &nameW, nullW );
+ status = IoCreateDriver( &nameW, null_driver_entry );
+ }
+
initialize_dbus();
initialize_diskarbitration();
diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h
index 2f0db62..8b42785 100644
--- a/dlls/mountmgr.sys/mountmgr.h
+++ b/dlls/mountmgr.sys/mountmgr.h
@@ -57,6 +57,7 @@ extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device,
extern NTSTATUS remove_dos_device( int letter, const char *udi ) DECLSPEC_HIDDEN;
extern NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN;
+extern NTSTATUS WINAPI null_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN;
/* mount point functions */
--
2.3.5

View File

@ -0,0 +1,48 @@
From 4ff0f3924789e3e2da8c7d408c43d4915ee5e247 Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Thu, 30 Apr 2015 21:47:38 +0800
Subject: ntdll: Emulate \Device\Null using /dev/null in
wine_nt_to_unix_file_name.
---
dlls/ntdll/directory.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index bf15612..625e2ca 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -3008,6 +3008,7 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI
static const WCHAR unixW[] = {'u','n','i','x'};
static const WCHAR pipeW[] = {'p','i','p','e'};
static const WCHAR invalid_charsW[] = { INVALID_NT_CHARS, 0 };
+ static const WCHAR device_nullW[] = {'\\','D','e','v','i','c','e','\\','N','u','l','l'};
NTSTATUS status = STATUS_SUCCESS;
const char *config_dir = wine_get_config_dir();
@@ -3024,6 +3025,22 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRI
if (!name_len || !IS_SEPARATOR(name[0])) return STATUS_OBJECT_PATH_SYNTAX_BAD;
+ if (name_len == sizeof(device_nullW) / sizeof(WCHAR) && !memicmpW( name, device_nullW, name_len ))
+ {
+ TRACE( "%s -> %s\n", debugstr_us(nameW), "/dev/null" );
+
+ unix_len = strlen("/dev/null");
+ if (!(unix_name = RtlAllocateHeap( GetProcessHeap(), 0, unix_len )))
+ return STATUS_NO_MEMORY;
+
+ strcpy( unix_name, "/dev/null" );
+ unix_name_ret->Buffer = unix_name;
+ unix_name_ret->Length = unix_len;
+ unix_name_ret->MaximumLength = unix_len + 1;
+
+ return STATUS_SUCCESS;
+ }
+
if (!(pos = get_dos_prefix_len( nameW )))
return STATUS_BAD_DEVICE_TYPE; /* no DOS prefix, assume NT native name */
--
2.3.5

View File

@ -0,0 +1,2 @@
Fixes: [38107] Emulate \Device\Null using /dev/null
Depends: ntdll-Pipe_SpecialCharacters

View File

@ -131,6 +131,7 @@ patch_enable_all ()
enable_mfplat_MFTRegister="$1"
enable_mmdevapi_AEV_Stubs="$1"
enable_mountmgr_DosDevices="$1"
enable_mountmgr_Null_Device="$1"
enable_mscoree_CorValidateImage="$1"
enable_msvcp90_basic_string_wchar_dtor="$1"
enable_msvcrt_Math_Precision="$1"
@ -470,6 +471,9 @@ patch_enable ()
mountmgr-DosDevices)
enable_mountmgr_DosDevices="$2"
;;
mountmgr-Null_Device)
enable_mountmgr_Null_Device="$2"
;;
mscoree-CorValidateImage)
enable_mscoree_CorValidateImage="$2"
;;
@ -1359,6 +1363,13 @@ if test "$enable_ntdll_CLI_Images" -eq 1; then
enable_mscoree_CorValidateImage=1
fi
if test "$enable_mountmgr_Null_Device" -eq 1; then
if test "$enable_ntdll_Pipe_SpecialCharacters" -gt 1; then
abort "Patchset ntdll-Pipe_SpecialCharacters disabled, but mountmgr-Null_Device depends on that."
fi
enable_ntdll_Pipe_SpecialCharacters=1
fi
if test "$enable_kernel32_CopyFileEx" -eq 1; then
if test "$enable_kernel32_SetFileInformationByHandle" -gt 1; then
abort "Patchset kernel32-SetFileInformationByHandle disabled, but kernel32-CopyFileEx depends on that."
@ -1608,23 +1619,6 @@ if test "$enable_advapi32_ImpersonateAnonymousToken" -eq 1; then
) >> "$patchlist"
fi
# Patchset server-Misc_ACL
# |
# | This patchset fixes the following Wine bugs:
# | * [#15980] GetSecurityInfo returns NULL DACL for process object
# |
# | Modified files:
# | * dlls/advapi32/tests/security.c, server/process.c, server/security.h, server/token.c
# |
if test "$enable_server_Misc_ACL" -eq 1; then
patch_apply server-Misc_ACL/0001-server-Add-default-security-descriptor-ownership-for.patch
patch_apply server-Misc_ACL/0002-server-Add-default-security-descriptor-DACL-for-proc.patch
(
echo '+ { "Erich E. Hoover", "server: Add default security descriptor ownership for processes.", 1 },';
echo '+ { "Erich E. Hoover", "server: Add default security descriptor DACL for processes.", 1 },';
) >> "$patchlist"
fi
# Patchset server-CreateProcess_ACLs
# |
# | This patchset fixes the following Wine bugs:
@ -1644,6 +1638,23 @@ if test "$enable_server_CreateProcess_ACLs" -eq 1; then
) >> "$patchlist"
fi
# Patchset server-Misc_ACL
# |
# | This patchset fixes the following Wine bugs:
# | * [#15980] GetSecurityInfo returns NULL DACL for process object
# |
# | Modified files:
# | * dlls/advapi32/tests/security.c, server/process.c, server/security.h, server/token.c
# |
if test "$enable_server_Misc_ACL" -eq 1; then
patch_apply server-Misc_ACL/0001-server-Add-default-security-descriptor-ownership-for.patch
patch_apply server-Misc_ACL/0002-server-Add-default-security-descriptor-DACL-for-proc.patch
(
echo '+ { "Erich E. Hoover", "server: Add default security descriptor ownership for processes.", 1 },';
echo '+ { "Erich E. Hoover", "server: Add default security descriptor DACL for processes.", 1 },';
) >> "$patchlist"
fi
# Patchset advapi32-LsaLookupSids
# |
# | Modified files:
@ -3269,6 +3280,38 @@ if test "$enable_mountmgr_DosDevices" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-Pipe_SpecialCharacters
# |
# | This patchset fixes the following Wine bugs:
# | * [#28995] Allow special characters in pipe names
# |
# | Modified files:
# | * dlls/kernel32/tests/pipe.c, dlls/ntdll/directory.c
# |
if test "$enable_ntdll_Pipe_SpecialCharacters" -eq 1; then
patch_apply ntdll-Pipe_SpecialCharacters/0001-ntdll-Allow-special-characters-in-pipe-names.patch
(
echo '+ { "Michael Müller", "ntdll: Allow special characters in pipe names.", 1 },';
) >> "$patchlist"
fi
# Patchset mountmgr-Null_Device
# |
# | This patchset fixes the following Wine bugs:
# | * [#38107] Emulate \Device\Null using /dev/null
# |
# | Modified files:
# | * dlls/mountmgr.sys/device.c, dlls/mountmgr.sys/mountmgr.c, dlls/mountmgr.sys/mountmgr.h, dlls/ntdll/directory.c
# |
if test "$enable_mountmgr_Null_Device" -eq 1; then
patch_apply mountmgr-Null_Device/0001-mountmgr.sys-Added-Null-Device.patch
patch_apply mountmgr-Null_Device/0002-ntdll-Emulate-Device-Null-using-dev-null-in-wine_nt_.patch
(
echo '+ { "Qian Hong", "mountmgr.sys: Added Null Device.", 1 },';
echo '+ { "Qian Hong", "ntdll: Emulate \\\\Device\\\\Null using /dev/null in wine_nt_to_unix_file_name.", 1 },';
) >> "$patchlist"
fi
# Patchset mscoree-CorValidateImage
# |
# | Modified files:
@ -3623,21 +3666,6 @@ if test "$enable_ntdll_NtSetLdtEntries" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-Pipe_SpecialCharacters
# |
# | This patchset fixes the following Wine bugs:
# | * [#28995] Allow special characters in pipe names
# |
# | Modified files:
# | * dlls/kernel32/tests/pipe.c, dlls/ntdll/directory.c
# |
if test "$enable_ntdll_Pipe_SpecialCharacters" -eq 1; then
patch_apply ntdll-Pipe_SpecialCharacters/0001-ntdll-Allow-special-characters-in-pipe-names.patch
(
echo '+ { "Michael Müller", "ntdll: Allow special characters in pipe names.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-RtlIpStringToAddress
# |
# | Modified files: