Remove unnecessary Src/ folders
This commit is contained in:
1 parent
43e618682e
commit
34692ab826
1026 files changed
+37648
-37646
No files matched your search
@@ -0,0 +1,52 @@
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// 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 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "../EXI_Device.h"
|
||||
#include "../EXI_DeviceEthernet.h"
|
||||
|
||||
bool CEXIETHERNET::Activate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CEXIETHERNET::Deactivate()
|
||||
{
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::IsActivated()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::SendFrame(u8 *, u32)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::RecvInit()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::RecvStart()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CEXIETHERNET::RecvStop()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// 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 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "StringUtil.h"
|
||||
#include "../EXI_Device.h"
|
||||
#include "../EXI_DeviceEthernet.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <fcntl.h>
|
||||
#include <linux/if_tun.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#define NOTIMPLEMENTED(Name) \
|
||||
NOTICE_LOG(SP1, "CEXIETHERNET::%s not implemented for your UNIX", Name);
|
||||
|
||||
bool CEXIETHERNET::Activate()
|
||||
{
|
||||
#ifdef __linux__
|
||||
if (IsActivated())
|
||||
return true;
|
||||
|
||||
// Assumes that there is a TAP device named "Dolphin" preconfigured for
|
||||
// bridge/NAT/whatever the user wants it configured.
|
||||
|
||||
if ((fd = open("/dev/net/tun", O_RDWR)) < 0)
|
||||
{
|
||||
ERROR_LOG(SP1, "Couldn't open /dev/net/tun, unable to init BBA");
|
||||
return false;
|
||||
}
|
||||
|
||||
struct ifreq ifr;
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE;
|
||||
|
||||
strncpy(ifr.ifr_name, "Dolphin", IFNAMSIZ);
|
||||
|
||||
int err;
|
||||
if ((err = ioctl(fd, TUNSETIFF, (void*)&ifr)) < 0)
|
||||
{
|
||||
close(fd);
|
||||
fd = -1;
|
||||
ERROR_LOG(SP1, "TUNSETIFF failed: err=%d", err);
|
||||
return false;
|
||||
}
|
||||
ioctl(fd, TUNSETNOCSUM, 1);
|
||||
|
||||
readEnabled = false;
|
||||
|
||||
INFO_LOG(SP1, "BBA initialized with associated tap %s", ifr.ifr_name);
|
||||
return true;
|
||||
#else
|
||||
NOTIMPLEMENTED("Activate");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CEXIETHERNET::Deactivate()
|
||||
{
|
||||
#ifdef __linux__
|
||||
close(fd);
|
||||
fd = -1;
|
||||
|
||||
readEnabled = false;
|
||||
if (readThread.joinable())
|
||||
readThread.join();
|
||||
#else
|
||||
NOTIMPLEMENTED("Deactivate");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::IsActivated()
|
||||
{
|
||||
#ifdef __linux__
|
||||
return fd != -1 ? true : false;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::SendFrame(u8* frame, u32 size)
|
||||
{
|
||||
#ifdef __linux__
|
||||
INFO_LOG(SP1, "SendFrame %x\n%s", size, ArrayToString(frame, size, 0x10).c_str());
|
||||
|
||||
int writtenBytes = write(fd, frame, size);
|
||||
if ((u32)writtenBytes != size)
|
||||
{
|
||||
ERROR_LOG(SP1, "SendFrame(): expected to write %d bytes, instead wrote %d",
|
||||
size, writtenBytes);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendComplete();
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
NOTIMPLEMENTED("SendFrame");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReadThreadHandler(CEXIETHERNET* self)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (self->fd < 0)
|
||||
return;
|
||||
|
||||
fd_set rfds;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(self->fd, &rfds);
|
||||
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 50000;
|
||||
if (select(self->fd + 1, &rfds, NULL, NULL, &timeout) <= 0)
|
||||
continue;
|
||||
|
||||
int readBytes = read(self->fd, self->mRecvBuffer, BBA_RECV_SIZE);
|
||||
if (readBytes < 0)
|
||||
{
|
||||
ERROR_LOG(SP1, "Failed to read from BBA, err=%d", readBytes);
|
||||
}
|
||||
else if (self->readEnabled)
|
||||
{
|
||||
INFO_LOG(SP1, "Read data: %s", ArrayToString(self->mRecvBuffer, readBytes, 0x10).c_str());
|
||||
self->mRecvBufferLength = readBytes;
|
||||
self->RecvHandlePacket();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::RecvInit()
|
||||
{
|
||||
#ifdef __linux__
|
||||
readThread = std::thread(ReadThreadHandler, this);
|
||||
return true;
|
||||
#else
|
||||
NOTIMPLEMENTED("RecvInit");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::RecvStart()
|
||||
{
|
||||
#ifdef __linux__
|
||||
if (!readThread.joinable())
|
||||
RecvInit();
|
||||
|
||||
readEnabled = true;
|
||||
return true;
|
||||
#else
|
||||
NOTIMPLEMENTED("RecvStart");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CEXIETHERNET::RecvStop()
|
||||
{
|
||||
#ifdef __linux__
|
||||
readEnabled = false;
|
||||
#else
|
||||
NOTIMPLEMENTED("RecvStop");
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "StringUtil.h"
|
||||
// GROSS CODE ALERT: headers need to be included in the following order
|
||||
#include "TAP_Win32.h"
|
||||
#include "../EXI_Device.h"
|
||||
#include "../EXI_DeviceEthernet.h"
|
||||
|
||||
namespace Win32TAPHelper
|
||||
{
|
||||
|
||||
bool IsTAPDevice(const TCHAR *guid)
|
||||
{
|
||||
HKEY netcard_key;
|
||||
LONG status;
|
||||
DWORD len;
|
||||
int i = 0;
|
||||
|
||||
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ADAPTER_KEY, 0, KEY_READ, &netcard_key);
|
||||
|
||||
if (status != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
TCHAR enum_name[256];
|
||||
TCHAR unit_string[256];
|
||||
HKEY unit_key;
|
||||
TCHAR component_id_string[] = _T("ComponentId");
|
||||
TCHAR component_id[256];
|
||||
TCHAR net_cfg_instance_id_string[] = _T("NetCfgInstanceId");
|
||||
TCHAR net_cfg_instance_id[256];
|
||||
DWORD data_type;
|
||||
|
||||
len = sizeof(enum_name);
|
||||
status = RegEnumKeyEx(netcard_key, i, enum_name, &len, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (status == ERROR_NO_MORE_ITEMS)
|
||||
break;
|
||||
else if (status != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
_sntprintf(unit_string, sizeof(unit_string), _T("%s\\%s"), ADAPTER_KEY, enum_name);
|
||||
|
||||
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, unit_string, 0, KEY_READ, &unit_key);
|
||||
|
||||
if (status != ERROR_SUCCESS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
len = sizeof(component_id);
|
||||
status = RegQueryValueEx(unit_key, component_id_string, NULL,
|
||||
&data_type, (LPBYTE)component_id, &len);
|
||||
|
||||
if (!(status != ERROR_SUCCESS || data_type != REG_SZ))
|
||||
{
|
||||
len = sizeof(net_cfg_instance_id);
|
||||
status = RegQueryValueEx(unit_key, net_cfg_instance_id_string, NULL,
|
||||
&data_type, (LPBYTE)net_cfg_instance_id, &len);
|
||||
|
||||
if (status == ERROR_SUCCESS && data_type == REG_SZ)
|
||||
{
|
||||
if (!_tcscmp(component_id, TAP_COMPONENT_ID) &&
|
||||
!_tcscmp(net_cfg_instance_id, guid))
|
||||
{
|
||||
RegCloseKey(unit_key);
|
||||
RegCloseKey(netcard_key);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
RegCloseKey(unit_key);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
RegCloseKey(netcard_key);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
|
||||
{
|
||||
LONG status;
|
||||
HKEY control_net_key;
|
||||
DWORD len;
|
||||
int i = 0;
|
||||
bool found_all = false;
|
||||
|
||||
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &control_net_key);
|
||||
|
||||
if (status != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
while (!found_all)
|
||||
{
|
||||
TCHAR enum_name[256];
|
||||
TCHAR connection_string[256];
|
||||
HKEY connection_key;
|
||||
TCHAR name_data[256];
|
||||
DWORD name_type;
|
||||
const TCHAR name_string[] = _T("Name");
|
||||
|
||||
len = sizeof(enum_name);
|
||||
status = RegEnumKeyEx(control_net_key, i, enum_name,
|
||||
&len, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (status == ERROR_NO_MORE_ITEMS)
|
||||
break;
|
||||
else if (status != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
_sntprintf(connection_string, sizeof(connection_string),
|
||||
_T("%s\\%s\\Connection"), NETWORK_CONNECTIONS_KEY, enum_name);
|
||||
|
||||
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, connection_string,
|
||||
0, KEY_READ, &connection_key);
|
||||
|
||||
if (status == ERROR_SUCCESS)
|
||||
{
|
||||
len = sizeof(name_data);
|
||||
status = RegQueryValueEx(connection_key, name_string, NULL,
|
||||
&name_type, (LPBYTE)name_data, &len);
|
||||
|
||||
if (status != ERROR_SUCCESS || name_type != REG_SZ)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsTAPDevice(enum_name))
|
||||
{
|
||||
guids.push_back(enum_name);
|
||||
//found_all = true;
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(connection_key);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
RegCloseKey(control_net_key);
|
||||
|
||||
//if (!found_all)
|
||||
//return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenTAP(HANDLE& adapter, const std::basic_string<TCHAR>& device_guid)
|
||||
{
|
||||
auto const device_path = USERMODEDEVICEDIR + device_guid + TAPSUFFIX;
|
||||
|
||||
adapter = CreateFile(device_path.c_str(), GENERIC_READ | GENERIC_WRITE, 0, 0,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0);
|
||||
|
||||
if (adapter == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
INFO_LOG(SP1, "Failed to open TAP at %s", device_path);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Win32TAPHelper
|
||||
|
||||
bool CEXIETHERNET::Activate()
|
||||
{
|
||||
if (IsActivated())
|
||||
return true;
|
||||
|
||||
DWORD len;
|
||||
std::vector<std::basic_string<TCHAR>> device_guids;
|
||||
|
||||
if (!Win32TAPHelper::GetGUIDs(device_guids))
|
||||
{
|
||||
ERROR_LOG(SP1, "Failed to find a TAP GUID");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < device_guids.size(); i++)
|
||||
{
|
||||
if (Win32TAPHelper::OpenTAP(mHAdapter, device_guids.at(i)))
|
||||
{
|
||||
INFO_LOG(SP1, "OPENED %s", device_guids.at(i).c_str());
|
||||
i = device_guids.size();
|
||||
}
|
||||
}
|
||||
if (mHAdapter == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
PanicAlert("Failed to open any TAP");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* get driver version info */
|
||||
ULONG info[3];
|
||||
if (DeviceIoControl(mHAdapter, TAP_IOCTL_GET_VERSION,
|
||||
&info, sizeof(info), &info, sizeof(info), &len, NULL))
|
||||
{
|
||||
INFO_LOG(SP1, "TAP-Win32 Driver Version %d.%d %s",
|
||||
info[0], info[1], info[2] ? "(DEBUG)" : "");
|
||||
}
|
||||
if (!(info[0] > TAP_WIN32_MIN_MAJOR || (info[0] == TAP_WIN32_MIN_MAJOR && info[1] >= TAP_WIN32_MIN_MINOR)))
|
||||
{
|
||||
PanicAlertT("ERROR: This version of Dolphin requires a TAP-Win32 driver"
|
||||
" that is at least version %d.%d -- If you recently upgraded your Dolphin"
|
||||
" distribution, a reboot is probably required at this point to get"
|
||||
" Windows to see the new driver.",
|
||||
TAP_WIN32_MIN_MAJOR, TAP_WIN32_MIN_MINOR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* set driver media status to 'connected' */
|
||||
ULONG status = TRUE;
|
||||
if (!DeviceIoControl(mHAdapter, TAP_IOCTL_SET_MEDIA_STATUS,
|
||||
&status, sizeof(status), &status, sizeof(status), &len, NULL))
|
||||
{
|
||||
ERROR_LOG(SP1, "WARNING: The TAP-Win32 driver rejected a"
|
||||
"TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEXIETHERNET::Deactivate()
|
||||
{
|
||||
if (!IsActivated())
|
||||
return;
|
||||
|
||||
RecvStop();
|
||||
|
||||
CloseHandle(mHAdapter);
|
||||
mHAdapter = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::IsActivated()
|
||||
{
|
||||
return mHAdapter != INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::SendFrame(u8 *frame, u32 size)
|
||||
{
|
||||
DEBUG_LOG(SP1, "SendFrame %x\n%s",
|
||||
size, ArrayToString(frame, size, 0x10).c_str());
|
||||
|
||||
DWORD numBytesWrit;
|
||||
OVERLAPPED overlap;
|
||||
ZeroMemory(&overlap, sizeof(overlap));
|
||||
|
||||
if (!WriteFile(mHAdapter, frame, size, &numBytesWrit, &overlap))
|
||||
{
|
||||
DWORD res = GetLastError();
|
||||
ERROR_LOG(SP1, "Failed to send packet with error 0x%X", res);
|
||||
}
|
||||
|
||||
if (numBytesWrit != size)
|
||||
{
|
||||
ERROR_LOG(SP1, "BBA SendFrame %i only got %i bytes sent!", size, numBytesWrit);
|
||||
}
|
||||
|
||||
// Always report the packet as being sent successfully, even though it might be a lie
|
||||
SendComplete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
VOID CALLBACK CEXIETHERNET::ReadWaitCallback(PVOID lpParameter, BOOLEAN TimerFired)
|
||||
{
|
||||
CEXIETHERNET* self = (CEXIETHERNET*)lpParameter;
|
||||
|
||||
GetOverlappedResult(self->mHAdapter, &self->mReadOverlapped,
|
||||
(LPDWORD)&self->mRecvBufferLength, false);
|
||||
|
||||
self->RecvHandlePacket();
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::RecvInit()
|
||||
{
|
||||
// Set up recv event
|
||||
|
||||
if ((mHRecvEvent = CreateEvent(NULL, false, false, NULL)) == NULL)
|
||||
{
|
||||
ERROR_LOG(SP1, "Failed to create recv event:%x", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
ZeroMemory(&mReadOverlapped, sizeof(mReadOverlapped));
|
||||
|
||||
RegisterWaitForSingleObject(&mHReadWait, mHRecvEvent, ReadWaitCallback,
|
||||
this, INFINITE, WT_EXECUTEDEFAULT);
|
||||
|
||||
mReadOverlapped.hEvent = mHRecvEvent;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::RecvStart()
|
||||
{
|
||||
if (!IsActivated())
|
||||
return false;
|
||||
|
||||
if (mHRecvEvent == INVALID_HANDLE_VALUE)
|
||||
RecvInit();
|
||||
|
||||
DWORD res = ReadFile(mHAdapter, mRecvBuffer, BBA_RECV_SIZE,
|
||||
(LPDWORD)&mRecvBufferLength, &mReadOverlapped);
|
||||
|
||||
if (!res && (GetLastError() != ERROR_IO_PENDING))
|
||||
{
|
||||
// error occurred
|
||||
return false;
|
||||
}
|
||||
|
||||
if (res)
|
||||
{
|
||||
// Completed immediately
|
||||
RecvHandlePacket();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEXIETHERNET::RecvStop()
|
||||
{
|
||||
if (!IsActivated())
|
||||
return;
|
||||
|
||||
UnregisterWaitEx(mHReadWait, INVALID_HANDLE_VALUE);
|
||||
|
||||
CloseHandle(mHRecvEvent);
|
||||
mHRecvEvent = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* TAP-Win32 -- A kernel driver to provide virtual tap device functionality
|
||||
* on Windows. Originally derived from the CIPE-Win32
|
||||
* project by Damion K. Wilson, with extensive modifications by
|
||||
* James Yonan.
|
||||
*
|
||||
* All source code which derives from the CIPE-Win32 project is
|
||||
* Copyright (C) Damion K. Wilson, 2003, and is released under the
|
||||
* GPL version 2 (see below).
|
||||
*
|
||||
* All other source code is Copyright (C) 2002-2005 OpenVPN Solutions LLC,
|
||||
* 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
|
||||
*/
|
||||
|
||||
//===============================================
|
||||
// This file is included both by OpenVPN and
|
||||
// the TAP-Win32 driver and contains definitions
|
||||
// common to both.
|
||||
//===============================================
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <winioctl.h>
|
||||
#define TAP_WIN32_MIN_MAJOR 9
|
||||
#define TAP_WIN32_MIN_MINOR 0
|
||||
|
||||
//=============
|
||||
// TAP IOCTLs
|
||||
//=============
|
||||
|
||||
#define TAP_CONTROL_CODE(request,method) \
|
||||
CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
|
||||
|
||||
// Present in 8.1
|
||||
|
||||
#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED)
|
||||
#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED)
|
||||
#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED)
|
||||
#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED)
|
||||
#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED)
|
||||
#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED)
|
||||
#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED)
|
||||
#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED)
|
||||
#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED)
|
||||
|
||||
// Added in 8.2
|
||||
|
||||
/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */
|
||||
#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED)
|
||||
|
||||
//=================
|
||||
// Registry keys
|
||||
//=================
|
||||
|
||||
#define ADAPTER_KEY _T("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}")
|
||||
|
||||
#define NETWORK_CONNECTIONS_KEY _T("SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}")
|
||||
|
||||
//======================
|
||||
// Filesystem prefixes
|
||||
//======================
|
||||
|
||||
#define USERMODEDEVICEDIR _T("\\\\.\\Global\\")
|
||||
#define SYSDEVICEDIR _T("\\Device\\")
|
||||
#define USERDEVICEDIR _T("\\DosDevices\\Global\\")
|
||||
#define TAPSUFFIX _T(".tap")
|
||||
|
||||
//=========================================================
|
||||
// TAP_COMPONENT_ID -- This string defines the TAP driver
|
||||
// type -- different component IDs can reside in the system
|
||||
// simultaneously.
|
||||
//=========================================================
|
||||
|
||||
#define TAP_COMPONENT_ID _T("tap0901")
|
||||
Reference in new issue
Block a user