Updated patch to emulate \Device\Null using /dev/null, use a proper device driver.

This commit is contained in:
Sebastian Lackner 2015-05-16 00:34:09 +02:00
parent 26e06cc151
commit e2d58b98e4
14 changed files with 516 additions and 216 deletions

View File

@ -121,7 +121,6 @@ for more details.*
* D3DCompileShader should filter specific warning messages ([Wine Bug #33770](https://bugs.winehq.org/show_bug.cgi?id=33770))
* Do not append duplicate NULL characters when importing keys with regedit ([Wine Bug #37575](https://bugs.winehq.org/show_bug.cgi?id=37575))
* Do not fail when a used context is passed to wglShareLists ([Wine Bug #11436](https://bugs.winehq.org/show_bug.cgi?id=11436))
* Emulate \Device\Null using /dev/null ([Wine Bug #38107](https://bugs.winehq.org/show_bug.cgi?id=38107))
* Emulate access to KI_USER_SHARED_DATA kernel page on x86_64 ([Wine Bug #33849](https://bugs.winehq.org/show_bug.cgi?id=33849))
* Enforce that surfaces are flushed after ReleaseDC
* Ensure NtProtectVirtualMemory and NtCreateSection are on separate pages ([Wine Bug #33162](https://bugs.winehq.org/show_bug.cgi?id=33162))
@ -189,6 +188,7 @@ for more details.*
* Implement mscoree._CorValidateImage for mono runtime
* Implement ntoskrnl driver testing framework.
* Implement ntoskrnl.KeInitializeMutex
* Implement null.sys to provide \Device\Null ([Wine Bug #38107](https://bugs.winehq.org/show_bug.cgi?id=38107))
* Implement proper handling of CLI .NET images in Wine library loader
* Implement stub for ntoskrnl.IoGetAttachedDeviceReference
* Implement stub for ntoskrnl.KeDelayExecutionThread.

2
debian/changelog vendored
View File

@ -4,6 +4,8 @@ wine-staging (1.7.43) UNRELEASED; urgency=low
precision (fixes Wine Staging Bug #268).
* Updated patchset for CopyFileEx improvements, fix testfailures in
kernel32/file and add additional tests.
* Updated patch to emulate \Device\Null using /dev/null, use a proper device
driver.
* Added patch to wait before reusing recently freed memory (fixes Wine Staging
Bug #269 and #199).
* Added patch to improve ReadDataAvailable handling in

View File

@ -1,106 +0,0 @@
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

@ -1,48 +0,0 @@
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

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

View File

@ -0,0 +1,127 @@
From 53fb7cd87e18767ddda8e4b901ec4f3a4570ae98 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 15 May 2015 19:57:42 +0200
Subject: ntdll/tests: Add tests for accessing \\Device\\Null.
---
dlls/ntdll/tests/om.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 96e1e6e..71b7ca8 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -1032,6 +1032,104 @@ static void test_keyed_events(void)
NtClose( event );
}
+static void test_null_device(void)
+{
+ OBJECT_ATTRIBUTES attr;
+ IO_STATUS_BLOCK iosb;
+ UNICODE_STRING str;
+ NTSTATUS status;
+ DWORD num_bytes;
+ OVERLAPPED ov;
+ char buf[64];
+ HANDLE null;
+ BOOL ret;
+
+ memset(buf, 0xAA, sizeof(buf));
+ memset(&ov, 0, sizeof(ov));
+ ov.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+
+ pRtlCreateUnicodeStringFromAsciiz(&str, "\\Device\\Null");
+ InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
+ status = pNtOpenSymbolicLinkObject(&null, SYMBOLIC_LINK_QUERY, &attr);
+ todo_wine
+ ok(status == STATUS_OBJECT_TYPE_MISMATCH,
+ "expected STATUS_OBJECT_TYPE_MISMATCH, got %08x\n", status);
+
+ status = pNtOpenFile(&null, GENERIC_READ | GENERIC_WRITE, &attr, &iosb,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN);
+ todo_wine
+ ok(status == STATUS_SUCCESS,
+ "expected STATUS_SUCCESS, got %08x\n", status);
+
+ SetLastError(0xdeadbeef);
+ ret = WriteFile(null, buf, sizeof(buf), &num_bytes, NULL);
+ ok(!ret, "WriteFile unexpectedly succeeded\n");
+ todo_wine
+ ok(GetLastError() == ERROR_INVALID_PARAMETER,
+ "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret = ReadFile(null, buf, sizeof(buf), &num_bytes, NULL);
+ ok(!ret, "ReadFile unexpectedly succeeded\n");
+ todo_wine
+ ok(GetLastError() == ERROR_INVALID_PARAMETER,
+ "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+ num_bytes = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = WriteFile(null, buf, sizeof(buf), &num_bytes, &ov);
+ if (ret || GetLastError() != ERROR_IO_PENDING)
+ {
+ todo_wine
+ ok(ret, "WriteFile failed with error %u\n", GetLastError());
+ }
+ else
+ {
+ num_bytes = 0xdeadbeef;
+ ret = GetOverlappedResult(null, &ov, &num_bytes, TRUE);
+ ok(ret, "GetOverlappedResult failed with error %u\n", GetLastError());
+ }
+ todo_wine
+ ok(num_bytes == sizeof(buf), "expected num_bytes = %u, got %u\n",
+ (DWORD)sizeof(buf), num_bytes);
+
+ num_bytes = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = ReadFile(null, buf, sizeof(buf), &num_bytes, &ov);
+ if (ret || GetLastError() != ERROR_IO_PENDING)
+ {
+ ok(!ret, "ReadFile unexpectedly succeeded\n");
+ }
+ else
+ {
+ num_bytes = 0xdeadbeef;
+ ret = GetOverlappedResult(null, &ov, &num_bytes, TRUE);
+ ok(!ret, "GetOverlappedResult unexpectedly succeeded\n");
+ }
+ todo_wine
+ ok(GetLastError() == ERROR_HANDLE_EOF,
+ "expected ERROR_HANDLE_EOF, got %u\n", GetLastError());
+
+ pNtClose(null);
+
+ null = CreateFileA("\\\\.\\Null", GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ ok(null == INVALID_HANDLE_VALUE, "CreateFileA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_FILE_NOT_FOUND,
+ "expected ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
+
+ null = CreateFileA("\\\\.\\Device\\Null", GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ ok(null == INVALID_HANDLE_VALUE, "CreateFileA unexpectedly succeeded\n");
+ ok(GetLastError() == ERROR_PATH_NOT_FOUND,
+ "expected ERROR_PATH_NOT_FOUND, got %u\n", GetLastError());
+
+ pRtlFreeUnicodeString(&str);
+ CloseHandle(ov.hEvent);
+}
+
START_TEST(om)
{
HMODULE hntdll = GetModuleHandleA("ntdll.dll");
@@ -1081,4 +1179,5 @@ START_TEST(om)
test_type_mismatch();
test_event();
test_keyed_events();
+ test_null_device();
}
--
2.4.0

View File

@ -0,0 +1,109 @@
From 0a3f771a48590503f8e8b951939e905bde132744 Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Thu, 12 Mar 2015 06:43:03 +0800
Subject: null.sys: Added stub dll.
Changes by Sebastian Lackner <sebastian@fds-team.de>:
* Install driver to system32/drivers directory.
---
configure.ac | 1 +
dlls/null.sys/Makefile.in | 5 +++++
dlls/null.sys/main.c | 38 ++++++++++++++++++++++++++++++++++++++
dlls/null.sys/null.sys.spec | 1 +
loader/wine.inf.in | 2 ++
5 files changed, 47 insertions(+)
create mode 100644 dlls/null.sys/Makefile.in
create mode 100644 dlls/null.sys/main.c
create mode 100644 dlls/null.sys/null.sys.spec
diff --git a/configure.ac b/configure.ac
index a9a7bcf..32b2e16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3157,4 +3157,5 @@ WINE_CONFIG_DLL(ntoskrnl.exe,,[implib])
WINE_CONFIG_DLL(ntprint)
WINE_CONFIG_TEST(dlls/ntprint/tests)
+WINE_CONFIG_DLL(null.sys)
WINE_CONFIG_DLL(objsel,,[clean])
WINE_CONFIG_DLL(odbc32,,[implib])
diff --git a/dlls/null.sys/Makefile.in b/dlls/null.sys/Makefile.in
new file mode 100644
index 0000000..4ea3b55
--- /dev/null
+++ b/dlls/null.sys/Makefile.in
@@ -0,0 +1,5 @@
+MODULE = null.sys
+EXTRADLLFLAGS = -Wb,--subsystem,native
+
+C_SRCS = \
+ main.c
diff --git a/dlls/null.sys/main.c b/dlls/null.sys/main.c
new file mode 100644
index 0000000..141c218
--- /dev/null
+++ b/dlls/null.sys/main.c
@@ -0,0 +1,38 @@
+/*
+ * null.sys
+ *
+ * Copyright 2015 Qian Hong for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winternl.h"
+#include "ddk/wdm.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(null);
+
+NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *path)
+{
+ TRACE("(%p, %s)\n", driver, debugstr_w(path->Buffer));
+
+ return STATUS_SUCCESS;
+}
diff --git a/dlls/null.sys/null.sys.spec b/dlls/null.sys/null.sys.spec
new file mode 100644
index 0000000..76421d7
--- /dev/null
+++ b/dlls/null.sys/null.sys.spec
@@ -0,0 +1 @@
+# nothing to export
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index fcd2e49..8a6c767 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -2498,4 +2498,5 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
12,,mountmgr.sys,-
12,,ndis.sys,-
+12,,null.sys,-
; skip .NET fake dlls in Wine Mono package
11,,aspnet_regiis.exe,-
@@ -2536,4 +2537,5 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
12,,mountmgr.sys
12,,ndis.sys
+12,,null.sys
; skip .NET fake dlls in Wine Mono package
11,,aspnet_regiis.exe,-
--
2.4.0

View File

@ -0,0 +1,209 @@
From e2577e4c0c0637e22da03eeee33331495eb6d177 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 15 May 2015 22:23:52 +0200
Subject: null.sys: Implement device ioctl/read/write functions.
Based on a patch by Qian Hong.
---
dlls/ntdll/tests/om.c | 7 ++----
dlls/null.sys/Makefile.in | 1 +
dlls/null.sys/main.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++
loader/wine.inf.in | 11 +++++++++
4 files changed, 77 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 71b7ca8..f92069c 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -1051,18 +1051,17 @@ static void test_null_device(void)
pRtlCreateUnicodeStringFromAsciiz(&str, "\\Device\\Null");
InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
status = pNtOpenSymbolicLinkObject(&null, SYMBOLIC_LINK_QUERY, &attr);
- todo_wine
ok(status == STATUS_OBJECT_TYPE_MISMATCH,
"expected STATUS_OBJECT_TYPE_MISMATCH, got %08x\n", status);
status = pNtOpenFile(&null, GENERIC_READ | GENERIC_WRITE, &attr, &iosb,
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN);
- todo_wine
ok(status == STATUS_SUCCESS,
"expected STATUS_SUCCESS, got %08x\n", status);
SetLastError(0xdeadbeef);
ret = WriteFile(null, buf, sizeof(buf), &num_bytes, NULL);
+ todo_wine
ok(!ret, "WriteFile unexpectedly succeeded\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER,
@@ -1070,6 +1069,7 @@ static void test_null_device(void)
SetLastError(0xdeadbeef);
ret = ReadFile(null, buf, sizeof(buf), &num_bytes, NULL);
+ todo_wine
ok(!ret, "ReadFile unexpectedly succeeded\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER,
@@ -1080,7 +1080,6 @@ static void test_null_device(void)
ret = WriteFile(null, buf, sizeof(buf), &num_bytes, &ov);
if (ret || GetLastError() != ERROR_IO_PENDING)
{
- todo_wine
ok(ret, "WriteFile failed with error %u\n", GetLastError());
}
else
@@ -1089,7 +1088,6 @@ static void test_null_device(void)
ret = GetOverlappedResult(null, &ov, &num_bytes, TRUE);
ok(ret, "GetOverlappedResult failed with error %u\n", GetLastError());
}
- todo_wine
ok(num_bytes == sizeof(buf), "expected num_bytes = %u, got %u\n",
(DWORD)sizeof(buf), num_bytes);
@@ -1106,7 +1104,6 @@ static void test_null_device(void)
ret = GetOverlappedResult(null, &ov, &num_bytes, TRUE);
ok(!ret, "GetOverlappedResult unexpectedly succeeded\n");
}
- todo_wine
ok(GetLastError() == ERROR_HANDLE_EOF,
"expected ERROR_HANDLE_EOF, got %u\n", GetLastError());
diff --git a/dlls/null.sys/Makefile.in b/dlls/null.sys/Makefile.in
index 4ea3b55..95c249d 100644
--- a/dlls/null.sys/Makefile.in
+++ b/dlls/null.sys/Makefile.in
@@ -1,4 +1,5 @@
MODULE = null.sys
+IMPORTS = ntoskrnl.exe
EXTRADLLFLAGS = -Wb,--subsystem,native
C_SRCS = \
diff --git a/dlls/null.sys/main.c b/dlls/null.sys/main.c
index 141c218..ecbb7cf 100644
--- a/dlls/null.sys/main.c
+++ b/dlls/null.sys/main.c
@@ -20,6 +20,7 @@
#include <stdarg.h>
+#define NONAMELESSUNION
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
@@ -30,9 +31,71 @@
WINE_DEFAULT_DEBUG_CHANNEL(null);
+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;
+}
+
+static NTSTATUS WINAPI null_read( DEVICE_OBJECT *device, IRP *irp )
+{
+ IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
+
+ TRACE( "length %u key %u byteoffset %u\n",
+ irpsp->Parameters.Read.Length,
+ irpsp->Parameters.Read.Key,
+ irpsp->Parameters.Read.ByteOffset.u.LowPart);
+
+ irp->IoStatus.u.Status = STATUS_END_OF_FILE;
+
+ IoCompleteRequest( irp, IO_NO_INCREMENT );
+ return STATUS_END_OF_FILE;
+}
+
+static NTSTATUS WINAPI null_write( DEVICE_OBJECT *device, IRP *irp )
+{
+ IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
+
+ TRACE( "length %u key %u byteoffset %u\n",
+ irpsp->Parameters.Read.Length,
+ irpsp->Parameters.Read.Key,
+ irpsp->Parameters.Read.ByteOffset.u.LowPart);
+
+ irp->IoStatus.Information = irpsp->Parameters.Read.Length;
+ irp->IoStatus.u.Status = STATUS_SUCCESS;
+
+ IoCompleteRequest( irp, IO_NO_INCREMENT );
+ return STATUS_SUCCESS;
+}
+
NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *path)
{
+ static const WCHAR device_nullW[] = {'\\','D','e','v','i','c','e','\\','N','u','l','l',0};
+ UNICODE_STRING nameW;
+ DEVICE_OBJECT *device;
+ NTSTATUS status;
+
TRACE("(%p, %s)\n", driver, debugstr_w(path->Buffer));
+ driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = null_ioctl;
+ driver->MajorFunction[IRP_MJ_READ] = null_read;
+ driver->MajorFunction[IRP_MJ_WRITE] = null_write;
+
+ RtlInitUnicodeString( &nameW, device_nullW );
+
+ status = IoCreateDevice( driver, 0, &nameW, 0, 0, FALSE, &device );
+ if (status)
+ {
+ FIXME( "failed to create device error %x\n", status );
+ return status;
+ }
+
return STATUS_SUCCESS;
}
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 8a6c767..057d047 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -121,6 +121,7 @@ AddReg=\
AddService=BITS,0,BITSService
AddService=MSIServer,0,MSIService
AddService=MountMgr,0x800,MountMgrService
+AddService=Null,0x800,NullService
AddService=Spooler,0,SpoolerService
AddService=StiSvc,0,StiService
AddService=TermService,0,TerminalServices
@@ -134,6 +135,7 @@ AddService=Schedule,0,TaskSchedulerService
AddService=BITS,0,BITSService
AddService=MSIServer,0,MSIService
AddService=MountMgr,0x800,MountMgrService
+AddService=Null,0x800,NullService
AddService=Spooler,0,SpoolerService
AddService=StiSvc,0,StiService
AddService=TermService,0,TerminalServices
@@ -147,6 +149,7 @@ AddService=Schedule,0,TaskSchedulerService
AddService=BITS,0,BITSService
AddService=MSIServer,0,MSIService
AddService=MountMgr,0x800,MountMgrService
+AddService=Null,0x800,NullService
AddService=Spooler,0,SpoolerService
AddService=StiSvc,0,StiService
AddService=TermService,0,TerminalServices
@@ -3128,6 +3131,14 @@ ServiceType=1
StartType=2
ErrorControl=1
+[NullService]
+Description="Null service"
+DisplayName="Null"
+ServiceBinary="%12%\null.sys"
+ServiceType=1
+StartType=2
+ErrorControl=1
+
[SpoolerService]
Description="Loads files to memory for later printing"
DisplayName="Print Spooler"
--
2.4.0

View File

@ -0,0 +1 @@
Fixes: [38107] Implement null.sys to provide \Device\Null

View File

@ -1,4 +1,4 @@
From ef18cdddb0a8f9876920d4718b84262dd0cd7fd1 Mon Sep 17 00:00:00 2001
From a693fcab267468e8506448a492c756bdf070ba5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 5 Jan 2015 18:11:53 +0100
Subject: nvapi: First implementation.
@ -25,10 +25,10 @@ Subject: nvapi: First implementation.
create mode 100644 include/nvapi.h
diff --git a/configure.ac b/configure.ac
index 73e67bb..f76fa4d 100644
index 8a98996..efe32af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,6 +188,12 @@ esac
@@ -190,6 +190,12 @@ esac
dnl enable_win16 defaults to yes on x86, to no on other CPUs
enable_win16=${enable_win16:-no}
enable_win64=${enable_win64:-no}
@ -41,14 +41,16 @@ index 73e67bb..f76fa4d 100644
dnl Disable winetest too if tests are disabled
enable_winetest=${enable_winetest:-$enable_tests}
@@ -3128,4 +3134,7 @@ WINE_CONFIG_DLL(ntoskrnl.exe,,[implib])
@@ -3157,6 +3163,9 @@ WINE_CONFIG_DLL(ntoskrnl.exe,,[implib])
WINE_CONFIG_DLL(ntprint)
WINE_CONFIG_TEST(dlls/ntprint/tests)
WINE_CONFIG_DLL(null.sys)
+WINE_CONFIG_DLL(nvapi,enable_win32)
+WINE_CONFIG_TEST(dlls/nvapi/tests)
+WINE_CONFIG_DLL(nvapi64,enable_win64)
WINE_CONFIG_DLL(nvcuda)
WINE_CONFIG_TEST(dlls/nvcuda/tests)
WINE_CONFIG_DLL(objsel,,[clean])
diff --git a/dlls/nvapi/Makefile.in b/dlls/nvapi/Makefile.in
new file mode 100644
index 0000000..606177f
@ -854,10 +856,10 @@ index 0000000..f0c054b
+@ stub DllRegisterServer
+@ stub DllUnregisterServer
diff --git a/include/Makefile.in b/include/Makefile.in
index 84c3ea7..f9eaf44 100644
index 6abb2c2..476613a 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -477,6 +477,7 @@ SRCDIR_INCLUDES = \
@@ -482,6 +482,7 @@ SRCDIR_INCLUDES = \
ntsecapi.h \
ntsecpkg.h \
ntstatus.h \
@ -948,5 +950,5 @@ index 0000000..4204256
+
+#endif /* __WINE_NVAPI_H */
--
2.2.1
2.4.0

View File

@ -1,4 +1,4 @@
From a113e56cbb4cba0fb1027ee72b3567f24373debc Mon Sep 17 00:00:00 2001
From 4ff8f6fbd144d0db7aa03da44f1d3079b09a4f5a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 3 Jan 2015 03:32:12 +0100
Subject: nvcuda: Add stub dll.
@ -16,15 +16,17 @@ Subject: nvcuda: Add stub dll.
create mode 100644 dlls/nvcuda/nvcuda.spec
diff --git a/configure.ac b/configure.ac
index b67a7e7..6e3108b 100644
index 32b2e16..1e38434 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3128,4 +3128,5 @@ WINE_CONFIG_DLL(ntoskrnl.exe,,[implib])
@@ -3157,6 +3157,7 @@ WINE_CONFIG_DLL(ntoskrnl.exe,,[implib])
WINE_CONFIG_DLL(ntprint)
WINE_CONFIG_TEST(dlls/ntprint/tests)
WINE_CONFIG_DLL(null.sys)
+WINE_CONFIG_DLL(nvcuda)
WINE_CONFIG_DLL(objsel,,[clean])
WINE_CONFIG_DLL(odbc32,,[implib])
WINE_CONFIG_DLL(odbccp32,,[implib])
diff --git a/dlls/nvcuda/Makefile.in b/dlls/nvcuda/Makefile.in
new file mode 100644
index 0000000..4b33278
@ -434,5 +436,5 @@ index 0000000..279f7ab
+@ stub cuTexRefSetMipmappedArray
+@ stub cuWGLGetDevice
--
2.2.1
2.4.0

View File

@ -1,4 +1,4 @@
From f81683cb7d6d6dab24367f8fe6f7b97f8089b7a5 Mon Sep 17 00:00:00 2001
From 8ed5305238bf910faaa3943ee179767e8d5d3c84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 3 Jan 2015 03:39:11 +0100
Subject: nvcuda: First implementation. (rev 2)
@ -23,12 +23,12 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
create mode 100644 dlls/nvcuda/tests/nvcuda.c
diff --git a/configure.ac b/configure.ac
index c879c03..6246e34 100644
index 1e38434..8a98996 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3144,6 +3144,7 @@ WINE_CONFIG_DLL(ntoskrnl.exe,,[implib])
WINE_CONFIG_DLL(ntprint)
@@ -3158,6 +3158,7 @@ WINE_CONFIG_DLL(ntprint)
WINE_CONFIG_TEST(dlls/ntprint/tests)
WINE_CONFIG_DLL(null.sys)
WINE_CONFIG_DLL(nvcuda)
+WINE_CONFIG_TEST(dlls/nvcuda/tests)
WINE_CONFIG_DLL(objsel,,[clean])
@ -3422,5 +3422,5 @@ index 0000000..fc8f300
+ test_TlsNotifyInterface();
+}
--
2.3.2
2.4.0

View File

@ -1,2 +1,3 @@
Fixes: Basic support for CUDA
Fixes: [37664] MediaCoder needs CUDA for video encoding
Depends: null-Null_Device

View File

@ -151,7 +151,6 @@ 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_dtor="$1"
enable_msvcrt_Math_Precision="$1"
@ -189,6 +188,7 @@ patch_enable_all ()
enable_ntoskrnl_DriverTest="$1"
enable_ntoskrnl_Emulator="$1"
enable_ntoskrnl_Stubs="$1"
enable_null_Null_Device="$1"
enable_nvapi_Stub_DLL="$1"
enable_nvcuda_CUDA_Support="$1"
enable_nvcuvid_CUDA_Video_Support="$1"
@ -522,9 +522,6 @@ patch_enable ()
mountmgr-DosDevices)
enable_mountmgr_DosDevices="$2"
;;
mountmgr-Null_Device)
enable_mountmgr_Null_Device="$2"
;;
mscoree-CorValidateImage)
enable_mscoree_CorValidateImage="$2"
;;
@ -636,6 +633,9 @@ patch_enable ()
ntoskrnl-Stubs)
enable_ntoskrnl_Stubs="$2"
;;
null-Null_Device)
enable_null_Null_Device="$2"
;;
nvapi-Stub_DLL)
enable_nvapi_Stub_DLL="$2"
;;
@ -1519,6 +1519,13 @@ if test "$enable_nvapi_Stub_DLL" -eq 1; then
enable_nvcuda_CUDA_Support=1
fi
if test "$enable_nvcuda_CUDA_Support" -eq 1; then
if test "$enable_null_Null_Device" -gt 1; then
abort "Patchset null-Null_Device disabled, but nvcuda-CUDA_Support depends on that."
fi
enable_null_Null_Device=1
fi
if test "$enable_ntoskrnl_Emulator" -eq 1; then
if test "$enable_ntdll_User_Shared_Data" -gt 1; then
abort "Patchset ntdll-User_Shared_Data disabled, but ntoskrnl-Emulator depends on that."
@ -1558,13 +1565,6 @@ 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_Named_Pipe" -eq 1; then
if test "$enable_advapi32_OpenSCManagerW" -gt 1; then
abort "Patchset advapi32-OpenSCManagerW disabled, but kernel32-Named_Pipe depends on that."
@ -3603,38 +3603,6 @@ 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:
@ -3988,6 +3956,21 @@ 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:
@ -4213,6 +4196,26 @@ if test "$enable_ntoskrnl_Stubs" -eq 1; then
) >> "$patchlist"
fi
# Patchset null-Null_Device
# |
# | This patchset fixes the following Wine bugs:
# | * [#38107] Implement null.sys to provide \Device\Null
# |
# | Modified files:
# | * configure.ac, dlls/ntdll/tests/om.c, dlls/null.sys/Makefile.in, dlls/null.sys/main.c, dlls/null.sys/null.sys.spec,
# | loader/wine.inf.in
# |
if test "$enable_null_Null_Device" -eq 1; then
patch_apply null-Null_Device/0001-ntdll-tests-Add-tests-for-accessing-Device-Null.patch
patch_apply null-Null_Device/0002-null.sys-Added-stub-dll.patch
patch_apply null-Null_Device/0003-null.sys-Implement-device-ioctl-read-write-functions.patch
(
echo '+ { "Sebastian Lackner", "ntdll/tests: Add tests for accessing \\\\\\\\Device\\\\\\\\Null.", 1 },';
echo '+ { "Qian Hong", "null.sys: Added stub dll.", 1 },';
echo '+ { "Sebastian Lackner", "null.sys: Implement device ioctl/read/write functions.", 1 },';
) >> "$patchlist"
fi
# Patchset nvcuda-CUDA_Support
# |
# | This patchset fixes the following Wine bugs: