Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/Neo6
diff options
context:
space:
mode:
authordnobori <da.git@softether.co.jp>2014-01-04 17:00:08 +0400
committerdnobori <da.git@softether.co.jp>2014-01-04 17:00:08 +0400
commit749497dde0a1dd08c434a73b9d4e93dc3e3326d9 (patch)
tree7c83a55919c0f1aa1267c4dbcd008f1644f961ee /src/Neo6
parentd433e567a561f8ae094a535025b02c7dc47026c6 (diff)
v4.03-9408-rtm
Diffstat (limited to 'src/Neo6')
-rw-r--r--src/Neo6/NDIS6.c1745
-rw-r--r--src/Neo6/NDIS6.h239
-rw-r--r--src/Neo6/Neo6.c499
-rw-r--r--src/Neo6/Neo6.h320
-rw-r--r--src/Neo6/Neo6.rc63
-rw-r--r--src/Neo6/Neo6.vcproj282
-rw-r--r--src/Neo6/resource.h84
7 files changed, 3232 insertions, 0 deletions
diff --git a/src/Neo6/NDIS6.c b/src/Neo6/NDIS6.c
new file mode 100644
index 00000000..bb9e8b35
--- /dev/null
+++ b/src/Neo6/NDIS6.c
@@ -0,0 +1,1745 @@
+// SoftEther VPN Source Code
+// Kernel Device Driver
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// 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 version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+// NDIS6.c
+// Windows NDIS 6.2 Routine
+
+#include <GlobalConst.h>
+
+#define NEO_DEVICE_DRIVER
+
+#include "Neo6.h"
+
+static UINT64 max_speed = NEO_MAX_SPEED_DEFAULT;
+static bool keep_link = false;
+
+BOOLEAN
+PsGetVersion(
+ PULONG MajorVersion OPTIONAL,
+ PULONG MinorVersion OPTIONAL,
+ PULONG BuildNumber OPTIONAL,
+ PUNICODE_STRING CSDVersion OPTIONAL
+ );
+
+// Memory related
+static NDIS_PHYSICAL_ADDRESS HighestAcceptableMax = NDIS_PHYSICAL_ADDRESS_CONST(-1, -1);
+NDIS_HANDLE ndis_miniport_driver_handle = NULL;
+
+// Flag for whether Windows 8
+bool g_is_win8 = false;
+
+// Win32 driver entry point
+NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath)
+{
+ NDIS_MINIPORT_DRIVER_CHARACTERISTICS miniport;
+ ULONG os_major_ver = 0, os_minor_ver = 0;
+ NDIS_STATUS ret;
+
+ // Initialize the Neo library
+ if (NeoInit() == FALSE)
+ {
+ // Initialization Failed
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ g_is_win8 = false;
+
+ // Get the OS version
+ PsGetVersion(&os_major_ver, &os_minor_ver, NULL, NULL);
+
+ if (os_major_ver >= 7 || (os_major_ver == 6 && os_minor_ver >= 2))
+ {
+ // Windows 8
+ g_is_win8 = true;
+ }
+
+ // Register a NDIS miniport driver
+ NeoZero(&miniport, sizeof(NDIS_MINIPORT_DRIVER_CHARACTERISTICS));
+
+ miniport.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS;
+ miniport.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2;
+ miniport.Header.Size = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2;
+
+ miniport.MajorNdisVersion = NEO_NDIS_MAJOR_VERSION;
+ miniport.MinorNdisVersion = NEO_NDIS_MINOR_VERSION;
+
+ // Register the handler
+ miniport.InitializeHandlerEx = NeoNdisInitEx;
+ miniport.HaltHandlerEx = NeoNdisHaltEx;
+ miniport.OidRequestHandler = NeoNdisOidRequest;
+ miniport.ResetHandlerEx = NeoNdisResetEx;
+ miniport.CheckForHangHandlerEx = NeoNdisCheckForHangEx;
+ miniport.UnloadHandler = NeoNdisDriverUnload;
+ miniport.SendNetBufferListsHandler = NeoNdisSendNetBufferLists;
+
+ miniport.SetOptionsHandler = NeoNdisSetOptions;
+ miniport.PauseHandler = NeoNdisPause;
+ miniport.RestartHandler = NeoNdisRestart;
+ miniport.ReturnNetBufferListsHandler = NeoNdisReturnNetBufferLists;
+ miniport.CancelSendHandler = NeoNdisCancelSend;
+ miniport.DevicePnPEventNotifyHandler = NeoNdisDevicePnPEventNotify;
+ miniport.ShutdownHandlerEx = NeoNdisShutdownEx;
+ miniport.CancelOidRequestHandler = NeoNdisCancelOidRequest;
+
+ ret = NdisMRegisterMiniportDriver(DriverObject, RegistryPath,
+ NULL, &miniport, &ndis_miniport_driver_handle);
+
+ if (NG(ret))
+ {
+ // Registration failure
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ // Initialization success
+ return STATUS_SUCCESS;
+}
+
+NDIS_STATUS NeoNdisSetOptions(NDIS_HANDLE NdisDriverHandle, NDIS_HANDLE DriverContext)
+{
+ return NDIS_STATUS_SUCCESS;
+}
+
+NDIS_STATUS NeoNdisPause(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_PAUSE_PARAMETERS MiniportPauseParameters)
+{
+ return NDIS_STATUS_SUCCESS;
+}
+
+NDIS_STATUS NeoNdisRestart(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_RESTART_PARAMETERS MiniportRestartParameters)
+{
+ return NDIS_STATUS_SUCCESS;
+}
+
+void NeoNdisReturnNetBufferLists(NDIS_HANDLE MiniportAdapterContext, PNET_BUFFER_LIST NetBufferLists, ULONG ReturnFlags)
+{
+}
+
+void NeoNdisCancelSend(NDIS_HANDLE MiniportAdapterContext, PVOID CancelId)
+{
+}
+
+void NeoNdisDevicePnPEventNotify(NDIS_HANDLE MiniportAdapterContext, PNET_DEVICE_PNP_EVENT NetDevicePnPEvent)
+{
+}
+
+void NeoNdisShutdownEx(NDIS_HANDLE MiniportAdapterContext, NDIS_SHUTDOWN_ACTION ShutdownAction)
+{
+}
+
+void NeoNdisCancelOidRequest(NDIS_HANDLE MiniportAdapterContext, PVOID RequestId)
+{
+}
+
+// Initialization handler of adapter
+NDIS_STATUS NeoNdisInitEx(NDIS_HANDLE MiniportAdapterHandle,
+ NDIS_HANDLE MiniportDriverContext,
+ PNDIS_MINIPORT_INIT_PARAMETERS MiniportInitParameters)
+{
+ NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES attr;
+ NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES gen;
+
+ if (ctx == NULL)
+ {
+ return NDIS_STATUS_FAILURE;
+ }
+
+ if (ctx->NdisMiniportDriverHandle == NULL)
+ {
+ ctx->NdisMiniportDriverHandle = ndis_miniport_driver_handle;
+ }
+
+ // Prevention of multiple start
+ if (ctx->Initing != FALSE)
+ {
+ // Multiple started
+ return NDIS_STATUS_FAILURE;
+ }
+ ctx->Initing = TRUE;
+
+ // Examine whether it has already been initialized
+ if (ctx->Inited != FALSE)
+ {
+ // Driver is started on another instance already.
+ // VPN driver can start only one instance per one service.
+ // User can start multiple drivers with different instance ID
+ return NDIS_STATUS_FAILURE;
+ }
+
+ // Current value of the packet filter
+ ctx->CurrentPacketFilter = NDIS_PACKET_TYPE_ALL_LOCAL | NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL;
+
+ // Initialize the adapter information
+ ctx->NdisMiniport = MiniportAdapterHandle;
+ ctx->NdisContext = ctx;
+ ctx->HardwareStatus = NdisHardwareStatusReady;
+ ctx->Halting = FALSE;
+ ctx->Connected = ctx->ConnectedOld = FALSE;
+
+ if (keep_link == false)
+ {
+ ctx->ConnectedForce = TRUE;
+ }
+
+ // Read the information from the registry
+ if (NeoLoadRegistory() == FALSE)
+ {
+ // Failure
+ ctx->Initing = FALSE;
+ return NDIS_STATUS_FAILURE;
+ }
+
+ // Register the device attributes
+ NeoZero(&attr, sizeof(attr));
+ attr.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES;
+ attr.Header.Revision = NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1;
+ attr.Header.Size = sizeof(NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES);
+ attr.AttributeFlags = NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND;
+ attr.InterfaceType = NdisInterfaceInternal;
+ attr.MiniportAdapterContext = ctx->NdisContext;
+
+ NdisMSetMiniportAttributes(ctx->NdisMiniport, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&attr);
+
+ NeoZero(&gen, sizeof(gen));
+ gen.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES;
+ gen.Header.Revision = NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2;
+ gen.Header.Size = NDIS_SIZEOF_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2;
+ gen.MediaType = NdisMedium802_3;
+ gen.PhysicalMediumType = NdisPhysicalMedium802_3;
+ gen.MtuSize = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE;
+ gen.MaxXmitLinkSpeed = gen.MaxRcvLinkSpeed = max_speed;
+ gen.RcvLinkSpeed = gen.XmitLinkSpeed = max_speed;
+ gen.MediaConnectState = MediaConnectStateDisconnected;
+ gen.LookaheadSize = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE;
+ gen.MacOptions = NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | NDIS_MAC_OPTION_NO_LOOPBACK;
+ gen.SupportedPacketFilters = NDIS_PACKET_TYPE_ALL_LOCAL | NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL;
+ gen.MaxMulticastListSize = NEO_MAX_MULTICASE;
+ gen.MacAddressLength = NEO_MAC_ADDRESS_SIZE;
+ NeoCopy(gen.PermanentMacAddress, ctx->MacAddress, NEO_MAC_ADDRESS_SIZE);
+ NeoCopy(gen.CurrentMacAddress, ctx->MacAddress, NEO_MAC_ADDRESS_SIZE);
+ gen.AccessType = NET_IF_ACCESS_BROADCAST;
+ gen.DirectionType = NET_IF_DIRECTION_SENDRECEIVE;
+ gen.ConnectionType = NET_IF_CONNECTION_DEDICATED;
+ gen.IfType = IF_TYPE_ETHERNET_CSMACD;
+ gen.IfConnectorPresent = TRUE;
+ gen.SupportedStatistics =
+ NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_BYTES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_RCV_DISCARDS |
+ NDIS_STATISTICS_FLAGS_VALID_RCV_ERROR |
+ NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_BYTES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_XMIT_ERROR |
+ NDIS_STATISTICS_FLAGS_VALID_XMIT_DISCARDS |
+ NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_XMIT;
+ gen.SupportedPauseFunctions = NdisPauseFunctionsUnsupported;
+ gen.AutoNegotiationFlags = NDIS_LINK_STATE_XMIT_LINK_SPEED_AUTO_NEGOTIATED |
+ NDIS_LINK_STATE_RCV_LINK_SPEED_AUTO_NEGOTIATED |
+ NDIS_LINK_STATE_DUPLEX_AUTO_NEGOTIATED |
+ NDIS_LINK_STATE_PAUSE_FUNCTIONS_AUTO_NEGOTIATED;
+ gen.SupportedOidList = SupportedOids;
+ gen.SupportedOidListLength = sizeof(SupportedOids);
+
+ NdisMSetMiniportAttributes(ctx->NdisMiniport, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&gen);
+
+ // Initialize the received packet array
+ NeoInitPacketArray();
+
+ // Initialize the control device
+ NeoInitControlDevice();
+
+ // Start the adapter
+ NeoStartAdapter();
+
+ // Flag setting
+ ctx->Initing = FALSE;
+ ctx->Inited = TRUE;
+
+ // Notify the connection state
+ NeoSetConnectState(FALSE);
+
+ return NDIS_STATUS_SUCCESS;
+}
+
+// Open the device
+BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack)
+{
+ char name[MAX_SIZE];
+
+ if (ctx == NULL)
+ {
+ return FALSE;
+ }
+
+ if (ctx->Opened != FALSE)
+ {
+ // Another client is connected already
+ return FALSE;
+ }
+ ctx->Opened = TRUE;
+
+ // Initialize the event name
+ sprintf(name, NDIS_NEO_EVENT_NAME, ctx->HardwareID);
+
+ // Register a Event
+ ctx->Event = NeoNewEvent(name);
+ if (ctx->Event == NULL)
+ {
+ ctx->Opened = FALSE;
+ return FALSE;
+ }
+
+ // Set the connection state
+ NeoSetConnectState(TRUE);
+
+ return TRUE;
+}
+
+// Close the device
+BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack)
+{
+ if (ctx == NULL)
+ {
+ return FALSE;
+ }
+
+ if (ctx->Opened == FALSE)
+ {
+ // Client is not connected
+ return FALSE;
+ }
+ ctx->Opened = FALSE;
+
+ // Release the event
+ NeoFreeEvent(ctx->Event);
+ ctx->Event = NULL;
+
+ // Release all packets
+ NeoClearPacketQueue();
+
+ NeoSetConnectState(FALSE);
+
+ return TRUE;
+}
+
+// Crash 2
+void NeoNdisCrash2(UINT a, UINT b, UINT c, UINT d)
+{
+ KeBugCheckEx(0x00000061, (ULONG_PTR)a, (ULONG_PTR)b, (ULONG_PTR)c, (ULONG_PTR)d);
+}
+
+// Crash
+void NeoNdisCrash()
+{
+ NEO_QUEUE *q;
+ q = (NEO_QUEUE *)0xACACACAC;
+ q->Size = 128;
+ NeoCopy(q->Buf, "ABCDEFG", 8);
+}
+
+// Dispatch table for control
+NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp)
+{
+ NTSTATUS status;
+ IO_STACK_LOCATION *stack;
+ void *buf;
+ BOOL ok;
+ status = STATUS_SUCCESS;
+
+ if (ctx == NULL)
+ {
+ return NDIS_STATUS_FAILURE;
+ }
+
+ // Get the IRP stack
+ stack = IoGetCurrentIrpStackLocation(Irp);
+
+ // Initialize the number of bytes
+ Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+
+ buf = Irp->UserBuffer;
+
+ if (ctx->Halting != FALSE)
+ {
+ // Device driver is terminating
+ Irp->IoStatus.Information = STATUS_UNSUCCESSFUL;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ // Branch to each operation
+ switch (stack->MajorFunction)
+ {
+ case IRP_MJ_CREATE:
+ // Device is opened
+ if (NeoNdisOnOpen(Irp, stack) == FALSE)
+ {
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ status = STATUS_UNSUCCESSFUL;
+ }
+ break;
+
+ case IRP_MJ_CLOSE:
+ // Device is closed
+ if (NeoNdisOnClose(Irp, stack) == FALSE)
+ {
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ status = STATUS_UNSUCCESSFUL;
+ }
+ break;
+
+ case IRP_MJ_READ:
+ // Read (Reading of the received packet)
+ ok = false;
+ if (buf != NULL)
+ {
+ if (ctx->Opened && ctx->Inited)
+ {
+ if (stack->Parameters.Read.Length == NEO_EXCHANGE_BUFFER_SIZE)
+ {
+ // Address check
+ MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL);
+
+ if (mdl != NULL)
+ {
+ MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess);
+ }
+
+ if (NeoIsKernelAddress(buf) == FALSE)
+ {
+ // Read
+ NeoRead(buf);
+ Irp->IoStatus.Information = NEO_EXCHANGE_BUFFER_SIZE;
+ ok = true;
+ }
+
+ if (mdl != NULL)
+ {
+ MmUnlockPages(mdl);
+ IoFreeMdl(mdl);
+ }
+ }
+ }
+ }
+ if (ok == FALSE)
+ {
+ // An error occurred
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ status = STATUS_UNSUCCESSFUL;
+ }
+ break;
+
+ case IRP_MJ_WRITE:
+ // Write (Writing of a transmission packet)
+ ok = false;
+ if (buf != NULL)
+ {
+ if (ctx->Opened && ctx->Inited)
+ {
+ if (stack->Parameters.Write.Length == NEO_EXCHANGE_BUFFER_SIZE)
+ {
+ // Address check
+ MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL);
+
+ if (mdl != NULL)
+ {
+ MmProbeAndLockPages(mdl, KernelMode, IoReadAccess);
+ }
+
+ if (NeoIsKernelAddress(buf) == FALSE)
+ {
+ // Write
+ NeoWrite(buf);
+ Irp->IoStatus.Information = stack->Parameters.Write.Length;
+ ok = true;
+ }
+
+ if (mdl != NULL)
+ {
+ MmUnlockPages(mdl);
+ IoFreeMdl(mdl);
+ }
+ }
+ }
+ }
+ if (ok == FALSE)
+ {
+ // An error occurred
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ status = STATUS_UNSUCCESSFUL;
+ }
+ break;
+ }
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_SUCCESS;
+}
+
+// Initialize the control device
+void NeoInitControlDevice()
+{
+ char name_kernel[MAX_SIZE];
+ char name_win32[MAX_SIZE];
+ UNICODE *unicode_kernel, *unicode_win32;
+ DEVICE_OBJECT *control_device_object;
+ NDIS_HANDLE ndis_control_handle;
+ NDIS_DEVICE_OBJECT_ATTRIBUTES t;
+
+ if (ctx == NULL)
+ {
+ return;
+ }
+
+ // Initialize the dispatch table
+ NeoZero(ctx->DispatchTable, sizeof(PDRIVER_DISPATCH) * IRP_MJ_MAXIMUM_FUNCTION);
+
+ // Register the handler
+ ctx->DispatchTable[IRP_MJ_CREATE] =
+ ctx->DispatchTable[IRP_MJ_CLOSE] =
+ ctx->DispatchTable[IRP_MJ_READ] =
+ ctx->DispatchTable[IRP_MJ_WRITE] =
+ ctx->DispatchTable[IRP_MJ_DEVICE_CONTROL] = NeoNdisDispatch;
+ ctx->Opened = FALSE;
+
+ // Generate the device name
+ sprintf(name_kernel, NDIS_NEO_DEVICE_NAME, ctx->HardwareID);
+ unicode_kernel = NewUnicode(name_kernel);
+ sprintf(name_win32, NDIS_NEO_DEVICE_NAME_WIN32, ctx->HardwareID);
+ unicode_win32 = NewUnicode(name_win32);
+
+ // Register the device
+ NeoZero(&t, sizeof(t));
+ t.Header.Type = NDIS_OBJECT_TYPE_DEVICE_OBJECT_ATTRIBUTES;
+ t.Header.Revision = NDIS_DEVICE_OBJECT_ATTRIBUTES_REVISION_1;
+ t.Header.Size = NDIS_SIZEOF_DEVICE_OBJECT_ATTRIBUTES_REVISION_1;
+ t.DeviceName = GetUnicode(unicode_kernel);
+ t.SymbolicName = GetUnicode(unicode_win32);
+ t.MajorFunctions = ctx->DispatchTable;
+
+ NdisRegisterDeviceEx(ndis_miniport_driver_handle, &t,
+ &control_device_object,
+ &ndis_control_handle);
+
+ ctx->NdisControlDevice = control_device_object;
+ ctx->NdisControl = ndis_control_handle;
+
+ // Initialize the display name
+ if (strlen(ctx->HardwareID) > 11)
+ {
+ sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw + 11);
+ }
+ else
+ {
+ sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw);
+ }
+}
+
+// Release the control device
+void NeoFreeControlDevice()
+{
+ if (ctx == NULL)
+ {
+ return;
+ }
+
+ if (ctx->Opened != FALSE)
+ {
+ // Delete the event
+ NeoSet(ctx->Event);
+ NeoFreeEvent(ctx->Event);
+ ctx->Event = NULL;
+ ctx->Opened = FALSE;
+ }
+
+ // Delete the device
+ NdisDeregisterDeviceEx(ctx->NdisControl);
+}
+
+
+// Read the information from the registry
+BOOL NeoLoadRegistory()
+{
+ void *buf;
+ NDIS_STATUS ret;
+ UINT size;
+ NDIS_HANDLE config;
+ NDIS_CONFIGURATION_PARAMETER *param;
+ UNICODE *name;
+ ANSI_STRING ansi;
+ UNICODE_STRING *unicode;
+ UINT64 speed;
+ BOOL keep;
+ NDIS_CONFIGURATION_OBJECT config_obj;
+
+ // Get the Config handle
+ NeoZero(&config_obj, sizeof(config_obj));
+ config_obj.Header.Type = NDIS_OBJECT_TYPE_CONFIGURATION_OBJECT;
+ config_obj.Header.Revision = NDIS_CONFIGURATION_OBJECT_REVISION_1;
+ config_obj.Header.Size = NDIS_SIZEOF_CONFIGURATION_OBJECT_REVISION_1;
+ config_obj.NdisHandle = ctx->NdisMiniport;
+
+ ret = NdisOpenConfigurationEx(&config_obj, &config);
+ if (NG(ret))
+ {
+ // Failure
+ return FALSE;
+ }
+
+ // Read the MAC address
+ NdisReadNetworkAddress(&ret, &buf, &size, config);
+ if (NG(ret))
+ {
+ // Failure
+ NdisCloseConfiguration(config);
+ return FALSE;
+ }
+
+ // Copy the MAC address
+ if (size != NEO_MAC_ADDRESS_SIZE)
+ {
+ // Invalid size
+ NdisCloseConfiguration(config);
+ return FALSE;
+ }
+ NeoCopy(ctx->MacAddress, buf, NEO_MAC_ADDRESS_SIZE);
+
+ if (ctx->MacAddress[0] == 0x00 &&
+ ctx->MacAddress[1] == 0x00 &&
+ ctx->MacAddress[2] == 0x01 &&
+ ctx->MacAddress[3] == 0x00 &&
+ ctx->MacAddress[4] == 0x00 &&
+ ctx->MacAddress[5] == 0x01)
+ {
+ // Special MAC address
+ UINT ptr32 = (UINT)((UINT64)ctx);
+
+ ctx->MacAddress[0] = 0x00;
+ ctx->MacAddress[1] = 0xAD;
+ ctx->MacAddress[2] = ((UCHAR *)(&ptr32))[0];
+ ctx->MacAddress[3] = ((UCHAR *)(&ptr32))[1];
+ ctx->MacAddress[4] = ((UCHAR *)(&ptr32))[2];
+ ctx->MacAddress[5] = ((UCHAR *)(&ptr32))[3];
+ }
+
+ // Initialize the key name of the device name
+ name = NewUnicode("MatchingDeviceId");
+
+ // Read the hardware ID
+ NdisReadConfiguration(&ret, &param, config, GetUnicode(name), NdisParameterString);
+ FreeUnicode(name);
+ if (NG(ret))
+ {
+ // Failure
+ NdisCloseConfiguration(config);
+ return FALSE;
+ }
+ // Type checking
+ if (param->ParameterType != NdisParameterString)
+ {
+ // Failure
+ NdisCloseConfiguration(config);
+ return FALSE;
+ }
+ unicode = &param->ParameterData.StringData;
+
+ // Prepare a buffer for ANSI string
+ NeoZero(&ansi, sizeof(ANSI_STRING));
+ ansi.MaximumLength = MAX_SIZE - 1;
+ ansi.Buffer = NeoZeroMalloc(MAX_SIZE);
+
+ // Convert to ANSI string
+ NdisUnicodeStringToAnsiString(&ansi, unicode);
+ // Copy
+ strcpy(ctx->HardwareID, ansi.Buffer);
+ strcpy(ctx->HardwareID_Raw, ctx->HardwareID);
+ // Convert to upper case
+ _strupr(ctx->HardwareID);
+ // Release the memory
+ NeoFree(ansi.Buffer);
+
+ // Read the bit rate
+ name = NewUnicode("MaxSpeed");
+ NdisReadConfiguration(&ret, &param, config, GetUnicode(name), NdisParameterInteger);
+ FreeUnicode(name);
+
+ if (NG(ret) || param->ParameterType != NdisParameterInteger)
+ {
+ speed = NEO_MAX_SPEED_DEFAULT;
+ }
+ else
+ {
+ speed = (UINT64)param->ParameterData.IntegerData * 1000000ULL;
+ }
+
+ max_speed = speed;
+
+ // Read the link keeping flag
+ name = NewUnicode("KeepLink");
+ NdisReadConfiguration(&ret, &param, config, GetUnicode(name), NdisParameterInteger);
+ FreeUnicode(name);
+
+ if (NG(ret) || param->ParameterType != NdisParameterInteger)
+ {
+ keep = false;
+ }
+ else
+ {
+ keep = (param->ParameterData.IntegerData == 0 ? false : true);
+ }
+
+ keep_link = keep;
+
+ // Close the config handle
+ NdisCloseConfiguration(config);
+
+ return TRUE;
+}
+
+// Unload the driver
+VOID NeoNdisDriverUnload(PDRIVER_OBJECT DriverObject)
+{
+ NdisMDeregisterMiniportDriver(ndis_miniport_driver_handle);
+}
+
+// Stop handler of adapter
+void NeoNdisHaltEx(NDIS_HANDLE MiniportAdapterContext, NDIS_HALT_ACTION HaltAction)
+{
+ if (ctx == NULL)
+ {
+ return;
+ }
+
+ if (ctx->Halting != FALSE)
+ {
+ // That has already been stopped
+ return;
+ }
+ ctx->Halting = TRUE;
+
+ // Stop the adapter
+ NeoStopAdapter();
+
+ // Release the packet array
+ NeoFreePacketArray();
+
+ // Delete the control device
+ NeoFreeControlDevice();
+
+ // Complete to stop
+ ctx->Initing = ctx->Inited = FALSE;
+ ctx->Connected = ctx->ConnectedForce = ctx->ConnectedOld = FALSE;
+ ctx->Halting = FALSE;
+
+ // Shutdown of Neo
+ NeoShutdown();
+}
+
+// Reset handler of adapter
+NDIS_STATUS NeoNdisResetEx(NDIS_HANDLE MiniportAdapterContext, PBOOLEAN AddressingReset)
+{
+ return NDIS_STATUS_SUCCESS;
+}
+
+// Hang-up check handler of adapter
+BOOLEAN NeoNdisCheckForHangEx(NDIS_HANDLE MiniportAdapterContext)
+{
+ return FALSE;
+}
+
+// OID request handler
+NDIS_STATUS NeoNdisOidRequest(NDIS_HANDLE MiniportAdapterContext,
+ PNDIS_OID_REQUEST OidRequest)
+{
+ NDIS_STATUS ret = STATUS_UNSUCCESSFUL;
+ ULONG dummy = 0;
+
+ switch (OidRequest->RequestType)
+ {
+ case NdisRequestQueryInformation:
+ case NdisRequestQueryStatistics:
+ ret = NeoNdisQuery(MiniportAdapterContext,
+ OidRequest->DATA.QUERY_INFORMATION.Oid,
+ OidRequest->DATA.QUERY_INFORMATION.InformationBuffer,
+ OidRequest->DATA.QUERY_INFORMATION.InformationBufferLength,
+ &OidRequest->DATA.QUERY_INFORMATION.BytesWritten,
+ &OidRequest->DATA.QUERY_INFORMATION.BytesNeeded);
+ break;
+
+ case NdisRequestSetInformation:
+ ret = NeoNdisSet(MiniportAdapterContext,
+ OidRequest->DATA.SET_INFORMATION.Oid,
+ OidRequest->DATA.SET_INFORMATION.InformationBuffer,
+ OidRequest->DATA.SET_INFORMATION.InformationBufferLength,
+ &dummy,
+ &OidRequest->DATA.SET_INFORMATION.BytesNeeded);
+ break;
+
+ default:
+ ret = NDIS_STATUS_NOT_SUPPORTED;
+ break;
+ }
+
+ return ret;
+}
+
+
+// Information acquisition handler of adapter
+NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext,
+ NDIS_OID Oid,
+ void *InformationBuffer,
+ ULONG InformationBufferLength,
+ ULONG *BytesWritten,
+ ULONG *BytesNeeded)
+{
+ NDIS_MEDIUM media;
+ void *buf;
+ UINT value32;
+ USHORT value16;
+ UINT size;
+ NDIS_STATISTICS_INFO stat;
+ NDIS_INTERRUPT_MODERATION_PARAMETERS intp;
+
+ if (ctx == NULL)
+ {
+ return NDIS_STATUS_FAILURE;
+ }
+
+ // Initialization
+ size = sizeof(UINT);
+ value32 = value16 = 0;
+ buf = &value32;
+
+ // Branch processing
+ switch (Oid)
+ {
+ case OID_GEN_SUPPORTED_LIST:
+ // Return a list of supported OID
+ buf = SupportedOids;
+ size = sizeof(SupportedOids);
+ break;
+
+ case OID_GEN_MAC_OPTIONS:
+ // Ethernet option
+ value32 = NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | NDIS_MAC_OPTION_RECEIVE_SERIALIZED |
+ NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | NDIS_MAC_OPTION_NO_LOOPBACK;
+ break;
+
+ case OID_GEN_HARDWARE_STATUS:
+ // Hardware state
+ buf = &ctx->HardwareStatus;
+ size = sizeof(NDIS_HARDWARE_STATUS);
+ break;
+
+ case OID_GEN_MEDIA_SUPPORTED:
+ case OID_GEN_MEDIA_IN_USE:
+ // Type of media
+ media = NdisMedium802_3;
+ buf = &media;
+ size = sizeof(NDIS_MEDIUM);
+ break;
+
+ case OID_GEN_CURRENT_LOOKAHEAD:
+ case OID_GEN_MAXIMUM_LOOKAHEAD:
+ // Read-ahead available size
+ value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE;
+ break;
+
+ case OID_GEN_MAXIMUM_FRAME_SIZE:
+ // Maximum frame size
+ value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE;
+ break;
+
+ case OID_GEN_MAXIMUM_TOTAL_SIZE:
+ case OID_GEN_TRANSMIT_BLOCK_SIZE:
+ case OID_GEN_RECEIVE_BLOCK_SIZE:
+ // Maximum packet size
+ value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE;
+ break;
+
+ case OID_GEN_TRANSMIT_BUFFER_SPACE:
+ case OID_GEN_RECEIVE_BUFFER_SPACE:
+ // Buffer size
+ value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE * NEO_MAX_PACKET_EXCHANGE;
+ break;
+
+ case OID_GEN_LINK_SPEED:
+ // Communication speed
+ value32 = (UINT)(max_speed / 100);
+ break;
+
+ case OID_GEN_VENDOR_ID:
+ // Vendor ID
+ NeoCopy(&value32, ctx->MacAddress, 3);
+ value32 &= 0xFFFFFF00;
+ value32 |= 0x01;
+ break;
+
+ case OID_GEN_VENDOR_DESCRIPTION:
+ // Hardware ID
+ buf = ctx->HardwarePrintableID;
+ size = (UINT)strlen(ctx->HardwarePrintableID) + 1;
+ break;
+
+ case OID_GEN_DRIVER_VERSION:
+ // Driver version
+ value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION;
+ buf = &value16;
+ size = sizeof(USHORT);
+ break;
+
+ case OID_GEN_VENDOR_DRIVER_VERSION:
+ // Vendor driver version
+ value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION;
+ buf = &value16;
+ size = sizeof(USHORT);
+ break;
+
+ case OID_802_3_PERMANENT_ADDRESS:
+ case OID_802_3_CURRENT_ADDRESS:
+ // MAC address
+ buf = ctx->MacAddress;
+ size = NEO_MAC_ADDRESS_SIZE;
+ break;
+
+ case OID_802_3_MAXIMUM_LIST_SIZE:
+ // Number of multicast
+ value32 = NEO_MAX_MULTICASE;
+ break;
+
+ case OID_GEN_MAXIMUM_SEND_PACKETS:
+ // Number of packets that can be sent at a time
+ value32 = NEO_MAX_PACKET_EXCHANGE;
+ break;
+
+ case OID_GEN_XMIT_OK:
+ // Number of packets sent
+ value32 = ctx->Status.NumPacketSend;
+ break;
+
+ case OID_GEN_RCV_OK:
+ // Number of received packets
+ value32 = ctx->Status.NumPacketRecv;
+ break;
+
+ case OID_GEN_XMIT_ERROR:
+ // Number of transmission error packets
+ value32 = ctx->Status.NumPacketSendError;
+ break;
+
+ case OID_GEN_RCV_ERROR:
+ // Number of error packets received
+ value32 = ctx->Status.NumPacketRecvError;
+ break;
+
+ case OID_GEN_RCV_NO_BUFFER:
+ // Number of reception buffer shortage occurrences
+ value32 = ctx->Status.NumPacketRecvNoBuffer;
+ break;
+
+ case OID_802_3_RCV_ERROR_ALIGNMENT:
+ // Number of errors
+ value32 = 0;
+ break;
+
+ case OID_GEN_MEDIA_CONNECT_STATUS:
+ // Cable connection state
+ NeoCheckConnectState();
+ if (keep_link == false)
+ {
+ value32 = ctx->Connected ? NdisMediaStateConnected : NdisMediaStateDisconnected;
+ }
+ else
+ {
+ value32 = NdisMediaStateConnected;
+ }
+ break;
+
+ case OID_802_3_XMIT_ONE_COLLISION:
+ case OID_802_3_XMIT_MORE_COLLISIONS:
+ // Number of collisions
+ value32 = 0;
+ break;
+
+ case OID_GEN_CURRENT_PACKET_FILTER:
+ // Current settings of the packet filter
+ value32 = ctx->CurrentPacketFilter;
+ break;
+
+/* case OID_GEN_PROTOCOL_OPTIONS:
+ // Current value of the protocol option
+ value32 = ctx->CurrentProtocolOptions;
+ break;*/
+
+ case OID_GEN_STATISTICS:
+ // Statistics (NDIS 6.0)
+ NeoZero(&stat, sizeof(stat));
+ buf = &stat;
+ size = sizeof(stat);
+
+ stat.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
+ stat.Header.Revision = NDIS_STATISTICS_INFO_REVISION_1;
+ stat.Header.Size = NDIS_SIZEOF_STATISTICS_INFO_REVISION_1;
+ stat.SupportedStatistics =
+ NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_BYTES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_RCV_DISCARDS |
+ NDIS_STATISTICS_FLAGS_VALID_RCV_ERROR |
+ NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_BYTES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_XMIT_ERROR |
+ NDIS_STATISTICS_FLAGS_VALID_XMIT_DISCARDS |
+ NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_RCV |
+ NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_XMIT |
+ NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_XMIT;
+
+ stat.ifInErrors = ctx->Status.Int64NumRecvError;
+ stat.ifHCInOctets = ctx->Status.Int64BytesRecvTotal;
+ stat.ifHCInUcastPkts = ctx->Status.Int64NumRecvUnicast;
+ stat.ifHCInBroadcastPkts = ctx->Status.Int64NumRecvBroadcast;
+ stat.ifHCOutOctets = ctx->Status.Int64BytesSendTotal;
+ stat.ifHCOutUcastPkts = ctx->Status.Int64NumSendUnicast;
+ stat.ifHCOutBroadcastPkts = ctx->Status.Int64NumSendBroadcast;
+ stat.ifOutErrors = ctx->Status.Int64NumSendError;
+ stat.ifHCInUcastOctets = ctx->Status.Int64BytesRecvUnicast;
+ stat.ifHCInBroadcastOctets = ctx->Status.Int64BytesRecvBroadcast;
+ stat.ifHCOutUcastOctets = ctx->Status.Int64BytesSendUnicast;
+ stat.ifHCOutBroadcastOctets = ctx->Status.Int64BytesSendBroadcast;
+ break;
+
+ case OID_GEN_INTERRUPT_MODERATION:
+ // Interrupt Moderation (NDIS 6.0)
+ NeoZero(&intp, sizeof(intp));
+ buf = &intp;
+ size = sizeof(intp);
+
+ intp.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
+ intp.Header.Revision = NDIS_INTERRUPT_MODERATION_PARAMETERS_REVISION_1;
+ intp.Header.Size = NDIS_SIZEOF_INTERRUPT_MODERATION_PARAMETERS_REVISION_1;
+ intp.InterruptModeration = NdisInterruptModerationNotSupported;
+ break;
+
+ default:
+ // Unknown OID
+ *BytesWritten = 0;
+ return NDIS_STATUS_INVALID_OID;
+ }
+
+ if (size > InformationBufferLength)
+ {
+ // Undersize
+ *BytesNeeded = size;
+ *BytesWritten = 0;
+ return NDIS_STATUS_INVALID_LENGTH;
+ }
+
+ // Data copy
+ NeoCopy(InformationBuffer, buf, size);
+ *BytesWritten = size;
+
+ return NDIS_STATUS_SUCCESS;
+}
+
+// Set the cable connection state
+void NeoSetConnectState(BOOL connected)
+{
+ if (ctx == NULL)
+ {
+ return;
+ }
+ ctx->Connected = connected;
+ NeoCheckConnectState();
+}
+
+// Check the cable connection state
+void NeoCheckConnectState()
+{
+ NDIS_STATUS_INDICATION t;
+ NDIS_LINK_STATE state;
+ if (ctx == NULL || ctx->NdisMiniport == NULL)
+ {
+ return;
+ }
+
+ NeoZero(&t, sizeof(t));
+ t.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION;
+ t.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1;
+ t.Header.Size = NDIS_SIZEOF_STATUS_INDICATION_REVISION_1;
+
+ t.SourceHandle = ctx->NdisMiniport;
+
+ NeoZero(&state, sizeof(state));
+ state.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
+ state.Header.Revision = NDIS_LINK_STATE_REVISION_1;
+ state.Header.Size = NDIS_SIZEOF_LINK_STATE_REVISION_1;
+
+ state.MediaDuplexState = NdisPauseFunctionsSendAndReceive;
+ state.XmitLinkSpeed = state.RcvLinkSpeed = max_speed;
+ state.PauseFunctions = NdisPauseFunctionsUnsupported;
+
+ t.StatusCode = NDIS_STATUS_LINK_STATE;
+ t.StatusBuffer = &state;
+ t.StatusBufferSize = sizeof(NDIS_LINK_STATE);
+
+ if (keep_link == false)
+ {
+ if (ctx->ConnectedOld != ctx->Connected || ctx->ConnectedForce)
+ {
+ ctx->ConnectedForce = FALSE;
+ ctx->ConnectedOld = ctx->Connected;
+ if (ctx->Halting == FALSE)
+ {
+ state.MediaConnectState = ctx->Connected ? MediaConnectStateConnected : MediaConnectStateDisconnected;
+ NdisMIndicateStatusEx(ctx->NdisMiniport, &t);
+ }
+ }
+ }
+ else
+ {
+ if (ctx->ConnectedForce)
+ {
+ ctx->ConnectedForce = false;
+
+ if (ctx->Halting == FALSE)
+ {
+ state.MediaConnectState = MediaConnectStateConnected;
+ NdisMIndicateStatusEx(ctx->NdisMiniport, &t);
+ }
+ }
+ }
+}
+
+// Information setting handler of adapter
+NDIS_STATUS NeoNdisSet(
+ NDIS_HANDLE MiniportAdapterContext,
+ NDIS_OID Oid,
+ void *InformationBuffer,
+ ULONG InformationBufferLength,
+ ULONG *BytesRead,
+ ULONG *BytesNeeded)
+{
+ if (ctx == NULL)
+ {
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ // Initialization
+ *BytesRead = 0;
+ *BytesNeeded = 0;
+
+ // Branch processing
+ switch (Oid)
+ {
+ case OID_GEN_CURRENT_PACKET_FILTER:
+ /* Packet filter */
+ if (InformationBufferLength != 4)
+ {
+ *BytesNeeded = 4;
+ return NDIS_STATUS_INVALID_LENGTH;
+ }
+ *BytesRead = 4;
+ ctx->CurrentPacketFilter = *((UINT *)InformationBuffer);
+ return NDIS_STATUS_SUCCESS;
+
+// case OID_GEN_PROTOCOL_OPTIONS:
+ /* Current protocol option value */
+/* if (InformationBufferLength != 4)
+ {
+ *BytesNeeded = 4;
+ return NDIS_STATUS_INVALID_LENGTH;
+ }
+ *BytesRead = 4;
+ ctx->CurrentProtocolOptions = *((UINT *)InformationBuffer);
+ return NDIS_STATUS_SUCCESS;*/
+
+ case OID_GEN_CURRENT_LOOKAHEAD:
+ /* Look ahead */
+ if (InformationBufferLength != 4)
+ {
+ *BytesNeeded = 4;
+ return NDIS_STATUS_INVALID_LENGTH;
+ }
+ *BytesRead = 4;
+ return NDIS_STATUS_SUCCESS;
+
+ case OID_GEN_LINK_PARAMETERS:
+ // NDIS 6.0 Link setting
+ *BytesRead = InformationBufferLength;
+ return NDIS_STATUS_SUCCESS;
+
+ case OID_802_3_MULTICAST_LIST:
+ // Multicast list
+ *BytesRead = InformationBufferLength;
+
+ return NDIS_STATUS_SUCCESS;
+ }
+
+ return NDIS_STATUS_INVALID_OID;
+}
+
+// Packet send handler
+void NeoNdisSendNetBufferLists(NDIS_HANDLE MiniportAdapterContext,
+ NET_BUFFER_LIST *NetBufferLists,
+ NDIS_PORT_NUMBER PortNumber,
+ ULONG SendFlags)
+{
+ if (ctx == NULL)
+ {
+ return;
+ }
+
+ // Update the connection state
+ NeoCheckConnectState();
+
+ if (NeoNdisSendPacketsHaltCheck(NetBufferLists) == FALSE)
+ {
+ // Device is stopped
+ return;
+ }
+
+ // Operation of the packet queue
+ NeoLockPacketQueue();
+ {
+ NET_BUFFER_LIST *nbl;
+ if (NeoNdisSendPacketsHaltCheck(NetBufferLists) == FALSE)
+ {
+ // Device is stopped
+ NeoUnlockPacketQueue();
+ return;
+ }
+
+ nbl = NetBufferLists;
+
+ while (nbl != NULL)
+ {
+ NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl);
+
+ while (nb != NULL)
+ {
+ UINT size = NET_BUFFER_DATA_LENGTH(nb);
+
+ if (size >= NEO_MIN_PACKET_SIZE && size <= NEO_MAX_PACKET_SIZE)
+ {
+ UCHAR *buf = NeoMalloc(size);
+ void *ptr;
+
+ ptr = NdisGetDataBuffer(nb, size, buf, 1, 0);
+
+ if (ptr == NULL)
+ {
+ ctx->Status.NumPacketSendError++;
+ ctx->Status.Int64NumSendError++;
+ NeoFree(buf);
+ }
+ else
+ {
+ if (ptr != buf)
+ {
+ NeoCopy(buf, ptr, size);
+ }
+
+ NeoInsertQueue(buf, size);
+ ctx->Status.NumPacketSend++;
+
+ if (buf[0] & 0x40)
+ {
+ ctx->Status.Int64NumSendBroadcast++;
+ ctx->Status.Int64BytesSendBroadcast += (UINT64)size;
+ }
+ else
+ {
+ ctx->Status.Int64NumSendUnicast++;
+ ctx->Status.Int64BytesSendUnicast += (UINT64)size;
+ }
+
+ ctx->Status.Int64BytesSendTotal += (UINT64)size;
+ }
+ }
+ else
+ {
+ ctx->Status.NumPacketSendError++;
+ ctx->Status.Int64NumSendError++;
+ }
+
+ nb = NET_BUFFER_NEXT_NB(nb);
+ }
+
+ nbl = NET_BUFFER_LIST_NEXT_NBL(nbl);
+ }
+ }
+
+ NeoUnlockPacketQueue();
+
+ // Notify the transmission completion
+ NdisMSendNetBufferListsComplete(ctx->NdisMiniport, NetBufferLists, NDIS_STATUS_SUCCESS);
+
+ // Reception event
+ NeoSet(ctx->Event);
+}
+
+// Stop check of packet transmission
+BOOL NeoNdisSendPacketsHaltCheck(NET_BUFFER_LIST *NetBufferLists)
+{
+ if (ctx == NULL)
+ {
+ return FALSE;
+ }
+
+ if (ctx->Halting != FALSE || ctx->Opened == FALSE)
+ {
+ // Halting
+ NdisMSendNetBufferListsComplete(ctx->NdisMiniport, NetBufferLists, NDIS_STATUS_FAILURE);
+
+ return FALSE;
+ }
+ return TRUE;
+}
+
+// Initialize the packet array
+void NeoInitPacketArray()
+{
+ UINT i;
+ // Create a packet buffer
+ for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++)
+ {
+ ctx->PacketBuffer[i] = NeoNewPacketBuffer();
+ }
+}
+
+// Release the packet array
+void NeoFreePacketArray()
+{
+ UINT i;
+ for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++)
+ {
+ NeoFreePacketBuffer(ctx->PacketBuffer[i]);
+ ctx->PacketBuffer[i] = NULL;
+ }
+}
+
+// Release the packet buffer
+void NeoFreePacketBuffer(PACKET_BUFFER *p)
+{
+ // Validate arguments
+ if (p == NULL)
+ {
+ return;
+ }
+
+ // Release the NET_BUFFER_LIST
+ NdisFreeNetBufferList(p->NetBufferList);
+ // Release the NET_BUFFER_LIST pool
+ NdisFreeNetBufferListPool(p->NetBufferListPool);
+ // Release the memory
+ NeoFree(p);
+}
+
+// Create a packet buffer
+PACKET_BUFFER *NeoNewPacketBuffer()
+{
+ PACKET_BUFFER *p;
+ NET_BUFFER_LIST_POOL_PARAMETERS p1;
+
+ // Memory allocation
+ p = NeoZeroMalloc(sizeof(PACKET_BUFFER));
+
+ // Create a NET_BUFFER_LIST pool
+ NeoZero(&p1, sizeof(p1));
+ p1.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
+ p1.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1;
+ p1.Header.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1;
+ p1.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT;
+ p1.fAllocateNetBuffer = TRUE;
+ p1.DataSize = NEO_MAX_PACKET_SIZE;
+ p->NetBufferListPool = NdisAllocateNetBufferListPool(NULL, &p1);
+
+ // Create a NET_BUFFER_LIST
+ p->NetBufferList = NdisAllocateNetBufferList(p->NetBufferListPool, 0, 0);
+
+ return p;
+}
+
+// Check whether the specified address is kernel memory
+BOOL NeoIsKernelAddress(void *addr)
+{
+#if 0
+ if ((ULONG)addr >= (ULONG)0x80000000)
+ {
+ // Kernel memory
+ return TRUE;
+ }
+#endif // CPU_64
+ // User memory
+ return FALSE;
+}
+
+// Reset the event
+void NeoReset(NEO_EVENT *event)
+{
+ // Validate arguments
+ if (event == NULL)
+ {
+ return;
+ }
+
+ KeResetEvent(event->event);
+}
+
+// Set the event
+void NeoSet(NEO_EVENT *event)
+{
+ // Validate arguments
+ if (event == NULL)
+ {
+ return;
+ }
+
+ KeSetEvent(event->event, 0, FALSE);
+}
+
+// Release the event
+void NeoFreeEvent(NEO_EVENT *event)
+{
+ // Validate arguments
+ if (event == NULL)
+ {
+ return;
+ }
+
+ ZwClose(event->event_handle);
+
+ // Release the memory
+ NeoFree(event);
+}
+
+// Create a new event
+NEO_EVENT *NeoNewEvent(char *name)
+{
+ UNICODE *unicode_name;
+ NEO_EVENT *event;
+ // Validate arguments
+ if (name == NULL)
+ {
+ return NULL;
+ }
+
+ // Convert the name to Unicode
+ unicode_name = NewUnicode(name);
+ if (unicode_name == NULL)
+ {
+ return NULL;
+ }
+
+ // Memory allocation
+ event = NeoZeroMalloc(sizeof(NEO_EVENT));
+ if (event == NULL)
+ {
+ FreeUnicode(unicode_name);
+ return NULL;
+ }
+
+ // Create an Event
+ event->event = IoCreateNotificationEvent(GetUnicode(unicode_name), &event->event_handle);
+ if (event->event == NULL)
+ {
+ NeoFree(event);
+ FreeUnicode(unicode_name);
+ return NULL;
+ }
+
+ // Initialize the event
+ KeInitializeEvent(event->event, NotificationEvent, FALSE);
+ KeClearEvent(event->event);
+
+ // Release a string
+ FreeUnicode(unicode_name);
+
+ return event;
+}
+
+// Get the Unicode string
+NDIS_STRING *GetUnicode(UNICODE *u)
+{
+ // Validate arguments
+ if (u == NULL)
+ {
+ return NULL;
+ }
+
+ return &u->String;
+}
+
+// Release the Unicode strings
+void FreeUnicode(UNICODE *u)
+{
+ // Validate arguments
+ if (u == NULL)
+ {
+ return;
+ }
+
+ // Release a string
+ NdisFreeString(u->String);
+
+ // Release the memory
+ NeoFree(u);
+}
+
+// Create a new Unicode string
+UNICODE *NewUnicode(char *str)
+{
+ UNICODE *u;
+ // Validate arguments
+ if (str == NULL)
+ {
+ return NULL;
+ }
+
+ // Memory allocation
+ u = NeoZeroMalloc(sizeof(UNICODE));
+ if (u == NULL)
+ {
+ return NULL;
+ }
+
+ // String initialization
+ NdisInitializeString(&u->String, str);
+
+ return u;
+}
+
+// Release the lock
+void NeoFreeLock(NEO_LOCK *lock)
+{
+ NDIS_SPIN_LOCK *spin_lock;
+ // Validate arguments
+ if (lock == NULL)
+ {
+ return;
+ }
+
+ spin_lock = &lock->spin_lock;
+ NdisFreeSpinLock(spin_lock);
+
+ // Release the memory
+ NeoFree(lock);
+}
+
+// Unlock
+void NeoUnlock(NEO_LOCK *lock)
+{
+ NDIS_SPIN_LOCK *spin_lock;
+ // Validate arguments
+ if (lock == NULL)
+ {
+ return;
+ }
+
+ spin_lock = &lock->spin_lock;
+ NdisReleaseSpinLock(spin_lock);
+}
+
+// Lock
+void NeoLock(NEO_LOCK *lock)
+{
+ NDIS_SPIN_LOCK *spin_lock;
+ // Validate arguments
+ if (lock == NULL)
+ {
+ return;
+ }
+
+ spin_lock = &lock->spin_lock;
+ NdisAcquireSpinLock(spin_lock);
+}
+
+// Creating a new lock
+NEO_LOCK *NeoNewLock()
+{
+ NDIS_SPIN_LOCK *spin_lock;
+
+ // Memory allocation
+ NEO_LOCK *lock = NeoZeroMalloc(sizeof(NEO_LOCK));
+ if (lock == NULL)
+ {
+ return NULL;
+ }
+
+ // Initialize spin lock
+ spin_lock = &lock->spin_lock;
+
+ NdisAllocateSpinLock(spin_lock);
+
+ return lock;
+}
+
+// Memory copy
+void NeoCopy(void *dst, void *src, UINT size)
+{
+ // Validate arguments
+ if (dst == NULL || src == NULL || size == 0)
+ {
+ return;
+ }
+
+ // Copy
+ NdisMoveMemory(dst, src, size);
+}
+
+// Memory clear
+void NeoZero(void *dst, UINT size)
+{
+ // Validate arguments
+ if (dst == NULL || size == 0)
+ {
+ return;
+ }
+
+ // Clear
+ NdisZeroMemory(dst, size);
+}
+
+// Clear to zero by memory allocation
+void *NeoZeroMalloc(UINT size)
+{
+ void *p = NeoMalloc(size);
+ if (p == NULL)
+ {
+ // Memory allocation failure
+ return NULL;
+ }
+ // Clear to zero
+ NeoZero(p, size);
+ return p;
+}
+
+// Memory allocation
+void *NeoMalloc(UINT size)
+{
+ NDIS_STATUS r;
+ void *p;
+ if (size == 0)
+ {
+ size = 1;
+ }
+
+ // Allocate the non-paged memory
+ r = NdisAllocateMemoryWithTag(&p, size, 0);
+
+ if (NG(r))
+ {
+ return NULL;
+ }
+ return p;
+}
+
+// Release the memory
+void NeoFree(void *p)
+{
+ // Validate arguments
+ if (p == NULL)
+ {
+ return;
+ }
+
+ // Release the memory
+ NdisFreeMemory(p, 0, 0);
+}
+
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/Neo6/NDIS6.h b/src/Neo6/NDIS6.h
new file mode 100644
index 00000000..cacf8e22
--- /dev/null
+++ b/src/Neo6/NDIS6.h
@@ -0,0 +1,239 @@
+// SoftEther VPN Source Code
+// Kernel Device Driver
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// 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 version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+// NDIS6.h
+// Header of NDIS6.c
+
+#ifndef NDIS5_H
+#define NDIS5_H
+
+// Win32 DDK related
+#ifndef CPU_64
+#define _X86_
+#else // CPU_64
+#ifndef NEO_IA64
+#define _AMD64_
+#define AMD64
+#else // NEO_IA64
+#define _IA64_
+#define IA64
+#endif // NEO_IA64
+#endif // CPU_64
+#define NDIS_MINIPORT_DRIVER
+// NDIS 6.2
+#define NDIS620_MINIPORT
+#define NDIS_SUPPORT_NDIS61 1
+#define NDIS_SUPPORT_NDIS620 1
+#define NEO_NDIS_MAJOR_VERSION 6
+#define NEO_NDIS_MINOR_VERSION 20
+#define NDIS_WDM 1
+
+#include <wdm.h>
+#include <ndis.h>
+#include <stdio.h>
+#include <string.h>
+
+// Error checking macro
+#define OK(val) ((val) == STATUS_SUCCESS)
+#define NG(val) (!OK(val))
+
+// Constant
+static UINT SupportedOids[] =
+{
+ OID_GEN_SUPPORTED_LIST,
+ OID_GEN_HARDWARE_STATUS,
+ OID_GEN_MEDIA_SUPPORTED,
+ OID_GEN_MEDIA_IN_USE,
+ OID_GEN_MAXIMUM_FRAME_SIZE,
+ OID_GEN_MAXIMUM_TOTAL_SIZE,
+ OID_GEN_MAC_OPTIONS,
+ OID_GEN_MAXIMUM_LOOKAHEAD,
+ OID_GEN_CURRENT_LOOKAHEAD,
+ OID_GEN_LINK_SPEED,
+ OID_GEN_MEDIA_CONNECT_STATUS,
+ OID_GEN_TRANSMIT_BUFFER_SPACE,
+ OID_GEN_RECEIVE_BUFFER_SPACE,
+ OID_GEN_TRANSMIT_BLOCK_SIZE,
+ OID_GEN_RECEIVE_BLOCK_SIZE,
+ OID_GEN_VENDOR_DESCRIPTION,
+ OID_GEN_VENDOR_ID,
+ OID_GEN_DRIVER_VERSION,
+ OID_GEN_VENDOR_DRIVER_VERSION,
+ OID_GEN_XMIT_OK,
+ OID_GEN_RCV_OK,
+ OID_GEN_XMIT_ERROR,
+ OID_GEN_RCV_ERROR,
+ OID_GEN_RCV_NO_BUFFER,
+ OID_GEN_CURRENT_PACKET_FILTER,
+ OID_802_3_PERMANENT_ADDRESS,
+ OID_802_3_CURRENT_ADDRESS,
+ OID_802_3_MAXIMUM_LIST_SIZE,
+ OID_802_3_RCV_ERROR_ALIGNMENT,
+ OID_802_3_XMIT_ONE_COLLISION,
+ OID_802_3_XMIT_MORE_COLLISIONS,
+ OID_802_3_MULTICAST_LIST,
+ //OID_GEN_PROTOCOL_OPTIONS,
+ OID_GEN_MAXIMUM_SEND_PACKETS,
+ OID_GEN_STATISTICS,
+ OID_GEN_INTERRUPT_MODERATION,
+ OID_GEN_LINK_PARAMETERS,
+ };
+#define NEO_MEDIA NdisMedium802_3
+#define MAX_MULTICAST 32
+
+#define MAX_PATH 260
+#define MAX_SIZE 512
+#define STD_SIZE 512
+
+
+
+// Unicode string
+typedef struct _UNICODE
+{
+ UNICODE_STRING String;
+} UNICODE;
+
+typedef struct _PACKET_BUFFER PACKET_BUFFER;
+
+// Function prototype
+UNICODE *NewUnicode(char *str);
+void FreeUnicode(UNICODE *u);
+NDIS_STRING *GetUnicode(UNICODE *u);
+PACKET_BUFFER *NeoNewPacketBuffer();
+void NeoFreePacketBuffer(PACKET_BUFFER *p);
+void NeoInitPacketArray();
+void NeoFreePacketArray();
+NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath);
+NDIS_STATUS NeoNdisInitEx(NDIS_HANDLE MiniportAdapterHandle,
+ NDIS_HANDLE MiniportDriverContext,
+ PNDIS_MINIPORT_INIT_PARAMETERS MiniportInitParameters);
+void NeoNdisHaltEx(NDIS_HANDLE MiniportAdapterContext, NDIS_HALT_ACTION HaltAction);
+VOID NeoNdisDriverUnload(PDRIVER_OBJECT DriverObject);
+NDIS_STATUS NeoNdisResetEx(NDIS_HANDLE MiniportAdapterContext, PBOOLEAN AddressingReset);
+BOOLEAN NeoNdisCheckForHangEx(NDIS_HANDLE MiniportAdapterContext);
+NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext,
+ NDIS_OID Oid,
+ void *InformationBuffer,
+ ULONG InformationBufferLength,
+ ULONG *BytesWritten,
+ ULONG *BytesNeeded);
+NDIS_STATUS NeoNdisSet(
+ NDIS_HANDLE MiniportAdapterContext,
+ NDIS_OID Oid,
+ void *InformationBuffer,
+ ULONG InformationBufferLength,
+ ULONG *BytesRead,
+ ULONG *BytesNeeded);
+NDIS_STATUS NeoNdisOidRequest(NDIS_HANDLE MiniportAdapterContext,
+ PNDIS_OID_REQUEST OidRequest);
+void NeoNdisSendNetBufferLists(NDIS_HANDLE MiniportAdapterContext,
+ NET_BUFFER_LIST *NetBufferLists,
+ NDIS_PORT_NUMBER PortNumber,
+ ULONG SendFlags);
+BOOL NeoNdisSendPacketsHaltCheck(NET_BUFFER_LIST *NetBufferLists);
+BOOL NeoLoadRegistory();
+void NeoInitControlDevice();
+void NeoFreeControlDevice();
+NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp);
+void NeoCheckConnectState();
+void NeoSetConnectState(BOOL connected);
+BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack);
+BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack);
+void NeoNdisCrash();
+void NeoNdisCrash2();
+
+NDIS_STATUS NeoNdisSetOptions(NDIS_HANDLE NdisDriverHandle, NDIS_HANDLE DriverContext);
+NDIS_STATUS NeoNdisPause(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_PAUSE_PARAMETERS MiniportPauseParameters);
+NDIS_STATUS NeoNdisRestart(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_RESTART_PARAMETERS MiniportRestartParameters);
+void NeoNdisReturnNetBufferLists(NDIS_HANDLE MiniportAdapterContext, PNET_BUFFER_LIST NetBufferLists, ULONG ReturnFlags);
+void NeoNdisCancelSend(NDIS_HANDLE MiniportAdapterContext, PVOID CancelId);
+void NeoNdisDevicePnPEventNotify(NDIS_HANDLE MiniportAdapterContext, PNET_DEVICE_PNP_EVENT NetDevicePnPEvent);
+void NeoNdisShutdownEx(NDIS_HANDLE MiniportAdapterContext, NDIS_SHUTDOWN_ACTION ShutdownAction);
+void NeoNdisCancelOidRequest(NDIS_HANDLE MiniportAdapterContext, PVOID RequestId);
+
+// NeoNdisCrash2(__LINE__, __LINE__, __LINE__, __LINE__);
+
+
+#endif // NDIS5_H
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/Neo6/Neo6.c b/src/Neo6/Neo6.c
new file mode 100644
index 00000000..aec85662
--- /dev/null
+++ b/src/Neo6/Neo6.c
@@ -0,0 +1,499 @@
+// SoftEther VPN Source Code
+// Kernel Device Driver
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// 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 version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+// Neo6.c
+// Driver Main Program
+
+#include <GlobalConst.h>
+
+#define NEO_DEVICE_DRIVER
+
+#include "Neo6.h"
+
+// Whether Win8
+extern bool g_is_win8;
+
+// Neo driver context
+static NEO_CTX static_ctx;
+NEO_CTX *ctx = &static_ctx;
+
+// Read the packet data from the transmit packet queue
+void NeoRead(void *buf)
+{
+ NEO_QUEUE *q;
+ UINT num;
+ BOOL left;
+ // Validate arguments
+ if (buf == NULL)
+ {
+ return;
+ }
+
+ // Copy the packets one by one from the queue
+ num = 0;
+ left = TRUE;
+ NeoLockPacketQueue();
+ {
+ while (TRUE)
+ {
+ if (num >= NEO_MAX_PACKET_EXCHANGE)
+ {
+ if (ctx->PacketQueue == NULL)
+ {
+ left = FALSE;
+ }
+ break;
+ }
+ q = NeoGetNextQueue();
+ if (q == NULL)
+ {
+ left = FALSE;
+ break;
+ }
+ NEO_SIZE_OF_PACKET(buf, num) = q->Size;
+ NeoCopy(NEO_ADDR_OF_PACKET(buf, num), q->Buf, q->Size);
+ num++;
+ NeoFreeQueue(q);
+ }
+ }
+ NeoUnlockPacketQueue();
+
+ NEO_NUM_PACKET(buf) = num;
+ NEO_LEFT_FLAG(buf) = left;
+
+ if (left == FALSE)
+ {
+ NeoReset(ctx->Event);
+ }
+ else
+ {
+ NeoSet(ctx->Event);
+ }
+
+ return;
+}
+
+// Process the received packet
+void NeoWrite(void *buf)
+{
+ UINT num, i, size;
+ UCHAR *packet_buf;
+ NET_BUFFER_LIST *nbl_chain = NULL;
+ NET_BUFFER_LIST *nbl_tail = NULL;
+ UINT num_nbl_chain = 0;
+ // Validate arguments
+ if (buf == NULL)
+ {
+ return;
+ }
+
+ // Number of packets
+ num = NEO_NUM_PACKET(buf);
+ if (num > NEO_MAX_PACKET_EXCHANGE)
+ {
+ // Number of packets is too many
+ return;
+ }
+ if (num == 0)
+ {
+ // No packet
+ return;
+ }
+
+ if (ctx->Halting != FALSE)
+ {
+ // Stopping
+ return;
+ }
+
+ if (ctx->Opened == FALSE)
+ {
+ // Not connected
+ return;
+ }
+
+ for (i = 0;i < num;i++)
+ {
+ PACKET_BUFFER *p = ctx->PacketBuffer[i];
+ void *dst;
+ NET_BUFFER_LIST *nbl = ctx->PacketBuffer[i]->NetBufferList;
+ NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl);
+
+ nbl->SourceHandle = ctx->NdisMiniport;
+
+ NET_BUFFER_LIST_NEXT_NBL(nbl) = NULL;
+
+ size = NEO_SIZE_OF_PACKET(buf, i);
+ if (size > NEO_MAX_PACKET_SIZE)
+ {
+ size = NEO_MAX_PACKET_SIZE;
+ }
+ if (size < NEO_PACKET_HEADER_SIZE)
+ {
+ size = NEO_PACKET_HEADER_SIZE;
+ }
+
+ packet_buf = (UCHAR *)(NEO_ADDR_OF_PACKET(buf, i));
+
+ if (OK(NdisRetreatNetBufferDataStart(nb, size, 0, NULL)))
+ {
+ // Buffer copy
+ dst = NdisGetDataBuffer(nb,
+ size,
+ NULL,
+ 1,
+ 0);
+
+ if (dst != NULL)
+ {
+ NeoCopy(dst, packet_buf, size);
+
+ if (nbl_chain == NULL)
+ {
+ nbl_chain = nbl;
+ }
+
+ if (nbl_tail != NULL)
+ {
+ NET_BUFFER_LIST_NEXT_NBL(nbl_tail) = nbl;
+ }
+
+ nbl_tail = nbl;
+
+ num_nbl_chain++;
+ }
+ }
+
+ nbl->Status = NDIS_STATUS_RESOURCES;
+
+ ctx->Status.Int64BytesRecvTotal += (UINT64)size;
+
+ if (packet_buf[0] & 0x40)
+ {
+ ctx->Status.Int64NumRecvBroadcast++;
+ ctx->Status.Int64BytesRecvBroadcast += (UINT64)size;
+ }
+ else
+ {
+ ctx->Status.Int64NumRecvUnicast++;
+ ctx->Status.Int64BytesRecvUnicast += (UINT64)size;
+ }
+ }
+
+ if (nbl_chain == NULL)
+ {
+ return;
+ }
+
+ // Notify that it has received
+ ctx->Status.NumPacketRecv += num_nbl_chain;
+
+ NdisMIndicateReceiveNetBufferLists(ctx->NdisMiniport,
+ nbl_chain, 0, num_nbl_chain, NDIS_RECEIVE_FLAGS_RESOURCES);
+
+ if (true)
+ {
+ // Restore the packet buffer
+ NET_BUFFER_LIST *nbl = nbl_chain;
+
+ while (nbl != NULL)
+ {
+ NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl);
+
+ if (nb != NULL)
+ {
+ UINT size = NET_BUFFER_DATA_LENGTH(nb);
+
+ NdisAdvanceNetBufferDataStart(nb, size, false, NULL);
+ }
+
+ nbl = NET_BUFFER_LIST_NEXT_NBL(nbl);
+ }
+ }
+}
+
+// Get the number of queue items
+UINT NeoGetNumQueue()
+{
+ return ctx->NumPacketQueue;
+}
+
+// Insert the queue
+void NeoInsertQueue(void *buf, UINT size)
+{
+ NEO_QUEUE *p;
+ // Validate arguments
+ if (buf == NULL || size == 0)
+ {
+ return;
+ }
+
+ // Prevent the packet accumulation in large quantities in the queue
+ if (ctx->NumPacketQueue > NEO_MAX_PACKET_QUEUED)
+ {
+ NeoFree(buf);
+ return;
+ }
+
+ // Create a queue
+ p = NeoMalloc(sizeof(NEO_QUEUE));
+ p->Next = NULL;
+ p->Size = size;
+ p->Buf = buf;
+
+ // Append to the queue
+ if (ctx->PacketQueue == NULL)
+ {
+ ctx->PacketQueue = p;
+ }
+ else
+ {
+ NEO_QUEUE *q = ctx->Tail;
+ q->Next = p;
+ }
+
+ ctx->Tail = p;
+
+ ctx->NumPacketQueue++;
+}
+
+// Get the next queued item
+NEO_QUEUE *NeoGetNextQueue()
+{
+ NEO_QUEUE *q;
+ if (ctx->PacketQueue == NULL)
+ {
+ // Empty queue
+ return NULL;
+ }
+
+ // Get the next queued item
+ q = ctx->PacketQueue;
+ ctx->PacketQueue = ctx->PacketQueue->Next;
+ q->Next = NULL;
+ ctx->NumPacketQueue--;
+
+ if (ctx->PacketQueue == NULL)
+ {
+ ctx->Tail = NULL;
+ }
+
+ return q;
+}
+
+// Release the buffer of the queue
+void NeoFreeQueue(NEO_QUEUE *q)
+{
+ // Validate arguments
+ if (q == NULL)
+ {
+ return;
+ }
+ NeoFree(q->Buf);
+ NeoFree(q);
+}
+
+// Lock the packet queue
+void NeoLockPacketQueue()
+{
+ NeoLock(ctx->PacketQueueLock);
+}
+
+// Unlock the packet queue
+void NeoUnlockPacketQueue()
+{
+ NeoUnlock(ctx->PacketQueueLock);
+}
+
+// Initialize the packet queue
+void NeoInitPacketQueue()
+{
+ // Create a lock
+ ctx->PacketQueueLock = NeoNewLock();
+ // Initialize the packet queue
+ ctx->PacketQueue = NULL;
+ ctx->NumPacketQueue = 0;
+ ctx->Tail = NULL;
+}
+
+// Delete all the packets from the packet queue
+void NeoClearPacketQueue()
+{
+ // Release the memory of the packet queue
+ NeoLock(ctx->PacketQueueLock);
+ {
+ NEO_QUEUE *q = ctx->PacketQueue;
+ NEO_QUEUE *qn;
+ while (q != NULL)
+ {
+ qn = q->Next;
+ NeoFree(q->Buf);
+ NeoFree(q);
+ q = qn;
+ }
+ ctx->PacketQueue = NULL;
+ ctx->Tail = NULL;
+ ctx->NumPacketQueue = 0;
+ }
+ NeoUnlock(ctx->PacketQueueLock);
+}
+
+// Release the packet queue
+void NeoFreePacketQueue()
+{
+ // Delete all packets
+ NeoClearPacketQueue();
+
+ // Delete the lock
+ NeoFreeLock(ctx->PacketQueueLock);
+ ctx->PacketQueueLock = NULL;
+}
+
+// Start the adapter
+void NeoStartAdapter()
+{
+ // Initialize the packet queue
+ NeoInitPacketQueue();
+}
+
+// Stop the adapter
+void NeoStopAdapter()
+{
+ // Delete the packet queue
+ NeoFreePacketQueue();
+}
+
+// Initialization
+BOOL NeoInit()
+{
+ // Initialize the context
+ NeoZero(ctx, sizeof(NEO_CTX));
+
+ // Initialize the status information
+ NeoNewStatus(&ctx->Status);
+
+ return TRUE;
+}
+
+// Shutdown
+void NeoShutdown()
+{
+ if (ctx == NULL)
+ {
+ // Uninitialized
+ return;
+ }
+
+ // Relaese the status information
+ NeoFreeStatus(&ctx->Status);
+
+ NeoZero(ctx, sizeof(NEO_CTX));
+}
+
+// Create a status information
+void NeoNewStatus(NEO_STATUS *s)
+{
+ // Validate arguments
+ if (s == NULL)
+ {
+ return;
+ }
+
+ // Memory initialization
+ NeoZero(s, sizeof(NEO_STATUS));
+}
+
+// Release the status information
+void NeoFreeStatus(NEO_STATUS *s)
+{
+ // Validate arguments
+ if (s == NULL)
+ {
+ return;
+ }
+
+ // Memory initialization
+ NeoZero(s, sizeof(NEO_STATUS));
+}
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/Neo6/Neo6.h b/src/Neo6/Neo6.h
new file mode 100644
index 00000000..3a5b6feb
--- /dev/null
+++ b/src/Neo6/Neo6.h
@@ -0,0 +1,320 @@
+// SoftEther VPN Source Code
+// Kernel Device Driver
+//
+// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
+//
+// Copyright (c) 2012-2014 Daiyuu Nobori.
+// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) 2012-2014 SoftEther Corporation.
+//
+// All Rights Reserved.
+//
+// http://www.softether.org/
+//
+// Author: Daiyuu Nobori
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// 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 version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+// Neo6.h
+// Header of Neo6.c
+
+#ifndef NEO_H
+#define NEO_H
+
+
+// Identification string (NDIS)
+#define NDIS_NEO_HARDWARE_ID "VPN Client Adapter - %s"
+#define NDIS_NEO_DEVICE_NAME "\\Device\\NEO_%s_DEVICE"
+#define NDIS_NEO_DEVICE_NAME_WIN32 "\\DosDevices\\NEO_%s_DEVICE"
+#define NDIS_NEO_DEVICE_FILE_NAME "\\\\.\\NEO_NEOADAPTER_%s_DEVICE"
+#define NDIS_NEO_EVENT_NAME "\\BaseNamedObjects\\NEO_EVENT_%s"
+#define NDIS_NEO_EVENT_NAME_WIN32 "Global\\NEO_EVENT_NEOADAPTER_%s"
+
+// Constant
+#define NEO_MAX_PACKET_SIZE 1560
+#define NEO_MAX_PACKET_SIZE_ANNOUNCE 1514
+#define NEO_MIN_PACKET_SIZE 14
+#define NEO_PACKET_HEADER_SIZE 14
+#define NEO_MAX_FRAME_SIZE (NEO_MAX_PACKET_SIZE - NEO_MIN_PACKET_SIZE)
+#define NEO_MAX_SPEED_DEFAULT 100000000ULL
+#define NEO_MAC_ADDRESS_SIZE 6
+#define NEO_MAX_MULTICASE 32
+
+
+// IOCTL constant
+#define NEO_IOCTL_SET_EVENT CTL_CODE(0x8000, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define NEO_IOCTL_PUT_PACKET CTL_CODE(0x8000, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define NEO_IOCTL_GET_PACKET CTL_CODE(0x8000, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+// Packet data exchange related
+#define NEO_MAX_PACKET_EXCHANGE 256 // Number of packets that can be exchanged at a time
+#define NEO_MAX_PACKET_QUEUED 4096 // Maximum number of packets that can be queued
+#define NEO_EX_SIZEOF_NUM_PACKET 4 // Packet count data (UINT)
+#define NEO_EX_SIZEOF_LENGTH_PACKET 4 // Length data of the packet data (UINT)
+#define NEO_EX_SIZEOF_LEFT_FLAG 4 // Flag to indicate that the packet is still
+#define NEO_EX_SIZEOF_ONE_PACKET 1600 // Data area occupied by a packet data
+#define NEO_EXCHANGE_BUFFER_SIZE (NEO_EX_SIZEOF_NUM_PACKET + NEO_EX_SIZEOF_LEFT_FLAG + \
+ (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET) * (NEO_MAX_PACKET_EXCHANGE + 1))
+#define NEO_NUM_PACKET(buf) (*((UINT *)((UCHAR *)buf + 0)))
+#define NEO_SIZE_OF_PACKET(buf, i) (*((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \
+ (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET)))))
+#define NEO_ADDR_OF_PACKET(buf, i) (((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \
+ NEO_EX_SIZEOF_LENGTH_PACKET + \
+ (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET)))))
+#define NEO_LEFT_FLAG(buf) NEO_SIZE_OF_PACKET(buf, NEO_MAX_PACKET_EXCHANGE)
+
+
+
+// Definitions needed to compile as a device driver
+#ifdef NEO_DEVICE_DRIVER
+
+// OS decision
+#ifdef WIN32
+#define OS_WIN32 // Microsoft Windows
+#else
+#define OS_UNIX // UNIX / Linux
+#endif
+
+
+// Type declaration
+#ifndef WINDOWS_H_INCLUDED
+#ifndef WIN9X
+typedef unsigned long BOOL;
+#endif // WIN9X
+#define TRUE 1
+#define FALSE 0
+#endif
+typedef unsigned long bool;
+#define true 1
+#define false 0
+typedef unsigned long long UINT64;
+typedef signed long long INT64;
+typedef unsigned short WORD;
+typedef unsigned short USHORT;
+typedef signed short SHORT;
+typedef unsigned char BYTE;
+typedef unsigned char UCHAR;
+typedef signed char CHAR;
+typedef unsigned long DWORD;
+#define INFINITE 0xFFFFFFFF
+
+#define LESS(a, max_value) ((a) < (max_value) ? (a) : (max_value))
+#define MORE(a, min_value) ((a) > (min_value) ? (a) : (min_value))
+#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b)))
+#define OUTER(a, b, c) (!INNER((a), (b), (c)))
+#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c))))
+#define MIN(a, b) ((a) >= (b) ? (b) : (a))
+#define MAX(a, b) ((a) >= (b) ? (a) : (b))
+#define EQUAL_BOOL(a, b) (((a) && (b)) || ((!(a)) && (!(b))))
+
+#ifdef OS_WIN32
+// NDIS 5.0 related
+#include "NDIS6.h"
+#endif // OS_WIN32
+
+// Lock
+typedef struct _NEO_LOCK
+{
+#ifdef OS_WIN32
+ NDIS_SPIN_LOCK spin_lock;
+#endif
+} NEO_LOCK;
+
+// Event
+typedef struct _NEO_EVENT
+{
+#ifdef OS_WIN32
+#ifndef WIN9X
+ KEVENT *event;
+ HANDLE event_handle;
+#else // WIN9X
+ DWORD win32_event;
+#endif // WIN9X
+#endif
+} NEO_EVENT;
+
+// Packet queue
+typedef struct _NEO_QUEUE
+{
+ struct _NEO_QUEUE *Next;
+ UINT Size;
+ void *Buf;
+} NEO_QUEUE;
+
+// Status
+typedef struct _NEO_STATUS
+{
+ UINT NumPacketSend;
+ UINT NumPacketRecv;
+ UINT NumPacketSendError;
+ UINT NumPacketRecvError;
+ UINT NumPacketRecvNoBuffer;
+ UINT64 Int64NumRecvError; // ifInErrors, OID_GEN_RCV_ERROR
+ UINT64 Int64BytesRecvTotal; // ifHCInOctets, OID_GEN_BYTES_RCV
+ UINT64 Int64NumRecvUnicast; // ifHCInUcastPkts, OID_GEN_DIRECTED_FRAMES_RCV
+ UINT64 Int64NumRecvBroadcast; // ifHCInBroadcastPkts, OID_GEN_BROADCAST_FRAMES_RCV
+ UINT64 Int64BytesSendTotal; // ifHCOutOctets, OID_GEN_BYTES_XMIT
+ UINT64 Int64NumSendUnicast; // ifHCOutUcastPkts, OID_GEN_DIRECTED_FRAMES_XMIT
+ UINT64 Int64NumSendBroadcast; // ifHCOutBroadcastPkts, OID_GEN_BROADCAST_FRAMES_XMIT
+ UINT64 Int64NumSendError; // ifOutErrors, OID_GEN_XMIT_ERROR
+ UINT64 Int64BytesRecvUnicast; // ifHCInUcastOctets, OID_GEN_DIRECTED_BYTES_RCV
+ UINT64 Int64BytesRecvBroadcast; // ifHCInBroadcastOctets, OID_GEN_BROADCAST_BYTES_RCV
+ UINT64 Int64BytesSendUnicast; // ifHCOutUcastOctets, OID_GEN_DIRECTED_BYTES_XMIT
+ UINT64 Int64BytesSendBroadcast; // ifHCOutBroadcastOctets, OID_GEN_BROADCAST_BYTES_XMIT
+} NEO_STATUS;
+
+// NDIS packet buffer
+typedef struct _PACKET_BUFFER
+{
+ NDIS_HANDLE NetBufferListPool; // NET_BUFFER_LIST Pool
+ NET_BUFFER_LIST *NetBufferList; // NET_BUFFER_LIST
+} PACKET_BUFFER;
+
+// Context
+typedef struct _NEO_CTX
+{
+ NEO_EVENT *Event; // Packet reception notification event
+ BOOL Opened; // Flag of whether opened
+ BOOL Inited; // Initialization flag
+ BOOL Initing; // Starting-up flag
+ volatile BOOL Halting; // Stopping flag
+ BYTE MacAddress[6]; // MAC address
+ BYTE padding[2]; // padding
+ NEO_QUEUE *PacketQueue; // Transmit packet queue
+ NEO_QUEUE *Tail; // Tail of the transmission packet queue
+ UINT NumPacketQueue; // Number of queued packet
+ NEO_LOCK *PacketQueueLock; // Transmit packet queue lock
+ NEO_STATUS Status; // Status
+ UINT CurrentPacketFilter; // Current packet filter value
+ UINT CurrentProtocolOptions; // Current protocol option value
+ BOOL Connected, ConnectedOld; // Cable connection state
+ BOOL ConnectedForce; // Connection state forcibly notification
+#ifdef OS_WIN32
+ NDIS_HANDLE NdisMiniportDriverHandle; // NDIS miniport driver handle
+ NDIS_HANDLE NdisControl; // NDIS control handle
+ NDIS_HANDLE NdisMiniport; // NDIS miniport handle
+ NDIS_HANDLE NdisContext; // NDIS context handle
+ DEVICE_OBJECT *NdisControlDevice; // NDIS control device
+ PDRIVER_DISPATCH DispatchTable[IRP_MJ_MAXIMUM_FUNCTION];
+ PACKET_BUFFER *PacketBuffer[NEO_MAX_PACKET_EXCHANGE]; // NDIS packet buffer
+ NDIS_HARDWARE_STATUS HardwareStatus; // Hardware state
+ char HardwareID[MAX_SIZE]; // Hardware ID
+ char HardwareID_Raw[MAX_SIZE]; // Original hardware ID
+ char HardwarePrintableID[MAX_SIZE]; // Hardware ID (for display)
+#endif
+} NEO_CTX;
+
+extern NEO_CTX *ctx;
+
+
+// Neo.c routine
+void NeoNewStatus(NEO_STATUS *s);
+void NeoFreeStatus(NEO_STATUS *s);
+BOOL NeoInit();
+void NeoShutdown();
+void NeoInitPacketQueue();
+void NeoFreePacketQueue();
+void NeoClearPacketQueue();
+void NeoLockPacketQueue();
+void NeoUnlockPacketQueue();
+NEO_QUEUE *NeoGetNextQueue();
+void NeoFreeQueue(NEO_QUEUE *q);
+void NeoInsertQueue(void *buf, UINT size);
+UINT NeoGetNumQueue();
+void NeoStartAdapter();
+void NeoStopAdapter();
+void NeoRead(void *buf);
+void NeoWrite(void *buf);
+
+// Common routine (platform dependent)
+void *NeoMalloc(UINT size);
+void *NeoZeroMalloc(UINT size);
+void NeoFree(void *p);
+void NeoCopy(void *dst, void *src, UINT size);
+void NeoZero(void *dst, UINT size);
+NEO_LOCK *NeoNewLock();
+void NeoLock(NEO_LOCK *lock);
+void NeoUnlock(NEO_LOCK *lock);
+void NeoFreeLock(NEO_LOCK *lock);
+NEO_EVENT *NeoNewEvent(char *name);
+NEO_EVENT *NeoCreateWin9xEvent(DWORD h);
+void NeoFreeEvent(NEO_EVENT *event);
+void NeoSet(NEO_EVENT *event);
+void NeoReset(NEO_EVENT *event);
+BOOL NeoIsKernelAddress(void *addr);
+
+#endif // NEO_DEVICE_DRIVER
+
+
+#endif // NEO_H
+
+
+
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/
diff --git a/src/Neo6/Neo6.rc b/src/Neo6/Neo6.rc
new file mode 100644
index 00000000..2e72f111
--- /dev/null
+++ b/src/Neo6/Neo6.rc
@@ -0,0 +1,63 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Japanese resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+#ifdef _WIN32
+LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+#pragma code_page(932)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Japanese resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/Neo6/Neo6.vcproj b/src/Neo6/Neo6.vcproj
new file mode 100644
index 00000000..b828ed30
--- /dev/null
+++ b/src/Neo6/Neo6.vcproj
@@ -0,0 +1,282 @@
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="Neo6"
+ ProjectGUID="{F7679B65-2FEC-469A-8BAC-B07BF4439422}"
+ RootNamespace="Neo6"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)bin"
+ IntermediateDirectory="$(PlatformName)_$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="0"
+ EnableIntrinsicFunctions="false"
+ FavorSizeOrSpeed="0"
+ AdditionalIncludeDirectories="$(SolutionDir)Mayaqua\win32_inc;C:\WINDDK\7600.16385.0\inc\ddk;C:\WinDDK\7600.16385.0\inc\api;C:\WinDDK\7600.16385.0\inc\crt;$(SolutionDir)"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NEO_EXPORTS;VPN_SPEED"
+ StringPooling="false"
+ ExceptionHandling="0"
+ RuntimeLibrary="0"
+ StructMemberAlignment="4"
+ BufferSecurityCheck="false"
+ EnableFunctionLevelLinking="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ CallingConvention="2"
+ CompileAs="1"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ CommandLine="$(SolutionDir)bin\BuildUtil.exe /CMD:GenerateVersionResource &quot;$(TargetPath)&quot; /OUT:&quot;$(SolutionDir)tmp\VersionResources\$(ProjectName)_$(PlatformName).res&quot;"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ IgnoreImportLibrary="true"
+ LinkLibraryDependencies="false"
+ AdditionalOptions="/driver /subsystem:native,5.00 /FULLBUILD /align:0x80 /osversion:5.00 /STACK:0x40000,0x1000 /MERGE:_PAGE=PAGE /MERGE:_TEXT=.text /NODEFAULTLIB /stub:C:\WINDDK\7600.16385.0\lib\win7\stub512.com"
+ AdditionalDependencies="wdm.lib ndis.lib ntoskrnl.lib fwpkclnt.lib &quot;$(SolutionDir)tmp\VersionResources\$(ProjectName)_$(PlatformName).res&quot;"
+ OutputFile="$(OutDir)\hamcore\not_signed\vpn_driver6.sys"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="C:\WINDDK\7600.16385.0\lib\win7\i386"
+ GenerateManifest="false"
+ IgnoreAllDefaultLibraries="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(SolutionDir)DebugFiles\pdb\$(PlatformName)_$(ConfigurationName)\$(ProjectName).pdb"
+ GenerateMapFile="true"
+ MapFileName="$(SolutionDir)DebugFiles\map\$(PlatformName)_$(ConfigurationName)\$(ProjectName).map"
+ SubSystem="0"
+ OptimizeReferences="1"
+ EnableCOMDATFolding="1"
+ EntryPointSymbol="DriverEntry"
+ BaseAddress="0x10000"
+ RandomizedBaseAddress="0"
+ FixedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary="$(SolutionDir)tmp\lib\$(PlatformName)_$(ConfigurationName)\$(ProjectName).lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="$(SolutionDir)bin\BuildUtil.exe /CMD:SignCode &quot;$(TargetPath)&quot; /COMMENT:&quot;VPN Software&quot; /KERNEL:yes&#x0D;&#x0A;$(SolutionDir)bin\BuildUtil.exe /CMD:GenerateWin8InfFiles x86&#x0D;&#x0A;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(SolutionDir)bin"
+ IntermediateDirectory="$(PlatformName)_$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="0"
+ EnableIntrinsicFunctions="false"
+ FavorSizeOrSpeed="0"
+ AdditionalIncludeDirectories="$(SolutionDir)Mayaqua\win32_inc;C:\WINDDK\7600.16385.0\inc\ddk;C:\WinDDK\7600.16385.0\inc\api;C:\WinDDK\7600.16385.0\inc\crt;$(SolutionDir)"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;NEO_EXPORTS;VPN_SPEED;CPU_64"
+ StringPooling="false"
+ ExceptionHandling="0"
+ RuntimeLibrary="0"
+ StructMemberAlignment="4"
+ BufferSecurityCheck="false"
+ EnableFunctionLevelLinking="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ CallingConvention="2"
+ CompileAs="1"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ CommandLine="$(SolutionDir)bin\BuildUtil.exe /CMD:GenerateVersionResource &quot;$(TargetPath)&quot; /OUT:&quot;$(SolutionDir)tmp\VersionResources\$(ProjectName)_$(PlatformName).res&quot;"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ IgnoreImportLibrary="true"
+ LinkLibraryDependencies="false"
+ AdditionalOptions="/driver /subsystem:native /FULLBUILD /align:0x80 /osversion:5.00 /STACK:0x40000,0x1000 /MERGE:_PAGE=PAGE /MERGE:_TEXT=.text /NODEFAULTLIB /stub:C:\WINDDK\7600.16385.0\lib\win7\stub512.com"
+ AdditionalDependencies="wdm.lib ndis.lib wdmsec.lib ntoskrnl.lib fwpkclnt.lib &quot;$(SolutionDir)tmp\VersionResources\$(ProjectName)_$(PlatformName).res&quot;"
+ OutputFile="$(OutDir)\hamcore\not_signed\vpn_driver6_x64.sys"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="C:\WINDDK\7600.16385.0\lib\win7\amd64"
+ GenerateManifest="false"
+ IgnoreAllDefaultLibraries="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(SolutionDir)DebugFiles\pdb\$(PlatformName)_$(ConfigurationName)\$(ProjectName).pdb"
+ GenerateMapFile="true"
+ MapFileName="$(SolutionDir)DebugFiles\map\$(PlatformName)_$(ConfigurationName)\$(ProjectName).map"
+ SubSystem="0"
+ OptimizeReferences="1"
+ EnableCOMDATFolding="1"
+ EntryPointSymbol="DriverEntry"
+ BaseAddress="0x10000"
+ RandomizedBaseAddress="0"
+ FixedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary="$(SolutionDir)tmp\lib\$(PlatformName)_$(ConfigurationName)\$(ProjectName).lib"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="$(SolutionDir)bin\BuildUtil.exe /CMD:SignCode &quot;$(TargetPath)&quot; /COMMENT:&quot;VPN Software&quot; /KERNEL:yes&#x0D;&#x0A;$(SolutionDir)bin\BuildUtil.exe /CMD:GenerateWin8InfFiles x64&#x0D;&#x0A;"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\NDIS6.c"
+ >
+ </File>
+ <File
+ RelativePath=".\Neo6.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\NDIS6.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Neo6.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\Neo6.rc"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/Neo6/resource.h b/src/Neo6/resource.h
new file mode 100644
index 00000000..1fdda11a
--- /dev/null
+++ b/src/Neo6/resource.h
@@ -0,0 +1,84 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by Neo.rc
+//
+// Comments: Tetsuo Sugiyama, Ph.D.
+//
+//
+// 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 version 2
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
+// AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
+//
+//
+// THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
+// UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
+// MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
+// SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
+// SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
+// CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
+// DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
+// MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
+// SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
+// CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
+// EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
+// JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
+// AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
+// THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
+//
+// USE ONLY IN JAPAN. DO NOT USE IT IN OTHER COUNTRIES. IMPORTING THIS
+// SOFTWARE INTO OTHER COUNTRIES IS AT YOUR OWN RISK. SOME COUNTRIES
+// PROHIBIT ENCRYPTED COMMUNICATIONS. USING THIS SOFTWARE IN OTHER
+// COUNTRIES MIGHT BE RESTRICTED.
+//
+//
+// DEAR SECURITY EXPERTS
+// ---------------------
+//
+// If you find a bug or a security vulnerability please kindly inform us
+// about the problem immediately so that we can fix the security problem
+// to protect a lot of users around the world as soon as possible.
+//
+// Our e-mail address for security reports is:
+// softether-vpn-security [at] softether.org
+//
+// Please note that the above e-mail address is not a technical support
+// inquiry address. If you need technical assistance, please visit
+// http://www.softether.org/ and ask your question on the users forum.
+//
+// Thank you for your cooperation.
+
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
+
+// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
+// Department of Computer Science has dozens of overly-enthusiastic geeks.
+// Join us: http://www.tsukuba.ac.jp/english/admission/