mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00

* taptun: add support for Windows Looking for feedback only at this point, because it's the first time I've attempted any OSD stuff - be gentle. This extends the existing taptun OSD module to support Windows through the TAP-Windows6 driver (https://github.com/OpenVPN/tap-windows6). * TAP-Windows6 is GPLv2, however only the header file is required in MAME, and the driver itself is entirely optional. * I've tried to minimise the size of the diff, rather than completely separate the Windows/non-Windows implementations - not sure which is preferable in this case. * The license file has Mac(?) line-endings - unsure if they should be normalized or used verbatim. * Uncertain about the non-Windows case (or the Windows SDL case) - existing code uses __linux__, but I'm not clear on how that works with OSX, for example? * I can't claim this actually "works" yet, because I don't know enough to configure the tap end of it properly to get networking doing something useful, but I will get there and correct anything necessary in a subsequent real PR. * minor fixes/improvements (nw) * Use Unicode Windows APIs, and UTF-8 for MAME * Deal with unterminated registry string values * Cancel any pending I/O in destructor
75 lines
2.7 KiB
C
75 lines
2.7 KiB
C
/*
|
|
* TAP-Windows -- A kernel driver to provide virtual tap
|
|
* device functionality on Windows.
|
|
*
|
|
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
|
|
*
|
|
* This source code is Copyright (C) 2002-2014 OpenVPN Technologies, Inc.,
|
|
* and is released under the GPL version 2 (see below).
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* This program 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program (see the file COPYING included with this
|
|
* distribution); if not, write to the Free Software Foundation, Inc.,
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
#ifndef __TAP_WIN_H
|
|
#define __TAP_WIN_H
|
|
|
|
/*
|
|
* =============
|
|
* TAP IOCTLs
|
|
* =============
|
|
*/
|
|
|
|
#define TAP_WIN_CONTROL_CODE(request,method) \
|
|
CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
|
|
|
|
/* Present in 8.1 */
|
|
|
|
#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED)
|
|
#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED)
|
|
#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED)
|
|
#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED)
|
|
#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED)
|
|
#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED)
|
|
#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED)
|
|
#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED)
|
|
#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED)
|
|
|
|
/* Added in 8.2 */
|
|
|
|
/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
|
|
#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)
|
|
|
|
/*
|
|
* =================
|
|
* Registry keys
|
|
* =================
|
|
*/
|
|
|
|
#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
|
|
|
|
#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
|
|
|
|
/*
|
|
* ======================
|
|
* Filesystem prefixes
|
|
* ======================
|
|
*/
|
|
|
|
#define USERMODEDEVICEDIR "\\\\.\\Global\\"
|
|
#define SYSDEVICEDIR "\\Device\\"
|
|
#define USERDEVICEDIR "\\DosDevices\\Global\\"
|
|
#define TAP_WIN_SUFFIX ".tap"
|
|
|
|
#endif // __TAP_WIN_H
|