Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/nsiproxy.sys/Makefile.in | 5 +++-- dlls/nsiproxy.sys/device.c | 30 ++++++++++++++++++++++++++---- dlls/nsiproxy.sys/ip.c | 6 ++++++ dlls/nsiproxy.sys/ndis.c | 9 +++++++-- dlls/nsiproxy.sys/nsi.c | 30 ++++++++++++++++++++++++++++++ dlls/nsiproxy.sys/tcp.c | 4 ++++ dlls/nsiproxy.sys/udp.c | 4 ++++ 7 files changed, 80 insertions(+), 8 deletions(-)
diff --git a/dlls/nsiproxy.sys/Makefile.in b/dlls/nsiproxy.sys/Makefile.in index b33ea0e4c8a..95f2a205816 100644 --- a/dlls/nsiproxy.sys/Makefile.in +++ b/dlls/nsiproxy.sys/Makefile.in @@ -1,8 +1,9 @@ MODULE = nsiproxy.sys -IMPORTS = ntoskrnl uuid +UNIXLIB = nsiproxy.so +IMPORTS = ntoskrnl EXTRALIBS = $(PROCSTAT_LIBS)
-EXTRADLLFLAGS = -Wl,--subsystem,native -mcygwin +EXTRADLLFLAGS = -Wl,--subsystem,native
C_SRCS = \ device.c \ diff --git a/dlls/nsiproxy.sys/device.c b/dlls/nsiproxy.sys/device.c index 80a025acfc9..ee2feec96be 100644 --- a/dlls/nsiproxy.sys/device.c +++ b/dlls/nsiproxy.sys/device.c @@ -32,10 +32,24 @@ #include "netiodef.h" #include "wine/nsi.h" #include "wine/debug.h" -#include "nsiproxy_private.h" +#include "wine/unixlib.h"
WINE_DEFAULT_DEBUG_CHANNEL(nsi);
+static unixlib_handle_t nsiproxy_handle; + +static NTSTATUS nsiproxy_call( unsigned int code, void *args ) +{ + return __wine_unix_call( nsiproxy_handle, code, args ); +} + +enum unix_calls +{ + nsi_enumerate_all_ex, + nsi_get_all_parameters_ex, + nsi_get_parameter_ex, +}; + static void nsiproxy_enumerate_all( IRP *irp ) { IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp ); @@ -73,7 +87,7 @@ static void nsiproxy_enumerate_all( IRP *irp ) enum_all.static_size = in->static_size; enum_all.count = in->count;
- irp->IoStatus.u.Status = nsi_enumerate_all_ex( &enum_all ); + irp->IoStatus.u.Status = nsiproxy_call( nsi_enumerate_all_ex, &enum_all ); if (irp->IoStatus.u.Status == STATUS_SUCCESS || irp->IoStatus.u.Status == STATUS_BUFFER_OVERFLOW) { irp->IoStatus.Information = out_len; @@ -119,7 +133,7 @@ static void nsiproxy_get_all_parameters( IRP *irp ) get_all.static_data = out + in->rw_size + in->dynamic_size; get_all.static_size = in->static_size;
- irp->IoStatus.u.Status = nsi_get_all_parameters_ex( &get_all ); + irp->IoStatus.u.Status = nsiproxy_call( nsi_get_all_parameters_ex, &get_all ); irp->IoStatus.Information = (irp->IoStatus.u.Status == STATUS_SUCCESS) ? out_len : 0; }
@@ -152,7 +166,7 @@ static void nsiproxy_get_parameter( IRP *irp ) get_param.data_size = out_len; get_param.data_offset = in->data_offset;
- irp->IoStatus.u.Status = nsi_get_parameter_ex( &get_param ); + irp->IoStatus.u.Status = nsiproxy_call( nsi_get_parameter_ex, &get_param ); irp->IoStatus.Information = irp->IoStatus.u.Status == STATUS_SUCCESS ? out_len : 0; }
@@ -215,8 +229,16 @@ static int add_device( DRIVER_OBJECT *driver )
NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) { + HMODULE instance; + NTSTATUS status; + TRACE( "(%p, %s)\n", driver, debugstr_w( path->Buffer ) );
+ RtlPcToFileHeader( &DriverEntry, (void *)&instance ); + status = NtQueryVirtualMemory( GetCurrentProcess(), instance, MemoryWineUnixFuncs, + &nsiproxy_handle, sizeof(nsiproxy_handle), NULL ); + if (status) return status; + driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = nsi_ioctl;
add_device( driver ); diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c index fe2bf29d7aa..7d734567c5b 100644 --- a/dlls/nsiproxy.sys/ip.c +++ b/dlls/nsiproxy.sys/ip.c @@ -18,6 +18,12 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep unix +#endif + +#define _NTSYSTEM_ + #include "config.h" #include <stdarg.h>
diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c index 73159a89805..7de343f00fe 100644 --- a/dlls/nsiproxy.sys/ndis.c +++ b/dlls/nsiproxy.sys/ndis.c @@ -18,6 +18,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep unix +#endif + #include "config.h"
#include <stdarg.h> @@ -85,6 +89,7 @@ #include "wine/nsi.h" #include "wine/list.h" #include "wine/debug.h" +#include "wine/unixlib.h"
#include "nsiproxy_private.h"
@@ -251,9 +256,9 @@ static WCHAR *strdupAtoW( const char *str ) DWORD len;
if (!str) return ret; - len = MultiByteToWideChar( CP_UNIXCP, 0, str, -1, NULL, 0 ); + len = strlen( str ) + 1; ret = malloc( len * sizeof(WCHAR) ); - if (ret) MultiByteToWideChar( CP_UNIXCP, 0, str, -1, ret, len ); + if (ret) ntdll_umbstowcs( str, len, ret, len ); return ret; }
diff --git a/dlls/nsiproxy.sys/nsi.c b/dlls/nsiproxy.sys/nsi.c index e29446abb50..ccfc325a085 100644 --- a/dlls/nsiproxy.sys/nsi.c +++ b/dlls/nsiproxy.sys/nsi.c @@ -17,6 +17,9 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep unix +#endif
#include <stdarg.h>
@@ -28,9 +31,11 @@ #include "winioctl.h" #include "ddk/wdm.h" #include "ifdef.h" +#define __WINE_INIT_NPI_MODULEID #include "netiodef.h" #include "wine/nsi.h" #include "wine/debug.h" +#include "wine/unixlib.h" #include "nsiproxy_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(nsi); @@ -121,3 +126,28 @@ NTSTATUS nsi_get_parameter_ex( struct nsi_get_parameter_ex *params ) return entry->get_parameter( params->key, params->key_size, params->param_type, params->data, params->data_size, params->data_offset ); } + +static NTSTATUS unix_nsi_enumerate_all_ex( void *args ) +{ + struct nsi_enumerate_all_ex *params = (struct nsi_enumerate_all_ex *)args; + return nsi_enumerate_all_ex( params ); +} + +static NTSTATUS unix_nsi_get_all_parameters_ex( void *args ) +{ + struct nsi_get_all_parameters_ex *params = (struct nsi_get_all_parameters_ex *)args; + return nsi_get_all_parameters_ex( params ); +} + +static NTSTATUS unix_nsi_get_parameter_ex( void *args ) +{ + struct nsi_get_parameter_ex *params = (struct nsi_get_parameter_ex *)args; + return nsi_get_parameter_ex( params ); +} + +const unixlib_entry_t __wine_unix_call_funcs[] = +{ + unix_nsi_enumerate_all_ex, + unix_nsi_get_all_parameters_ex, + unix_nsi_get_parameter_ex +}; diff --git a/dlls/nsiproxy.sys/tcp.c b/dlls/nsiproxy.sys/tcp.c index fcb57a5e6b2..f98ae3955b8 100644 --- a/dlls/nsiproxy.sys/tcp.c +++ b/dlls/nsiproxy.sys/tcp.c @@ -19,6 +19,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep unix +#endif + #include "config.h" #include <stdarg.h>
diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c index 87a4d487e0a..1c42912655e 100644 --- a/dlls/nsiproxy.sys/udp.c +++ b/dlls/nsiproxy.sys/udp.c @@ -18,6 +18,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep unix +#endif + #include "config.h" #include <stdarg.h> #include <stddef.h>