nsiproxy: Build with msvcrt.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-10-01 15:07:06 +01:00 committed by Alexandre Julliard
parent f6917badf1
commit 37097b9687
9 changed files with 82 additions and 14 deletions

1
configure vendored
View File

@ -8343,7 +8343,6 @@ if test "x$ac_cv_cflags__Wl___disable_stdcall_fixup" = xyes; then :
fi ;;
esac
enable_iphlpapi=${enable_iphlpapi:-no}
enable_nsiproxy_sys=${enable_nsiproxy_sys:-no}
enable_loader=${enable_loader:-no}
enable_server=${enable_server:-no}
with_x=${with_x:-no}

View File

@ -725,7 +725,6 @@ case $host_os in
esac
dnl Disable modules that can't be used on Windows
enable_iphlpapi=${enable_iphlpapi:-no}
enable_nsiproxy_sys=${enable_nsiproxy_sys:-no}
enable_loader=${enable_loader:-no}
enable_server=${enable_server:-no}
dnl Disable dependencies that are not useful on Windows

View File

@ -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 \

View File

@ -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;
}
@ -193,14 +207,12 @@ static NTSTATUS WINAPI nsi_ioctl( DEVICE_OBJECT *device, IRP *irp )
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 );
RtlInitUnicodeString( &name, L"\\Device\\Nsi" );
RtlInitUnicodeString( &link, L"\\??\\Nsi" );
if (!(status = IoCreateDevice( driver, 0, &name, FILE_DEVICE_NETWORK, FILE_DEVICE_SECURE_OPEN, FALSE, &device )))
status = IoCreateSymbolicLink( &link, &name );
@ -215,8 +227,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 );

View File

@ -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>

View File

@ -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;
}

View File

@ -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
};

View File

@ -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>

View File

@ -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>