nsiproxy: Create the nsi device.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-06-29 08:04:19 +01:00 committed by Alexandre Julliard
parent f4a0b90f03
commit 393e953b31
6 changed files with 110 additions and 0 deletions

2
configure vendored
View file

@ -1526,6 +1526,7 @@ enable_normaliz
enable_npmshtml
enable_npptools
enable_nsi
enable_nsiproxy_sys
enable_ntdll
enable_ntdsapi
enable_ntoskrnl_exe
@ -20822,6 +20823,7 @@ wine_fn_config_makefile dlls/npmshtml enable_npmshtml
wine_fn_config_makefile dlls/npptools enable_npptools
wine_fn_config_makefile dlls/nsi enable_nsi
wine_fn_config_makefile dlls/nsi/tests enable_tests
wine_fn_config_makefile dlls/nsiproxy.sys enable_nsiproxy_sys
wine_fn_config_makefile dlls/ntdll enable_ntdll
wine_fn_config_makefile dlls/ntdll/tests enable_tests
wine_fn_config_makefile dlls/ntdsapi enable_ntdsapi

View file

@ -3498,6 +3498,7 @@ WINE_CONFIG_MAKEFILE(dlls/npmshtml)
WINE_CONFIG_MAKEFILE(dlls/npptools)
WINE_CONFIG_MAKEFILE(dlls/nsi)
WINE_CONFIG_MAKEFILE(dlls/nsi/tests)
WINE_CONFIG_MAKEFILE(dlls/nsiproxy.sys)
WINE_CONFIG_MAKEFILE(dlls/ntdll)
WINE_CONFIG_MAKEFILE(dlls/ntdll/tests)
WINE_CONFIG_MAKEFILE(dlls/ntdsapi)

View file

@ -0,0 +1,6 @@
MODULE = nsiproxy.sys
IMPORTS = ntoskrnl
EXTRADLLFLAGS = -Wl,--subsystem,native
C_SRCS = \
device.c

View file

@ -0,0 +1,87 @@
/*
* nsiproxy.sys
*
* Copyright 2021 Huw Davies
*
* 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>
#define NONAMELESSUNION
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "winioctl.h"
#include "ddk/wdm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(nsi);
static NTSTATUS WINAPI nsi_ioctl( DEVICE_OBJECT *device, IRP *irp )
{
IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
TRACE( "ioctl %x insize %u outsize %u\n",
irpsp->Parameters.DeviceIoControl.IoControlCode,
irpsp->Parameters.DeviceIoControl.InputBufferLength,
irpsp->Parameters.DeviceIoControl.OutputBufferLength );
switch (irpsp->Parameters.DeviceIoControl.IoControlCode)
{
default:
FIXME( "ioctl %x not supported\n", irpsp->Parameters.DeviceIoControl.IoControlCode );
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
break;
}
IoCompleteRequest( irp, IO_NO_INCREMENT );
return STATUS_SUCCESS;
}
static int add_device( DRIVER_OBJECT *driver )
{
static const WCHAR name_str[] = {'\\','D','e','v','i','c','e','\\','N','s','i',0};
static const WCHAR link_str[] = {'\\','?','?','\\','N','s','i',0};
UNICODE_STRING name, link;
DEVICE_OBJECT *device;
NTSTATUS status;
RtlInitUnicodeString( &name, name_str );
RtlInitUnicodeString( &link, link_str );
if (!(status = IoCreateDevice( driver, 0, &name, FILE_DEVICE_NETWORK, FILE_DEVICE_SECURE_OPEN, FALSE, &device )))
status = IoCreateSymbolicLink( &link, &name );
if (status)
{
FIXME( "failed to create device error %x\n", status );
return 0;
}
return 1;
}
NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
{
TRACE( "(%p, %s)\n", driver, debugstr_w( path->Buffer ) );
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = nsi_ioctl;
add_device( driver );
return STATUS_SUCCESS;
}

View file

@ -0,0 +1 @@
# no exported functions

View file

@ -165,6 +165,7 @@ AddService=Schedule,0,TaskSchedulerService
AddService=Winmgmt,0,WinmgmtService
AddService=wuauserv,0,wuauService
AddService=NDIS,0x800,NDISService
AddService=nsiproxy,0x800,NsiProxyService
[DefaultInstall.NT.Services]
AddService=BITS,0,BITSService
@ -184,6 +185,7 @@ AddService=Schedule,0,TaskSchedulerService
AddService=Winmgmt,0,WinmgmtService
AddService=wuauserv,0,wuauService
AddService=NDIS,0x800,NDISService
AddService=nsiproxy,0x800,NsiProxyService
[DefaultInstall.ntamd64.Services]
AddService=BITS,0,BITSService
@ -203,6 +205,7 @@ AddService=Schedule,0,TaskSchedulerService
AddService=Winmgmt,0,WinmgmtService
AddService=wuauserv,0,wuauService
AddService=NDIS,0x800,NDISService
AddService=nsiproxy,0x800,NsiProxyService
[DefaultInstall.ntarm64.Services]
AddService=BITS,0,BITSService
@ -222,6 +225,7 @@ AddService=Schedule,0,TaskSchedulerService
AddService=Winmgmt,0,WinmgmtService
AddService=wuauserv,0,wuauService
AddService=NDIS,0x800,NDISService
AddService=nsiproxy,0x800,NsiProxyService
[Strings]
MciExtStr="Software\Microsoft\Windows NT\CurrentVersion\MCI Extensions"
@ -3779,6 +3783,15 @@ StartType=2
ErrorControl=1
LoadOrderGroup="System Bus Extender"
[NsiProxyService]
Description="NSI proxy service"
DisplayName="NSI Proxy"
ServiceBinary="%12%\nsiproxy.sys"
ServiceType=1
StartType=2
ErrorControl=1
LoadOrderGroup="System Bus Extender"
[RpcSsService]
Description="RPC service"
DisplayName="Remote Procedure Call (RPC)"