From a6ba9b8788090b584a6c67c0d39740bba71fb5f1 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Mon, 5 Apr 2021 04:48:25 +0200 Subject: [PATCH] Include headers properly --- src/CMakeLists.txt | 4 +- src/Cedar/Account.c | 13 ++- src/Cedar/Account.h | 4 + src/Cedar/Admin.c | 37 ++++++- src/Cedar/Admin.h | 8 ++ src/Cedar/AzureClient.c | 18 +++- src/Cedar/AzureClient.h | 5 + src/Cedar/AzureServer.c | 10 -- src/Cedar/AzureServer.h | 14 --- src/Cedar/Bridge.c | 28 +++--- src/Cedar/Bridge.h | 14 +-- src/Cedar/BridgeUnix.c | 45 +++++---- src/Cedar/BridgeUnix.h | 10 +- src/Cedar/BridgeWin32.c | 37 +++---- src/Cedar/BridgeWin32.h | 15 +-- src/Cedar/CM.c | 55 ++++------- src/Cedar/CM.h | 14 ++- src/Cedar/CMInner.h | 11 +++ src/Cedar/Cedar.c | 29 +++++- src/Cedar/Cedar.h | 138 ++------------------------ src/Cedar/CedarPch.c | 9 -- src/Cedar/CedarPch.h | 20 ---- src/Cedar/CedarType.h | 10 ++ src/Cedar/Client.c | 38 +++++++- src/Cedar/Client.h | 10 +- src/Cedar/Command.c | 40 +++++++- src/Cedar/Command.h | 6 ++ src/Cedar/Connection.c | 26 ++++- src/Cedar/Connection.h | 5 + src/Cedar/Console.c | 30 +++++- src/Cedar/Console.h | 4 + src/Cedar/DDNS.c | 16 ++- src/Cedar/DDNS.h | 5 + src/Cedar/Database.c | 8 +- src/Cedar/Database.h | 2 + src/Cedar/EM.c | 48 ++++----- src/Cedar/EMInner.h | 4 + src/Cedar/EtherLog.c | 19 +++- src/Cedar/EtherLog.h | 2 + src/Cedar/Hub.c | 41 ++++++-- src/Cedar/Hub.h | 2 + src/Cedar/IPC.c | 17 +++- src/Cedar/IPC.h | 5 + src/Cedar/Layer3.c | 16 ++- src/Cedar/Layer3.h | 2 + src/Cedar/Link.c | 16 ++- src/Cedar/Link.h | 4 + src/Cedar/Listener.c | 13 ++- src/Cedar/Listener.h | 3 + src/Cedar/Logging.c | 29 +++++- src/Cedar/Logging.h | 3 + src/Cedar/NM.c | 40 +++----- src/Cedar/NMInner.h | 3 + src/Cedar/Nat.c | 13 ++- src/Cedar/Nat.h | 5 + src/Cedar/NativeStack.c | 16 ++- src/Cedar/NativeStack.h | 4 + src/Cedar/NullLan.c | 12 ++- src/Cedar/NullLan.h | 3 + src/Cedar/Proto.c | 14 ++- src/Cedar/Proto.h | 9 +- src/Cedar/Proto_EtherIP.c | 13 ++- src/Cedar/Proto_EtherIP.h | 3 +- src/Cedar/Proto_IKE.c | 17 +++- src/Cedar/Proto_IKE.h | 2 +- src/Cedar/Proto_IPsec.c | 15 ++- src/Cedar/Proto_IPsec.h | 2 + src/Cedar/Proto_IkePacket.c | 6 +- src/Cedar/Proto_IkePacket.h | 5 + src/Cedar/Proto_L2TP.c | 15 ++- src/Cedar/Proto_L2TP.h | 4 +- src/Cedar/Proto_OpenVPN.c | 17 +++- src/Cedar/Proto_OpenVPN.h | 1 + src/Cedar/Proto_PPP.c | 17 +++- src/Cedar/Proto_PPP.h | 3 + src/Cedar/Proto_SSTP.c | 12 ++- src/Cedar/Proto_SSTP.h | 2 + src/Cedar/Proto_Win7.c | 39 +++----- src/Cedar/Proto_Win7.h | 3 + src/Cedar/Proto_Win7Inner.h | 15 ++- src/Cedar/Proto_WireGuard.c | 12 ++- src/Cedar/Proto_WireGuard.h | 2 + src/Cedar/Protocol.c | 39 +++++++- src/Cedar/Protocol.h | 2 + src/Cedar/Radius.c | 11 ++- src/Cedar/Radius.h | 4 + src/Cedar/Remote.c | 9 +- src/Cedar/Remote.h | 2 + src/Cedar/SM.c | 51 +++++----- src/Cedar/SMInner.h | 13 ++- src/Cedar/SW.c | 49 ++++------ src/Cedar/SW.h | 2 + src/Cedar/SWInner.h | 2 + src/Cedar/Sam.c | 25 ++++- src/Cedar/Sam.h | 3 + src/Cedar/SeLowUser.c | 26 ++--- src/Cedar/SeLowUser.h | 4 + src/Cedar/SecureInfo.c | 10 -- src/Cedar/SecureInfo.h | 14 --- src/Cedar/SecureNAT.c | 13 ++- src/Cedar/SecureNAT.h | 4 + src/Cedar/Server.c | 53 ++++++---- src/Cedar/Server.h | 3 + src/Cedar/Session.c | 29 +++++- src/Cedar/Session.h | 1 + src/Cedar/UT.c | 32 +++--- src/Cedar/UT.h | 2 + src/Cedar/UdpAccel.c | 13 ++- src/Cedar/UdpAccel.h | 4 + src/Cedar/VG.c | 25 ----- src/Cedar/VG.h | 21 ---- src/Cedar/VLan.c | 28 ------ src/Cedar/VLan.h | 18 +--- src/Cedar/VLanUnix.c | 50 +++++----- src/Cedar/VLanUnix.h | 11 ++- src/Cedar/VLanWin32.c | 31 +++--- src/Cedar/VLanWin32.h | 12 ++- src/Cedar/Virtual.c | 16 ++- src/Cedar/Virtual.h | 3 + src/Cedar/WaterMark.c | 2 +- src/Cedar/WaterMark.h | 11 +-- src/Cedar/WebUI.c | 21 +++- src/Cedar/WebUI.h | 8 ++ src/Cedar/Win32Com.cpp | 51 +++------- src/Cedar/Win32Com.h | 108 ++------------------- src/Cedar/WinJumpList.cpp | 98 +++---------------- src/Cedar/WinUi.c | 56 ++++++----- src/Cedar/WinUi.h | 51 +++------- src/Cedar/Wpc.c | 11 ++- src/Cedar/Wpc.h | 5 + src/Mayaqua/CMakeLists.txt | 3 + src/Mayaqua/Cfg.c | 18 ++-- src/Mayaqua/Cfg.h | 2 + src/Mayaqua/Encrypt.c | 48 +++++---- src/Mayaqua/Encrypt.h | 61 ++++++------ src/Mayaqua/FileIO.c | 20 ++-- src/Mayaqua/FileIO.h | 2 + src/Mayaqua/HTTP.c | 8 +- src/Mayaqua/HTTP.h | 2 + src/Mayaqua/Internat.c | 20 ++-- src/Mayaqua/Internat.h | 4 + src/Mayaqua/Kernel.c | 23 +++-- src/Mayaqua/Kernel.h | 2 + src/Mayaqua/MayaType.h | 78 ++++++--------- src/Mayaqua/Mayaqua.c | 26 +++-- src/Mayaqua/Mayaqua.h | 183 ++--------------------------------- src/Mayaqua/Memory.c | 19 ++-- src/Mayaqua/Memory.h | 2 + src/Mayaqua/Microsoft.c | 153 ++++++++++------------------- src/Mayaqua/Microsoft.h | 27 ++---- src/Mayaqua/Network.c | 81 +++++++++------- src/Mayaqua/Network.h | 7 ++ src/Mayaqua/OS.c | 14 +-- src/Mayaqua/OS.h | 2 + src/Mayaqua/Object.c | 17 ++-- src/Mayaqua/Object.h | 1 + src/Mayaqua/Pack.c | 16 ++- src/Mayaqua/Pack.h | 2 + src/Mayaqua/Proxy.c | 8 +- src/Mayaqua/Proxy.h | 3 + src/Mayaqua/Secure.c | 76 +++++++++------ src/Mayaqua/Secure.h | 56 +---------- src/Mayaqua/Str.c | 16 +-- src/Mayaqua/Str.h | 5 +- src/Mayaqua/Table.c | 19 ++-- src/Mayaqua/Table.h | 2 + src/Mayaqua/TcpIp.c | 15 +-- src/Mayaqua/TcpIp.h | 3 + src/Mayaqua/Tick64.c | 22 ++--- src/Mayaqua/Tick64.h | 2 + src/Mayaqua/Tracking.c | 14 +-- src/Mayaqua/Tracking.h | 2 + src/Mayaqua/Unix.c | 41 ++++++-- src/Mayaqua/Unix.h | 2 + src/Mayaqua/Win32.c | 32 +++--- src/Mayaqua/Win32.h | 4 +- src/SeLow/SeLowCommon.h | 6 ++ src/Wfp/Wfp.h | 4 + src/vpnbridge/vpnbridge.c | 28 ++---- src/vpnclient/CMakeLists.txt | 3 +- src/vpnclient/vpncsvc.c | 16 ++- src/vpnclient/vpncsvc.h | 18 ---- src/vpncmd/vpncmd.c | 31 ++---- src/vpncmgr/vpncmgr.c | 23 +---- src/vpnserver/vpnserver.c | 29 ++---- src/vpnsetup/vpnsetup.c | 26 +---- src/vpnsmgr/vpnsmgr.c | 19 +--- src/vpntest/CMakeLists.txt | 2 +- src/vpntest/vpntest.c | 23 ++--- src/vpntest/vpntest.h | 1 - 190 files changed, 1885 insertions(+), 1850 deletions(-) delete mode 100644 src/Cedar/AzureServer.c delete mode 100644 src/Cedar/AzureServer.h delete mode 100644 src/Cedar/CedarPch.c delete mode 100644 src/Cedar/CedarPch.h delete mode 100644 src/Cedar/SecureInfo.c delete mode 100644 src/Cedar/SecureInfo.h delete mode 100644 src/Cedar/VG.c delete mode 100644 src/Cedar/VG.h delete mode 100644 src/Cedar/VLan.c delete mode 100644 src/vpnclient/vpncsvc.h delete mode 100644 src/vpntest/vpntest.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4448c185..86bac60c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -59,7 +59,7 @@ add_definitions(-D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_S include_directories(.) if(WIN32) - add_definitions(-DWIN32 -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS) + add_definitions(-DWIN32 -D_WINDOWS -DOS_WIN32 -D_CRT_SECURE_NO_WARNINGS) endif() if(UNIX) @@ -67,7 +67,7 @@ if(UNIX) set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2") - add_definitions(-DUNIX) + add_definitions(-DUNIX -DOS_UNIX) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") add_definitions(-DUNIX_LINUX) diff --git a/src/Cedar/Account.c b/src/Cedar/Account.c index 31b5397a..37d69bd5 100644 --- a/src/Cedar/Account.c +++ b/src/Cedar/Account.c @@ -5,7 +5,18 @@ // Account.c // Account Manager -#include "CedarPch.h" +#include "Account.h" + +#include "Hub.h" +#include "Layer3.h" +#include "Proto_PPP.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" // Policy items POLICY_ITEM policy_item[] = diff --git a/src/Cedar/Account.h b/src/Cedar/Account.h index 633e9919..e4466cfb 100644 --- a/src/Cedar/Account.h +++ b/src/Cedar/Account.h @@ -8,6 +8,10 @@ #ifndef ACCOUNT_H #define ACCOUNT_H +#include "CedarType.h" + +#include "Mayaqua/Encrypt.h" + #define USER_MAC_STR_PREFIX L"MAC:" #define USER_IPV4_STR_PREFIX L"IPv4:" diff --git a/src/Cedar/Admin.c b/src/Cedar/Admin.c index 59c05939..41fac8ef 100644 --- a/src/Cedar/Admin.c +++ b/src/Cedar/Admin.c @@ -5,7 +5,42 @@ // Admin.c // RPC Module for Management -#include "CedarPch.h" +#include "Admin.h" + +#include "Account.h" +#include "AzureClient.h" +#include "BridgeUnix.h" +#include "BridgeWin32.h" +#include "Connection.h" +#include "DDNS.h" +#include "Layer3.h" +#include "Link.h" +#include "Listener.h" +#include "Nat.h" +#include "Remote.h" +#include "Proto.h" +#include "Proto_IPsec.h" +#include "Proto_OpenVPN.h" +#include "Proto_PPP.h" +#include "Protocol.h" +#include "Sam.h" +#include "SecureNAT.h" +#include "Server.h" +#include "Session.h" +#include "Virtual.h" +#include "Wpc.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/HTTP.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" // Macro for RPC function declaration #define DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ diff --git a/src/Cedar/Admin.h b/src/Cedar/Admin.h index 8663f74b..b176a6f0 100644 --- a/src/Cedar/Admin.h +++ b/src/Cedar/Admin.h @@ -8,6 +8,14 @@ #ifndef ADMIN_H #define ADMIN_H +#include "Account.h" +#include "Cedar.h" +#include "Client.h" +#include "Hub.h" +#include "Logging.h" + +#include "Mayaqua/Kernel.h" + // Windows version struct RPC_WINVER { diff --git a/src/Cedar/AzureClient.c b/src/Cedar/AzureClient.c index 65b0106c..ea6a966c 100644 --- a/src/Cedar/AzureClient.c +++ b/src/Cedar/AzureClient.c @@ -5,7 +5,23 @@ // AzureClient.c // VPN Azure Client -#include "CedarPch.h" +#include "AzureClient.h" + +#include "Cedar.h" +#include "Command.h" +#include "Wpc.h" + +#include "Mayaqua/Encrypt.h" +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/MayaType.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Network.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" + +#include // Wait for connection request void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param) diff --git a/src/Cedar/AzureClient.h b/src/Cedar/AzureClient.h index 6ffa8bf7..4e8050b9 100644 --- a/src/Cedar/AzureClient.h +++ b/src/Cedar/AzureClient.h @@ -8,6 +8,11 @@ #ifndef AZURE_CLIENT_H #define AZURE_CLIENT_H +#include "Cedar.h" +#include "DDNS.h" + +#include "Mayaqua/MayaType.h" + // Constants #define AZURE_SERVER_PORT 443 #define AZURE_PROTOCOL_CONTROL_SIGNATURE "ACTL" diff --git a/src/Cedar/AzureServer.c b/src/Cedar/AzureServer.c deleted file mode 100644 index 0a1a000e..00000000 --- a/src/Cedar/AzureServer.c +++ /dev/null @@ -1,10 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// AzureServer.c -// VPN Azure Server - -#include "CedarPch.h" - - diff --git a/src/Cedar/AzureServer.h b/src/Cedar/AzureServer.h deleted file mode 100644 index 6e86bd8f..00000000 --- a/src/Cedar/AzureServer.h +++ /dev/null @@ -1,14 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// AzureServer.h -// Header of AzureServer.c - -#ifndef AZURE_SERVER_H -#define AZURE_SERVER_H - - -#endif // AZURE_SERVER_H - - diff --git a/src/Cedar/Bridge.c b/src/Cedar/Bridge.c index 3a4ca7b2..48bc806a 100644 --- a/src/Cedar/Bridge.c +++ b/src/Cedar/Bridge.c @@ -5,25 +5,19 @@ // Bridge.c // Ethernet Bridge Program (Local Bridge) -#include +#include "Bridge.h" +#include "BridgeUnix.h" +#include "BridgeWin32.h" -#define BRIDGE_C +#include "Connection.h" +#include "Hub.h" +#include "Session.h" +#include "Virtual.h" -#ifdef WIN32 -#define OS_WIN32 -#endif - -#ifdef OS_WIN32 - -// Win32 -#include "BridgeWin32.c" - -#else - -// Unix -#include "BridgeUnix.c" - -#endif // OS_WIN32 +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" // Hash the list of current Ethernet devices UINT GetEthDeviceHash() diff --git a/src/Cedar/Bridge.h b/src/Cedar/Bridge.h index c3ff9815..f2dc510e 100644 --- a/src/Cedar/Bridge.h +++ b/src/Cedar/Bridge.h @@ -8,20 +8,10 @@ #ifndef BRIDGE_H #define BRIDGE_H -#ifdef OS_WIN32 - -// For Win32 -#include - -#else - -// For Unix -#include - -#endif // OS_WIN32 +#include "Cedar.h" // Constants -#define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router" +#define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router" // Bridge struct BRIDGE diff --git a/src/Cedar/BridgeUnix.c b/src/Cedar/BridgeUnix.c index 5fa21762..b883bb47 100644 --- a/src/Cedar/BridgeUnix.c +++ b/src/Cedar/BridgeUnix.c @@ -4,22 +4,31 @@ // BridgeUnix.c // Ethernet Bridge Program (for UNIX) -//#define BRIDGE_C -//#define UNIX_LINUX -#include +#ifdef OS_UNIX -#ifdef BRIDGE_C +#include "BridgeUnix.h" + +#include "Server.h" +#include "VLanUnix.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/TcpIp.h" +#include "Mayaqua/Unix.h" -#include -#include #include -#include -#include -#include + #include -#include -#include +#include + +#include +#include +#include +#include #ifdef UNIX_SOLARIS #include @@ -27,17 +36,18 @@ #ifdef BRIDGE_PCAP #include -#endif // BRIDGE_PCAP +#endif #ifdef BRIDGE_BPF -#include +#include #include #include #include -#include -#endif // BRIDGE_BPF +#endif + +#ifdef UNIX_LINUX +#include -#ifdef UNIX_LINUX struct my_tpacket_auxdata { UINT tp_status; @@ -2688,5 +2698,4 @@ void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size) Free(data); } - -#endif // BRIDGE_C +#endif diff --git a/src/Cedar/BridgeUnix.h b/src/Cedar/BridgeUnix.h index 7c1b7465..65cf4f31 100644 --- a/src/Cedar/BridgeUnix.h +++ b/src/Cedar/BridgeUnix.h @@ -5,9 +5,15 @@ // BridgeUnix.h // Header of BridgeUnix.c +#ifdef OS_UNIX + #ifndef BRIDGEUNIX_H #define BRIDGEUNIX_H +#include "Bridge.h" + +#include "Mayaqua/Network.h" + // Macro #ifndef SOL_PACKET #define SOL_PACKET 263 @@ -128,6 +134,6 @@ bool DlipBindRequest(int fd); int UnixEthOpenRawSocket(); -#endif // BRIDGEUNIX_H - +#endif // BRIDGEUNIX_H +#endif // OS_UNIX diff --git a/src/Cedar/BridgeWin32.c b/src/Cedar/BridgeWin32.c index 2c02516a..00d3ada0 100644 --- a/src/Cedar/BridgeWin32.c +++ b/src/Cedar/BridgeWin32.c @@ -5,24 +5,27 @@ // BridgeWin32.c // Ethernet Bridge Program (Win32) -#include +#ifdef OS_WIN32 -#ifdef BRIDGE_C +#define BRIDGE_C + +#include "BridgeWin32.h" + +#include "Admin.h" +#include "Connection.h" +#include "SeLowUser.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Str.h" -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - static WP *wp = NULL; static LIST *eth_list = NULL; @@ -2091,6 +2094,4 @@ void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name) Free(ncname); } -#endif // BRIDGE_C - - +#endif diff --git a/src/Cedar/BridgeWin32.h b/src/Cedar/BridgeWin32.h index da08850d..06184380 100644 --- a/src/Cedar/BridgeWin32.h +++ b/src/Cedar/BridgeWin32.h @@ -5,9 +5,15 @@ // BridgeWin32.h // Header of BridgeWin32.c +#ifdef OS_WIN32 + #ifndef BRIDGEWIN32_H #define BRIDGEWIN32_H +#include "Bridge.h" + +#include + #define BRIDGE_WIN32_PACKET_DLL "Packet.dll" #define BRIDGE_WIN32_PCD_DLL "|see.dll" #define BRIDGE_WIN32_PCD_SYS "|DriverPackages\\See\\x86\\See_x86.sys" @@ -18,10 +24,7 @@ #define BRIDGE_WIN32_ETH_BUFFER (1048576) - -typedef void *HANDLE; - -#ifdef BRIDGE_C +#ifdef BRIDGE_C // Header for Internal function (for BridgeWin32.c) typedef struct WP @@ -157,6 +160,6 @@ bool Win32IsUsingSeLow(); void Win32SetEnableSeLow(bool b); bool Win32GetEnableSeLow(); -#endif // BRIDGEWIN32_H - +#endif // BRIDGEWIN32_H +#endif // OS_WIN32 diff --git a/src/Cedar/CM.c b/src/Cedar/CM.c index a7525d8d..69c7c665 100644 --- a/src/Cedar/CM.c +++ b/src/Cedar/CM.c @@ -5,46 +5,33 @@ // CM.c // VPN Client Connection Manager for Win32 -#include +#ifdef OS_WIN32 -#ifdef WIN32 +#define WINUI_C +#define MICROSOFT_C -#define CM_C -#define SM_C -#define MICROSOFT_C - -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#define SECURITY_WIN32 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "CMInner.h" + +#include "Nat.h" +#include "Protocol.h" +#include "Remote.h" #include "SMInner.h" -#include "NMInner.h" -#include "EMInner.h" +#include "UT.h" +#include "Win32Com.h" +#include "WinUi.h" + +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Secure.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Win32.h" + #include "../PenCore/resource.h" +#include // Get the proxy server settings from the registry string of IE bool CmGetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type) diff --git a/src/Cedar/CM.h b/src/Cedar/CM.h index f4124f30..c6b12078 100644 --- a/src/Cedar/CM.h +++ b/src/Cedar/CM.h @@ -5,8 +5,14 @@ // CM.h // Header of CM.c -#ifndef CM_H -#define CM_H +#ifdef OS_WIN32 + +#ifndef CM_H +#define CM_H + +#include "GlobalConst.h" + +#include "Mayaqua/MayaType.h" // Constants #define CM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client Manager" @@ -47,6 +53,6 @@ void CmStopUacHelper(void *p); void *CmExecUiHelperMain(); UINT CmGetSecureBitmapId(char *dest_hostname); -#endif // CM_H - +#endif // CM_H +#endif // OS_WIN32 diff --git a/src/Cedar/CMInner.h b/src/Cedar/CMInner.h index f1169da6..72ad0768 100644 --- a/src/Cedar/CMInner.h +++ b/src/Cedar/CMInner.h @@ -5,10 +5,21 @@ // CMInner.h // Internal header for the CM.c +#include "Client.h" +#include "CM.h" +#include "Command.h" +#include "WinUi.h" + +#include "Mayaqua/Table.h" + +#include + #define STARTUP_MUTEX_NAME GC_SW_SOFTETHER_PREFIX "vpncmgr_startup_mutex" #define NAME_OF_VPN_CLIENT_MANAGER "vpncmgr" +typedef struct LVB LVB; + void CmVoice(char *name); typedef struct CM_UAC_HELPER diff --git a/src/Cedar/Cedar.c b/src/Cedar/Cedar.c index 7340582d..b12fb3ba 100644 --- a/src/Cedar/Cedar.c +++ b/src/Cedar/Cedar.c @@ -5,8 +5,35 @@ // Cedar.c // Cedar Communication Module +#include "Cedar.h" -#include "CedarPch.h" +#include "Admin.h" +#include "Bridge.h" +#include "Connection.h" +#include "Layer3.h" +#include "Link.h" +#include "Listener.h" +#include "Protocol.h" +#include "Sam.h" +#include "Server.h" +#include "Session.h" +#include "VLanWin32.h" +#include "WebUI.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/Encrypt.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/HTTP.h" +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Win32.h" + +#include static UINT init_cedar_counter = 0; static REF *cedar_log_ref = NULL; diff --git a/src/Cedar/Cedar.h b/src/Cedar/Cedar.h index a84e67db..88440c09 100644 --- a/src/Cedar/Cedar.h +++ b/src/Cedar/Cedar.h @@ -8,6 +8,10 @@ #ifndef CEDAR_H #define CEDAR_H +#include "CedarType.h" +#include "GlobalConst.h" + +#include "Mayaqua/Network.h" ////////////////////////////////////////////////////////////////////// // @@ -888,11 +892,11 @@ typedef struct TRAFFIC_ENTRY } TRAFFIC_ENTRY; // Traffic data -typedef struct TRAFFIC +struct TRAFFIC { TRAFFIC_ENTRY Send; // Transmitted data TRAFFIC_ENTRY Recv; // Received data -} TRAFFIC; +}; // Non-SSL connection source typedef struct NON_SSL @@ -911,7 +915,7 @@ typedef struct TINY_LOG } TINY_LOG; // CEDAR structure -typedef struct CEDAR +struct CEDAR { LOCK *lock; // Lock REF *ref; // Reference counter @@ -979,7 +983,7 @@ typedef struct CEDAR UINT FifoBudget; // Fifo budget SSL_ACCEPT_SETTINGS SslAcceptSettings; // SSL Accept Settings UINT DhParamBits; // Bits of Diffie-Hellman parameters -} CEDAR; +}; // Type of CEDAR #define CEDAR_CLIENT 0 // Client @@ -987,132 +991,6 @@ typedef struct CEDAR #define CEDAR_FARM_CONTROLLER 2 // Server farm controller #define CEDAR_FARM_MEMBER 3 // Server farm member - -//////////////////////////// -// Read the header file - -// Type -#include -// Account Manager -#include -// Listener module -#include -// Log storage module -#include -// Connection management -#include -// Session Management -#include -// RPC -#include -// HUB management -#include -// Security Accounts Manager -#include -// Radius authentication module -#include -// Native protocol -#include -// Inter-HUB link -#include -// User-mode virtual host -#include -// SecureNAT -#include -// Digital watermark -#include -// Secure data -#include -// Console service -#include -// Vpncmd utility -#include -// RPC over HTTP -#include -// Third party protocols -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -// Layer-2/Layer-3 converter -#include -// UDP Acceleration -#include -// DDNS Client -#include -// VPN Azure Client -#include -// VPN Azure Server -#include -// Native IP Stack -#include - -#ifdef OS_WIN32 -// Neo device driver -#include -// SeLow User-mode -#include -#endif // OS_WIN32 - -// Neo device driver manipulation library -#include -// Bridge -#include -// Layer-3 switch -#include -// Virtual LAN card for test -#include -// Client -#include -// Server -#include -// License database -#include -// EtherLogger -#include -// Management RPC -#include -// User-mode Router -#include - -// Web UI -#include - -// VPN Gate Main Implementation -#include - - -#ifdef OS_WIN32 - -// Win32 user interface -#include -// Win32 Client Connection Manager -#include -// Win32 Server Manager -#include -// Win32 User-mode Router Manager -#include -// Win32 EtherLogger Manager -#include -// Win32 Network Utility -#include -// Win32 Setup Wizard -#include -// Win32 COM calling module -#include - -#endif - - - - //////////////////////////// // Function prototype diff --git a/src/Cedar/CedarPch.c b/src/Cedar/CedarPch.c deleted file mode 100644 index 722c7afa..00000000 --- a/src/Cedar/CedarPch.c +++ /dev/null @@ -1,9 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// CedarPch.c -// Cedar Pre-compile Header Generating Code - -#include "CedarPch.h" - diff --git a/src/Cedar/CedarPch.h b/src/Cedar/CedarPch.h deleted file mode 100644 index a3eac0f6..00000000 --- a/src/Cedar/CedarPch.h +++ /dev/null @@ -1,20 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// CedarPch.h -// Header file for grecompile header generation for Cedar - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - diff --git a/src/Cedar/CedarType.h b/src/Cedar/CedarType.h index f7aeaa7a..b95dd9a1 100644 --- a/src/Cedar/CedarType.h +++ b/src/Cedar/CedarType.h @@ -8,6 +8,9 @@ #ifndef CEDARTYPE_H #define CEDARTYPE_H +typedef struct CEDAR CEDAR; +typedef struct TRAFFIC TRAFFIC; + // ============================================================== // Remote Procedure Call @@ -471,6 +474,13 @@ typedef struct WIDE_MACHINE_ID WIDE_MACHINE_ID; typedef struct TRIAL_INFO TRIAL_INFO; +// ============================================================== +// Proto +// ============================================================== + +typedef struct PROTO_OPTION PROTO_OPTION; + + // ============================================================== // IPsec // ============================================================== diff --git a/src/Cedar/Client.c b/src/Cedar/Client.c index 0e7b7dfe..3d775477 100644 --- a/src/Cedar/Client.c +++ b/src/Cedar/Client.c @@ -5,7 +5,43 @@ // Client.c // Client Manager -#include "CedarPch.h" +#include "Client.h" + +#include "Account.h" +#include "Admin.h" +#include "Cedar.h" +#include "CM.h" +#include "Connection.h" +#include "IPC.h" +#include "Listener.h" +#include "Logging.h" +#include "Protocol.h" +#include "Remote.h" +#include "Virtual.h" +#include "VLanUnix.h" +#include "VLanWin32.h" +#include "Win32Com.h" +#include "WinUi.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/Encrypt.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Kernel.h" +#include "Mayaqua/MayaType.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Network.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/OS.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Secure.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Win32.h" + +#include static CLIENT *client = NULL; static LISTENER *cn_listener = NULL; diff --git a/src/Cedar/Client.h b/src/Cedar/Client.h index 439a5e9f..b7198ac5 100644 --- a/src/Cedar/Client.h +++ b/src/Cedar/Client.h @@ -8,6 +8,10 @@ #ifndef CLIENT_H #define CLIENT_H +#include "Account.h" +#include "Session.h" +#include "Wpc.h" + #define CLIENT_CONFIG_PORT GC_CLIENT_CONFIG_PORT // Client port number #define CLIENT_NOTIFY_PORT GC_CLIENT_NOTIFY_PORT // Client notification port number #define CLIENT_WAIT_CN_READY_TIMEOUT (10 * 1000) // Standby time to start the client notification service @@ -742,11 +746,9 @@ void OutRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i, UINT num); void OutRpcCmSetting(PACK *p, CM_SETTING *c); void InRpcCmSetting(CM_SETTING *c, PACK *p); - -#ifdef OS_WIN32 +#ifdef OS_WIN32 +typedef struct MS_DRIVER_VER MS_DRIVER_VER; void CiInitDriverVerStruct(MS_DRIVER_VER *ver); #endif // OS_EIN32 #endif // CLIENT_H - - diff --git a/src/Cedar/Command.c b/src/Cedar/Command.c index 52582fb1..a4e1c429 100644 --- a/src/Cedar/Command.c +++ b/src/Cedar/Command.c @@ -5,7 +5,45 @@ // Command.c // vpncmd Command Line Management Utility -#include "CedarPch.h" +#include "Command.h" + +#include "Admin.h" +#include "AzureClient.h" +#include "Connection.h" +#include "Console.h" +#include "Database.h" +#include "DDNS.h" +#include "Layer3.h" +#include "Nat.h" +#include "Proto_IPsec.h" +#include "Proto_WireGuard.h" +#include "Radius.h" +#include "Server.h" +#include "Virtual.h" +#include "WinUi.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Network.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/OS.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Secure.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Unix.h" + +#include + +#ifdef OS_UNIX +#include +#include +#endif // System checker definition typedef bool (CHECKER_PROC_DEF)(); diff --git a/src/Cedar/Command.h b/src/Cedar/Command.h index ff7f9d7c..5a91c37c 100644 --- a/src/Cedar/Command.h +++ b/src/Cedar/Command.h @@ -8,6 +8,12 @@ #ifndef COMMAND_H #define COMMAND_H +#include "CedarType.h" + +#include "Mayaqua/Network.h" + +#include + // Constants #define TRAFFIC_DEFAULT_PORT 9821 #define TRAFFIC_NUMTCP_MAX 32 diff --git a/src/Cedar/Connection.c b/src/Cedar/Connection.c index 64d0e01a..b5f2e38e 100644 --- a/src/Cedar/Connection.c +++ b/src/Cedar/Connection.c @@ -5,7 +5,31 @@ // Connection.c // Connection Manager -#include "CedarPch.h" +#include "Connection.h" + +#include "BridgeUnix.h" +#include "BridgeWin32.h" +#include "Hub.h" +#include "Layer3.h" +#include "Link.h" +#include "Listener.h" +#include "Nat.h" +#include "Protocol.h" +#include "Server.h" +#include "SecureNAT.h" +#include "Session.h" +#include "UdpAccel.h" +#include "Virtual.h" + +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" + +#include // Determine whether the socket is to use to send #define IS_SEND_TCP_SOCK(ts) \ diff --git a/src/Cedar/Connection.h b/src/Cedar/Connection.h index 04223f94..8f47a71f 100644 --- a/src/Cedar/Connection.h +++ b/src/Cedar/Connection.h @@ -8,6 +8,11 @@ #ifndef CONNECTION_H #define CONNECTION_H +#include "Cedar.h" + +#include "Mayaqua/Encrypt.h" +#include "Mayaqua/Proxy.h" + // Magic number indicating that the packet is compressed #define CONNECTION_BULK_COMPRESS_SIGNATURE 0xDEADBEEFCAFEFACEULL diff --git a/src/Cedar/Console.c b/src/Cedar/Console.c index 28d4bc57..45bab426 100644 --- a/src/Cedar/Console.c +++ b/src/Cedar/Console.c @@ -5,8 +5,32 @@ // Console.c // Console Service -#include "CedarPch.h" +#include "Console.h" +#include "Cedar.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" + +#include +#include + +#ifdef OS_WIN32 +#include +#else +#include +#include + +#include +#include +#endif // Display the help for the command void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list) @@ -1911,7 +1935,7 @@ bool PasswordPrompt(char *password, UINT size) int c; #ifdef OS_WIN32 - c = getch(); + c = _getch(); #else // OS_WIN32 c = getc(stdin); #endif // OS_WIN32 @@ -1943,7 +1967,7 @@ bool PasswordPrompt(char *password, UINT size) { // Read one more character #ifdef OS_WIN32 - c = getch(); + c = _getch(); #else // OS_WIN32 c = getc(stdin); #endif // OS_WIN32 diff --git a/src/Cedar/Console.h b/src/Cedar/Console.h index 0e9c2b35..a4b7e9dc 100644 --- a/src/Cedar/Console.h +++ b/src/Cedar/Console.h @@ -8,6 +8,10 @@ #ifndef CONSOLE_H #define CONSOLE_H +#include "CedarType.h" + +#include "Mayaqua/MayaType.h" + // Constant #define MAX_PROMPT_STRSIZE 65536 #define WIN32_DEFAULT_CONSOLE_WIDTH 100 diff --git a/src/Cedar/DDNS.c b/src/Cedar/DDNS.c index 5a2fec7b..87cd49f1 100644 --- a/src/Cedar/DDNS.c +++ b/src/Cedar/DDNS.c @@ -5,7 +5,21 @@ // DDNS.c // Dynamic DNS Client -#include "CedarPch.h" +#include "DDNS.h" + +#include "AzureClient.h" +#include "Server.h" +#include "Virtual.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" // Get the current status of the DDNS client void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st) diff --git a/src/Cedar/DDNS.h b/src/Cedar/DDNS.h index bd6a6fc1..0775766f 100644 --- a/src/Cedar/DDNS.h +++ b/src/Cedar/DDNS.h @@ -8,6 +8,11 @@ #ifndef DDNS_H #define DDNS_H +#include "CedarType.h" +#include "Wpc.h" + +#include + // Certificate hash #define DDNS_CERT_HASH "78BF0499A99396907C9F49DD13571C81FE26E6F5" \ "439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \ diff --git a/src/Cedar/Database.c b/src/Cedar/Database.c index 321d64b0..3f638878 100644 --- a/src/Cedar/Database.c +++ b/src/Cedar/Database.c @@ -5,7 +5,13 @@ // Database.c // License database -#include "CedarPch.h" +#include "Database.h" + +#include "Cedar.h" + +#include "Mayaqua/Memory.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Str.h" // Get the License status string wchar_t *LiGetLicenseStatusStr(UINT i) diff --git a/src/Cedar/Database.h b/src/Cedar/Database.h index a413a5d5..4985fb5e 100644 --- a/src/Cedar/Database.h +++ b/src/Cedar/Database.h @@ -8,6 +8,8 @@ #ifndef DATABASE_H #define DATABASE_H +#include "Mayaqua/MayaType.h" + wchar_t *LiGetLicenseStatusStr(UINT i); bool LiIsLicenseKey(char *str); bool LiStrToKeyBit(UCHAR *keybit, char *keystr); diff --git a/src/Cedar/EM.c b/src/Cedar/EM.c index cfc0bbcf..87640238 100644 --- a/src/Cedar/EM.c +++ b/src/Cedar/EM.c @@ -5,39 +5,31 @@ // EM.c // EtherLogger Manager for Win32 -#include +#ifdef OS_WIN32 -#ifdef WIN32 +#define WINUI_C -#define SM_C -#define CM_C -#define NM_C -#define EM_C - -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CMInner.h" -#include "SMInner.h" -#include "NMInner.h" +#include "EM.h" #include "EMInner.h" + +#include "CMInner.h" +#include "Database.h" +#include "EtherLog.h" +#include "Remote.h" +#include "SMInner.h" +#include "WinUi.h" + +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" + #include "../PenCore/resource.h" +#include +#include // License registration process void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s) diff --git a/src/Cedar/EMInner.h b/src/Cedar/EMInner.h index c4327aee..d13ebadc 100644 --- a/src/Cedar/EMInner.h +++ b/src/Cedar/EMInner.h @@ -5,6 +5,10 @@ // EMInner.h // Inner header of EM.c +#include "CedarType.h" + +#include "Mayaqua/MayaType.h" + // Constants #define EM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\EtherLogger\\Manager" diff --git a/src/Cedar/EtherLog.c b/src/Cedar/EtherLog.c index dc057a97..f29cf74e 100644 --- a/src/Cedar/EtherLog.c +++ b/src/Cedar/EtherLog.c @@ -5,7 +5,24 @@ // EtherLog.c // EtherLogger program -#include "CedarPch.h" +#include "EtherLog.h" + +#include "Admin.h" +#include "BridgeUnix.h" +#include "BridgeWin32.h" +#include "Listener.h" +#include "Remote.h" +#include "Sam.h" +#include "Server.h" +#include "WinUi.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/Encrypt.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/OS.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Str.h" static LOCK *el_lock = NULL; static EL *el = NULL; diff --git a/src/Cedar/EtherLog.h b/src/Cedar/EtherLog.h index ba3db161..2ade72e9 100644 --- a/src/Cedar/EtherLog.h +++ b/src/Cedar/EtherLog.h @@ -8,6 +8,8 @@ #ifndef ETHERLOG_H #define ETHERLOG_H +#include "Hub.h" + // Whether this is a beta version #define ELOG_IS_BETA true diff --git a/src/Cedar/Hub.c b/src/Cedar/Hub.c index ac36052a..71ed6913 100644 --- a/src/Cedar/Hub.c +++ b/src/Cedar/Hub.c @@ -5,7 +5,28 @@ // Hub.c // Virtual HUB module -#include "CedarPch.h" +#include "Hub.h" + +#include "Admin.h" +#include "Bridge.h" +#include "Connection.h" +#include "Link.h" +#include "Nat.h" +#include "NativeStack.h" +#include "Protocol.h" +#include "Radius.h" +#include "SecureNAT.h" +#include "Server.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/TcpIp.h" +#include "Mayaqua/Tick64.h" #define GetHubAdminOptionDataAndSet(ao, name, dest) \ value = GetHubAdminOptionData(ao, name); \ @@ -4000,7 +4021,7 @@ DISCARD_PACKET: if (forward_now) { - if (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) == 0) + if (Cmp(packet->MacAddressSrc, hub->HubMacAddr, 6) == 0) { if (s != NULL) { @@ -4008,7 +4029,7 @@ DISCARD_PACKET: goto DISCARD_PACKET; } } - if (s != NULL && (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0)) + if (s != NULL && (Cmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0)) { // Check whether the source MAC address is registered in the table Copy(t.MacAddress, packet->MacAddressSrc, 6); @@ -4167,7 +4188,7 @@ DISCARD_PACKET: } // It's already registered and it's in another session - if (check_mac && (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0) && + if (check_mac && (Cmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0) && ((entry->UpdatedTime + MAC_TABLE_EXCLUSIVE_TIME) >= now)) { UCHAR *mac = packet->MacAddressSrc; @@ -4184,7 +4205,7 @@ DISCARD_PACKET: if ((s->LastDLinkSTPPacketSendTick != 0) && (tick_diff < 750ULL) && - (memcmp(hash, s->LastDLinkSTPPacketDataHash, MD5_SIZE) == 0)) + (Cmp(hash, s->LastDLinkSTPPacketDataHash, MD5_SIZE) == 0)) { // Discard if the same packet sent before 750ms ago Debug("D-Link Discard %u\n", (UINT)tick_diff); @@ -4824,8 +4845,8 @@ UPDATE_FDB: if (s != NULL) { - if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || - memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) + if (Cmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || + Cmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) { goto DISCARD_UNICAST_PACKET; } @@ -5041,8 +5062,8 @@ DISCARD_UNICAST_PACKET: if (s != NULL) { - if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || - memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) + if (Cmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || + Cmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) { discard = true; } @@ -6664,7 +6685,7 @@ int CompareMacTable(void *p1, void *p2) { return 0; } - r = memcmp(e1->MacAddress, e2->MacAddress, 6); + r = Cmp(e1->MacAddress, e2->MacAddress, 6); if (r != 0) { return r; diff --git a/src/Cedar/Hub.h b/src/Cedar/Hub.h index e5df65d6..3942c69a 100644 --- a/src/Cedar/Hub.h +++ b/src/Cedar/Hub.h @@ -8,6 +8,8 @@ #ifndef HUB_H #define HUB_H +#include "Account.h" +#include "Logging.h" // Prefix in the access list for investigating whether the user name which is contained in a particular file #define ACCESS_LIST_INCLUDED_PREFIX "include:" // Included diff --git a/src/Cedar/IPC.c b/src/Cedar/IPC.c index 333eedf5..54c6661b 100644 --- a/src/Cedar/IPC.c +++ b/src/Cedar/IPC.c @@ -5,7 +5,22 @@ // IPC.c // In-process VPN client module -#include "CedarPch.h" +#include "IPC.h" + +#include "Admin.h" +#include "Cedar.h" +#include "Client.h" +#include "Connection.h" +#include "Hub.h" +#include "Protocol.h" +#include "Radius.h" +#include "Virtual.h" + +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" // Extract the MS-CHAP v2 authentication information by parsing the password string bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password) diff --git a/src/Cedar/IPC.h b/src/Cedar/IPC.h index d10a72fa..ed9ae24d 100644 --- a/src/Cedar/IPC.h +++ b/src/Cedar/IPC.h @@ -8,6 +8,11 @@ #ifndef IPC_H #define IPC_H +#include "Cedar.h" +#include "Proto_WireGuard.h" + +#include "Mayaqua/TcpIp.h" + // Constants #define IPC_ARP_LIFETIME (3 * 60 * 1000) #define IPC_ARP_GIVEUPTIME (1 * 1000) diff --git a/src/Cedar/Layer3.c b/src/Cedar/Layer3.c index 96c5c216..6838bc9d 100644 --- a/src/Cedar/Layer3.c +++ b/src/Cedar/Layer3.c @@ -5,7 +5,21 @@ // Layer3.c // Layer-3 switch module -#include "CedarPch.h" +#include "Layer3.h" + +#include "Connection.h" +#include "Hub.h" +#include "Server.h" +#include "Session.h" +#include "Virtual.h" + +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/TcpIp.h" +#include "Mayaqua/Tick64.h" static UCHAR broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; diff --git a/src/Cedar/Layer3.h b/src/Cedar/Layer3.h index 5e91d3a3..2c1c409c 100644 --- a/src/Cedar/Layer3.h +++ b/src/Cedar/Layer3.h @@ -8,6 +8,8 @@ #ifndef LAYER3_H #define LAYER3_H +#include "Cedar.h" + // Constants #define L3_USERNAME "L3SW_" diff --git a/src/Cedar/Link.c b/src/Cedar/Link.c index ec25023c..001fd19d 100644 --- a/src/Cedar/Link.c +++ b/src/Cedar/Link.c @@ -5,7 +5,21 @@ // Link.c // Inter-HUB Link -#include "CedarPch.h" +#include "Link.h" + +#include "Account.h" +#include "Client.h" +#include "Connection.h" +#include "Hub.h" +#include "Logging.h" +#include "Server.h" +#include "Session.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" // Link server thread void LinkServerSessionThread(THREAD *t, void *param) diff --git a/src/Cedar/Link.h b/src/Cedar/Link.h index 22b42999..817d0bbb 100644 --- a/src/Cedar/Link.h +++ b/src/Cedar/Link.h @@ -8,6 +8,10 @@ #ifndef LINK_H #define LINK_H +#include "CedarType.h" + +#include "Mayaqua/MayaType.h" + struct LINK { bool Started; // Running flag diff --git a/src/Cedar/Listener.c b/src/Cedar/Listener.c index f365ddc8..1eb876f5 100644 --- a/src/Cedar/Listener.c +++ b/src/Cedar/Listener.c @@ -5,7 +5,18 @@ // Listener.c // Listener module -#include "CedarPch.h" +#include "Listener.h" + +#include "Cedar.h" +#include "Connection.h" +#include "Logging.h" +#include "Server.h" +#include "Session.h" + +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" static bool disable_dos = false; static UINT max_connections_per_ip = DEFAULT_MAX_CONNECTIONS_PER_IP; diff --git a/src/Cedar/Listener.h b/src/Cedar/Listener.h index 9ef8a1d8..40b816f1 100644 --- a/src/Cedar/Listener.h +++ b/src/Cedar/Listener.h @@ -8,6 +8,9 @@ #ifndef LISTENER_H #define LISTENER_H +#include "CedarType.h" + +#include "Mayaqua/Kernel.h" // Function to call when receiving a new connection typedef void (NEW_CONNECTION_PROC)(CONNECTION *c); diff --git a/src/Cedar/Logging.c b/src/Cedar/Logging.c index ff79ef48..b8e0198d 100644 --- a/src/Cedar/Logging.c +++ b/src/Cedar/Logging.c @@ -5,7 +5,28 @@ // Logging.c // Log storaging module -#include "CedarPch.h" +#include "Logging.h" + +#include "Admin.h" +#include "Client.h" +#include "Nat.h" +#include "Proto_EtherIP.h" +#include "Proto_IKE.h" +#include "Proto_PPP.h" +#include "Remote.h" +#include "SecureNAT.h" +#include "Server.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Unix.h" +#include "Mayaqua/Win32.h" static char *delete_targets[] = { @@ -832,8 +853,8 @@ bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packe return true; } - if (memcmp(hub->HubMacAddr, packet->MacAddressSrc, 6) == 0 || - memcmp(hub->HubMacAddr, packet->MacAddressDest, 6) == 0) + if (Cmp(hub->HubMacAddr, packet->MacAddressSrc, 6) == 0 || + Cmp(hub->HubMacAddr, packet->MacAddressDest, 6) == 0) { return true; } @@ -2272,7 +2293,7 @@ bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UIN } } - if (strcmp(old_datestr, tmp) != 0) + if (StrCmp(old_datestr, tmp) != 0) { ret = true; StrCpy(old_datestr, MAX_SIZE, tmp); diff --git a/src/Cedar/Logging.h b/src/Cedar/Logging.h index b59be053..b4c05941 100644 --- a/src/Cedar/Logging.h +++ b/src/Cedar/Logging.h @@ -8,6 +8,9 @@ #ifndef LOGGING_H #define LOGGING_H +#include "Cedar.h" + +#include "Mayaqua/Network.h" // Port number for HTTP monitoring #define LOG_HTTP_PORT 80 diff --git a/src/Cedar/NM.c b/src/Cedar/NM.c index 3e63738e..3e80b5da 100644 --- a/src/Cedar/NM.c +++ b/src/Cedar/NM.c @@ -5,36 +5,20 @@ // NM.c // VPN User-mode Router Manager for Win32 -#include +#ifdef OS_WIN32 -#ifdef WIN32 - -#define SM_C -#define CM_C -#define NM_C - -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CMInner.h" -#include "SMInner.h" +#include "NM.h" #include "NMInner.h" -#include "EMInner.h" + +#include "CMInner.h" +#include "Nat.h" +#include "Remote.h" +#include "Server.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Str.h" + #include "../PenCore/resource.h" // Global variable diff --git a/src/Cedar/NMInner.h b/src/Cedar/NMInner.h index ab9b6a22..14531be6 100644 --- a/src/Cedar/NMInner.h +++ b/src/Cedar/NMInner.h @@ -5,6 +5,9 @@ // NMInner.h // The internal header of NM.c +#include "SMInner.h" + +#include "Mayaqua/Encrypt.h" // Constants #define NM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager" diff --git a/src/Cedar/Nat.c b/src/Cedar/Nat.c index 63852fb5..69ab1e6c 100644 --- a/src/Cedar/Nat.c +++ b/src/Cedar/Nat.c @@ -5,7 +5,18 @@ // Nat.c // User-mode Router -#include "CedarPch.h" +#include "Nat.h" + +#include "Admin.h" +#include "Remote.h" +#include "Sam.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" static LOCK *nat_lock = NULL; static NAT *nat = NULL; diff --git a/src/Cedar/Nat.h b/src/Cedar/Nat.h index 70cf601e..7cdb5d3b 100644 --- a/src/Cedar/Nat.h +++ b/src/Cedar/Nat.h @@ -8,6 +8,11 @@ #ifndef NAT_H #define NAT_H +#include "Cedar.h" +#include "Virtual.h" + +#include "Mayaqua/Kernel.h" + // Constants #define NAT_CONFIG_FILE_NAME "$vpn_router.config" // NAT configuration file #define DEFAULT_NAT_ADMIN_PORT 2828 // Default port number for management diff --git a/src/Cedar/NativeStack.c b/src/Cedar/NativeStack.c index afd01afe..627c7207 100644 --- a/src/Cedar/NativeStack.c +++ b/src/Cedar/NativeStack.c @@ -5,7 +5,21 @@ // NativeStack.c // Native IP stack -#include "CedarPch.h" +#include "NativeStack.h" + +#include "BridgeUnix.h" +#include "BridgeWin32.h" +#include "IPC.h" +#include "Virtual.h" + +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" + +#ifdef OS_UNIX +#include "Mayaqua/Unix.h" +#endif // Stack main thread void NsMainThread(THREAD *thread, void *param) diff --git a/src/Cedar/NativeStack.h b/src/Cedar/NativeStack.h index 23142d8a..e96ba173 100644 --- a/src/Cedar/NativeStack.h +++ b/src/Cedar/NativeStack.h @@ -8,6 +8,10 @@ #ifndef NATIVESTACK_H #define NATIVESTACK_H +#include "CedarType.h" + +#include "Mayaqua/TcpIp.h" + //// Constants #define NS_MAC_ADDRESS_BYTE_1 0xDA // First byte of the MAC address diff --git a/src/Cedar/NullLan.c b/src/Cedar/NullLan.c index 1e2606a0..0b953415 100644 --- a/src/Cedar/NullLan.c +++ b/src/Cedar/NullLan.c @@ -5,7 +5,17 @@ // NullLan.c // Virtual LAN card device driver for testing -#include "CedarPch.h" +#include "NullLan.h" + +#include "Connection.h" +#include "Session.h" + +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" static UCHAR null_lan_broadcast_address[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; diff --git a/src/Cedar/NullLan.h b/src/Cedar/NullLan.h index 16267f55..f703cecd 100644 --- a/src/Cedar/NullLan.h +++ b/src/Cedar/NullLan.h @@ -8,6 +8,9 @@ #ifndef NULLLAN_H #define NULLLAN_H +#include "CedarType.h" + +#include "Mayaqua/MayaType.h" #define NULL_PACKET_GENERATE_INTERVAL 100000000 // Packet generation interval diff --git a/src/Cedar/Proto.c b/src/Cedar/Proto.c index 46413ef2..96c07533 100644 --- a/src/Cedar/Proto.c +++ b/src/Cedar/Proto.c @@ -1,6 +1,18 @@ -#include "CedarPch.h" +#include "Proto.h" +#include "Cedar.h" +#include "Logging.h" #include "Proto_OpenVPN.h" +#include "Proto_SSTP.h" +#include "Proto_WireGuard.h" +#include "Server.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" void ProtoLog(const PROTO *proto, const PROTO_SESSION *session, const char *name, ...) { diff --git a/src/Cedar/Proto.h b/src/Cedar/Proto.h index e14ceced..909e3d5a 100644 --- a/src/Cedar/Proto.h +++ b/src/Cedar/Proto.h @@ -1,6 +1,11 @@ #ifndef PROTO_H #define PROTO_H +#include "CedarType.h" + +#include "Mayaqua/MayaType.h" +#include "Mayaqua/Network.h" + #define PROTO_OPTION_TOGGLE_NAME "Enabled" // OpenVPN sends 2 bytes, thus this is the buffer size. @@ -31,7 +36,7 @@ typedef struct PROTO UDPLISTENER *UdpListener; } PROTO; -typedef struct PROTO_OPTION +struct PROTO_OPTION { char *Name; PROTO_OPTION_VALUE Type; @@ -40,7 +45,7 @@ typedef struct PROTO_OPTION bool Bool; char *String; }; -} PROTO_OPTION; +}; typedef struct PROTO_IMPL { diff --git a/src/Cedar/Proto_EtherIP.c b/src/Cedar/Proto_EtherIP.c index ea7ed179..3e457774 100644 --- a/src/Cedar/Proto_EtherIP.c +++ b/src/Cedar/Proto_EtherIP.c @@ -5,7 +5,18 @@ // Proto_EtherIP.c // EtherIP protocol stack -#include "CedarPch.h" +#include "Proto_EtherIP.h" + +#include "Connection.h" +#include "IPC.h" +#include "Logging.h" +#include "Proto_IKE.h" + +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" // IPC connection processing thread void EtherIPIpcConnectThread(THREAD *t, void *p) diff --git a/src/Cedar/Proto_EtherIP.h b/src/Cedar/Proto_EtherIP.h index c540bc68..0df44990 100644 --- a/src/Cedar/Proto_EtherIP.h +++ b/src/Cedar/Proto_EtherIP.h @@ -8,8 +8,7 @@ #ifndef PROTO_ETHERIP_H #define PROTO_ETHERIP_H -//// Macro - +#include "Proto_IPsec.h" //// Constants #define ETHERIP_VPN_CONNECT_RETRY_INTERVAL (15 * 1000) // VPN connection retry interval diff --git a/src/Cedar/Proto_IKE.c b/src/Cedar/Proto_IKE.c index c35468c2..852d37ec 100644 --- a/src/Cedar/Proto_IKE.c +++ b/src/Cedar/Proto_IKE.c @@ -5,7 +5,22 @@ // Proto_IKE.c // IKE (ISAKMP) and ESP protocol stack -#include "CedarPch.h" +#include "Proto_IKE.h" + +#include "Cedar.h" +#include "Connection.h" +#include "Logging.h" +#include "Proto_EtherIP.h" +#include "Proto_IPsec.h" +#include "Proto_L2TP.h" +#include "Server.h" + +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/TcpIp.h" +#include "Mayaqua/Tick64.h" //#define RAW_DEBUG diff --git a/src/Cedar/Proto_IKE.h b/src/Cedar/Proto_IKE.h index c32b55fc..26ec8f2e 100644 --- a/src/Cedar/Proto_IKE.h +++ b/src/Cedar/Proto_IKE.h @@ -8,7 +8,7 @@ #ifndef PROTO_IKE_H #define PROTO_IKE_H -//// Macro +#include "Proto_IkePacket.h" //// Constants diff --git a/src/Cedar/Proto_IPsec.c b/src/Cedar/Proto_IPsec.c index 3128ffff..c6c5f575 100644 --- a/src/Cedar/Proto_IPsec.c +++ b/src/Cedar/Proto_IPsec.c @@ -5,8 +5,21 @@ // Proto_IPsec.c // IPsec module -#include "CedarPch.h" +#include "Proto_IPsec.h" +#include "Hub.h" +#include "Proto_IKE.h" +#include "Proto_L2TP.h" +#include "Proto_Win7.h" +#include "Server.h" + +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Unix.h" static bool ipsec_disable = false; diff --git a/src/Cedar/Proto_IPsec.h b/src/Cedar/Proto_IPsec.h index 7be62430..bfc6ce49 100644 --- a/src/Cedar/Proto_IPsec.h +++ b/src/Cedar/Proto_IPsec.h @@ -8,6 +8,8 @@ #ifndef PROTO_IPSEC_H #define PROTO_IPSEC_H +#include "Cedar.h" + //// Constants // UDP port number diff --git a/src/Cedar/Proto_IkePacket.c b/src/Cedar/Proto_IkePacket.c index f3e837af..f7fcd73c 100644 --- a/src/Cedar/Proto_IkePacket.c +++ b/src/Cedar/Proto_IkePacket.c @@ -5,7 +5,11 @@ // Proto_IkePacket.c // IKE (ISAKMP) packet processing -#include "CedarPch.h" +#include "Proto_IkePacket.h" + +#include "Mayaqua/Memory.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/TcpIp.h" // Convert the string to a password BUF *IkeStrToPassword(char *str) diff --git a/src/Cedar/Proto_IkePacket.h b/src/Cedar/Proto_IkePacket.h index c02bba32..193d32ec 100644 --- a/src/Cedar/Proto_IkePacket.h +++ b/src/Cedar/Proto_IkePacket.h @@ -8,6 +8,11 @@ #ifndef PROTO_IKEPACKET_H #define PROTO_IKEPACKET_H +#include "CedarType.h" + +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Network.h" + // Constants #ifdef OS_WIN32 #pragma pack(push, 1) diff --git a/src/Cedar/Proto_L2TP.c b/src/Cedar/Proto_L2TP.c index 6994777c..45eac6a2 100644 --- a/src/Cedar/Proto_L2TP.c +++ b/src/Cedar/Proto_L2TP.c @@ -5,7 +5,20 @@ // Proto_L2TP.c // L2TP protocol stack -#include "CedarPch.h" +#include "Proto_L2TP.h" + +#include "Connection.h" +#include "Logging.h" +#include "Proto_EtherIP.h" +#include "Proto_IKE.h" +#include "Proto_IPsec.h" +#include "Proto_PPP.h" + +#include "Mayaqua/Memory.h" +#include "Mayaqua/Network.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/TcpIp.h" // Release the L2TP AVP value void FreeL2TPAVP(L2TP_AVP *a) diff --git a/src/Cedar/Proto_L2TP.h b/src/Cedar/Proto_L2TP.h index 9d83f66b..cf1d055c 100644 --- a/src/Cedar/Proto_L2TP.h +++ b/src/Cedar/Proto_L2TP.h @@ -8,7 +8,9 @@ #ifndef PROTO_L2TP_H #define PROTO_L2TP_H -//// Macro +#include "CedarType.h" + +#include "Mayaqua/Network.h" // Check the sequence number #define L2TP_SEQ_LT(a, b) (((USHORT)(((USHORT)(a)) - ((USHORT)(b)))) & 0x8000) diff --git a/src/Cedar/Proto_OpenVPN.c b/src/Cedar/Proto_OpenVPN.c index d844ea90..816f390f 100644 --- a/src/Cedar/Proto_OpenVPN.c +++ b/src/Cedar/Proto_OpenVPN.c @@ -5,7 +5,22 @@ // Proto_OpenVPN.c // OpenVPN protocol stack -#include "CedarPch.h" +#include "Proto_OpenVPN.h" + +#include "Cedar.h" +#include "Connection.h" +#include "IPC.h" +#include "Logging.h" +#include "Proto_EtherIP.h" +#include "Proto_PPP.h" +#include "Server.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" // Ping signature of the OpenVPN protocol static UCHAR ping_signature[] = diff --git a/src/Cedar/Proto_OpenVPN.h b/src/Cedar/Proto_OpenVPN.h index 78204cc3..dd851cc9 100644 --- a/src/Cedar/Proto_OpenVPN.h +++ b/src/Cedar/Proto_OpenVPN.h @@ -8,6 +8,7 @@ #ifndef PROTO_OPENVPN_H #define PROTO_OPENVPN_H +#include "Proto.h" //// Constants #define OPENVPN_UDP_PORT 1194 // OpenVPN default UDP port number diff --git a/src/Cedar/Proto_PPP.c b/src/Cedar/Proto_PPP.c index a275db66..b99c0775 100644 --- a/src/Cedar/Proto_PPP.c +++ b/src/Cedar/Proto_PPP.c @@ -5,7 +5,22 @@ // Proto_PPP.c // PPP protocol stack -#include "CedarPch.h" +#include "Proto_PPP.h" + +#include "Account.h" +#include "Cedar.h" +#include "Connection.h" +#include "Hub.h" +#include "IPC.h" +#include "Logging.h" +#include "Proto_IPsec.h" +#include "Radius.h" +#include "Server.h" + +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" // PPP main thread void PPPThread(THREAD *thread, void *param) diff --git a/src/Cedar/Proto_PPP.h b/src/Cedar/Proto_PPP.h index 8414fec9..47ac9ebb 100644 --- a/src/Cedar/Proto_PPP.h +++ b/src/Cedar/Proto_PPP.h @@ -8,6 +8,9 @@ #ifndef PROTO_PPP_H #define PROTO_PPP_H +#include "CedarType.h" + +#include "Mayaqua/TcpIp.h" //// Macro #define PPP_LCP_CODE_IS_NEGATIVE(c) ((c) == PPP_LCP_CODE_NAK || (c) == PPP_LCP_CODE_REJECT || (c) == PPP_LCP_CODE_CODE_REJECT || (c) == PPP_LCP_CODE_PROTOCOL_REJECT) diff --git a/src/Cedar/Proto_SSTP.c b/src/Cedar/Proto_SSTP.c index 6c69fb11..64664f53 100644 --- a/src/Cedar/Proto_SSTP.c +++ b/src/Cedar/Proto_SSTP.c @@ -5,7 +5,17 @@ // Proto_SSTP.c // SSTP (Microsoft Secure Socket Tunneling Protocol) protocol stack -#include "CedarPch.h" +#include "Proto_SSTP.h" + +#include "Connection.h" +#include "Proto_PPP.h" +#include "Server.h" + +#include "Mayaqua/HTTP.h" +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" const PROTO_IMPL *SstpGetProtoImpl() { diff --git a/src/Cedar/Proto_SSTP.h b/src/Cedar/Proto_SSTP.h index adb0347a..ca341ee4 100644 --- a/src/Cedar/Proto_SSTP.h +++ b/src/Cedar/Proto_SSTP.h @@ -8,6 +8,8 @@ #ifndef PROTO_SSTP_H #define PROTO_SSTP_H +#include "Proto.h" + //// Constants #define SSTP_URI "/sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/" // SSTP HTTPS URI #define SSTP_VERSION_1 0x10 // SSTP Version 1.0 diff --git a/src/Cedar/Proto_Win7.c b/src/Cedar/Proto_Win7.c index 82e4e217..ad78a771 100644 --- a/src/Cedar/Proto_Win7.c +++ b/src/Cedar/Proto_Win7.c @@ -5,39 +5,26 @@ // Proto_Win7.c // Initialize the helper module for Windows 7 / Windows 8 / Windows Vista / Windows Server 2008 / Windows Server 2008 R2 / Windows Server 2012 / Windows 10 -#include +#ifdef OS_WIN32 -#ifdef WIN32 +#include "Proto_Win7.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Str.h" -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#define INITGUID -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Proto_Win7Inner.h" #include +#include + +#include + static IPSEC_WIN7_FUNCTIONS *api = NULL; static HINSTANCE hDll = NULL; - // Initialize the IPsec helper module for Windows 7 IPSEC_WIN7 *IPsecWin7Init() { diff --git a/src/Cedar/Proto_Win7.h b/src/Cedar/Proto_Win7.h index 33d585b1..0c7bf9d1 100644 --- a/src/Cedar/Proto_Win7.h +++ b/src/Cedar/Proto_Win7.h @@ -8,6 +8,9 @@ #ifndef PROTO_WIN7_H #define PROTO_WIN7_H +#include "Proto_IPsec.h" +#include "Proto_Win7Inner.h" + // Constants #define IPSEC_WIN7_SRC_SYS_X86 "|pxwfp_x86.sys" #define IPSEC_WIN7_SRC_SYS_X64 "|pxwfp_x64.sys" diff --git a/src/Cedar/Proto_Win7Inner.h b/src/Cedar/Proto_Win7Inner.h index 7a8767be..615a6786 100644 --- a/src/Cedar/Proto_Win7Inner.h +++ b/src/Cedar/Proto_Win7Inner.h @@ -5,8 +5,15 @@ // Proto_Win7Inner.h // Internal header of Proto_Win7.c -#ifndef PROTO_WIN7_INNER_H -#define PROTO_WIN7_INNER_H +#ifdef OS_WIN32 + +#ifndef PROTO_WIN7_INNER_H +#define PROTO_WIN7_INNER_H + +#include "Mayaqua/MayaType.h" + +#include +#include // API function typedef struct IPSEC_WIN7_FUNCTIONS @@ -74,4 +81,6 @@ struct IPSEC_WIN7 }; -#endif // PROTO_WIN7_INNER_H +#endif // PROTO_WIN7_INNER_H + +#endif // OS_WIN32 diff --git a/src/Cedar/Proto_WireGuard.c b/src/Cedar/Proto_WireGuard.c index cd7c3e74..dfb40779 100644 --- a/src/Cedar/Proto_WireGuard.c +++ b/src/Cedar/Proto_WireGuard.c @@ -1,4 +1,14 @@ -#include "CedarPch.h" +#include "Proto_WireGuard.h" + +#include "Connection.h" +#include "IPC.h" +#include "Logging.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" #include diff --git a/src/Cedar/Proto_WireGuard.h b/src/Cedar/Proto_WireGuard.h index 12c4b306..6816c84a 100644 --- a/src/Cedar/Proto_WireGuard.h +++ b/src/Cedar/Proto_WireGuard.h @@ -1,6 +1,8 @@ #ifndef PROTO_WIREGUARD_H #define PROTO_WIREGUARD_H +#include "Proto.h" + #include #define WG_IPC_POSTFIX "WIREGUARD" diff --git a/src/Cedar/Protocol.c b/src/Cedar/Protocol.c index 95799c18..416f8142 100644 --- a/src/Cedar/Protocol.c +++ b/src/Cedar/Protocol.c @@ -5,9 +5,42 @@ // Protocol.c // SoftEther protocol related routines -#include "CedarPch.h" +#include "Protocol.h" -static UCHAR ssl_packet_start[3] = {0x17, 0x03, 0x00}; +#include "Admin.h" +#include "Client.h" +#include "CM.h" +#include "DDNS.h" +#include "Hub.h" +#include "IPC.h" +#include "Link.h" +#include "Logging.h" +#include "Proto_IPsec.h" +#include "Proto_OpenVPN.h" +#include "Proto_PPP.h" +#include "Proto_SSTP.h" +#include "Radius.h" +#include "Sam.h" +#include "Server.h" +#include "UdpAccel.h" +#include "VLanUnix.h" +#include "WaterMark.h" +#include "WebUI.h" +#include "WinUi.h" +#include "Wpc.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/OS.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Secure.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" // Download and save intermediate certificates if necessary bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x) @@ -3156,7 +3189,7 @@ bool ServerAccept(CONNECTION *c) if (IsURLMsg(msg, NULL, 0) == false) { - if (s != NULL && s->IsRUDPSession && c != NULL && StrCmpi(hub->Name, VG_HUBNAME) != 0) + if (s != NULL && s->IsRUDPSession && c != NULL) { // Show the warning message if the connection is made by NAT-T wchar_t *tmp2; diff --git a/src/Cedar/Protocol.h b/src/Cedar/Protocol.h index b44ecd7c..8e3db267 100644 --- a/src/Cedar/Protocol.h +++ b/src/Cedar/Protocol.h @@ -8,6 +8,8 @@ #ifndef PROTOCOL_H #define PROTOCOL_H +#include "Connection.h" + // The parameters that will be passed to the certificate confirmation thread struct CHECK_CERT_THREAD_PROC { diff --git a/src/Cedar/Radius.c b/src/Cedar/Radius.c index e5f143b8..34d646aa 100644 --- a/src/Cedar/Radius.c +++ b/src/Cedar/Radius.c @@ -5,10 +5,17 @@ // Radius.c // Radius authentication module -#include "CedarPch.h" +#include "Radius.h" -////////// Modern implementation +#include "Connection.h" +#include "IPC.h" +#include "Server.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" // send PEAP-MSCHAPv2 auth client response bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge) diff --git a/src/Cedar/Radius.h b/src/Cedar/Radius.h index dbe46051..8c422368 100644 --- a/src/Cedar/Radius.h +++ b/src/Cedar/Radius.h @@ -8,6 +8,10 @@ #ifndef RADIUS_H #define RADIUS_H +#include "Cedar.h" + +#include "Mayaqua/Mayaqua.h" + #define RADIUS_DEFAULT_PORT 1812 // The default port number #define RADIUS_RETRY_INTERVAL 1000 // Retransmission interval #define RADIUS_RETRY_TIMEOUT (15 * 1000) // Time-out period, keep it 2FA friendly diff --git a/src/Cedar/Remote.c b/src/Cedar/Remote.c index 742c83c3..982c2442 100644 --- a/src/Cedar/Remote.c +++ b/src/Cedar/Remote.c @@ -5,7 +5,14 @@ // Remote.c // Remote Procedure Call -#include "CedarPch.h" +#include "Remote.h" + +#include "Admin.h" + +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Str.h" // End of RPC void EndRpc(RPC *rpc) diff --git a/src/Cedar/Remote.h b/src/Cedar/Remote.h index 49de5056..0032c89f 100644 --- a/src/Cedar/Remote.h +++ b/src/Cedar/Remote.h @@ -8,6 +8,8 @@ #ifndef REMOTE_H #define REMOTE_H +#include "Connection.h" + // RPC execution function typedef PACK *(RPC_DISPATCHER)(RPC *r, char *function_name, PACK *p); diff --git a/src/Cedar/SM.c b/src/Cedar/SM.c index a2726969..ce645826 100644 --- a/src/Cedar/SM.c +++ b/src/Cedar/SM.c @@ -5,38 +5,35 @@ // SM.c // VPN Server Manager for Win32 -#include +#ifdef OS_WIN32 -#ifdef WIN32 - -#define SM_C -#define CM_C -#define NM_C - -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CMInner.h" +#include "SM.h" #include "SMInner.h" + +#include "AzureClient.h" +#include "CMInner.h" +#include "Console.h" +#include "Database.h" +#include "Layer3.h" #include "NMInner.h" -#include "EMInner.h" +#include "Proto_PPP.h" +#include "Radius.h" +#include "Remote.h" +#include "Server.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Secure.h" +#include "Mayaqua/Str.h" + #include "../PenCore/resource.h" +#include +#include + // Global variable static SM *sm = NULL; static bool link_create_now = false; diff --git a/src/Cedar/SMInner.h b/src/Cedar/SMInner.h index b41d2b34..b1cd699c 100644 --- a/src/Cedar/SMInner.h +++ b/src/Cedar/SMInner.h @@ -5,6 +5,17 @@ // SMInner.h // The internal header of SM.c +#ifndef SMINNER_H +#define SMINNER_H + +#include "Admin.h" +#include "Connection.h" +#include "DDNS.h" +#include "Proto_EtherIP.h" +#include "WinUi.h" + +#include "Mayaqua/TcpIp.h" + // Constants #define SM_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager" #define SM_CERT_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Cert Tool" @@ -720,4 +731,4 @@ UINT SmProxyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); void SmProxyDlgInit(HWND hWnd, INTERNET_SETTING *t); void SmProxyDlgUpdate(HWND hWnd, INTERNET_SETTING *t); - +#endif diff --git a/src/Cedar/SW.c b/src/Cedar/SW.c index ae089d1b..4a0eb9e3 100644 --- a/src/Cedar/SW.c +++ b/src/Cedar/SW.c @@ -5,40 +5,29 @@ // SW.c // Setup Wizard for Win32 -#include +#ifdef OS_WIN32 -#ifdef WIN32 - -#define SM_C -#define CM_C -#define NM_C -#define SW_C - -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CMInner.h" -#include "SMInner.h" -#include "NMInner.h" -#include "EMInner.h" +#include "SW.h" #include "SWInner.h" + +#include "CMInner.h" +#include "Console.h" +#include "SeLowUser.h" +#include "Win32Com.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Win32.h" + #include "../PenCore/resource.h" +#include + //// Old MSI product information // VPN Server static SW_OLD_MSI old_msi_vpnserver[] = diff --git a/src/Cedar/SW.h b/src/Cedar/SW.h index 718ee3f2..cd3488f0 100644 --- a/src/Cedar/SW.h +++ b/src/Cedar/SW.h @@ -8,6 +8,8 @@ #ifndef SW_H #define SW_H +#include "Mayaqua/MayaType.h" + #define SW_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\Setup Wizard Settings" diff --git a/src/Cedar/SWInner.h b/src/Cedar/SWInner.h index cf22ac2c..8b41a21a 100644 --- a/src/Cedar/SWInner.h +++ b/src/Cedar/SWInner.h @@ -8,6 +8,8 @@ #ifndef SW_INNER_H #define SW_INNER_H +#include "WinUi.h" + // Component string #define SW_NAME_VPNSERVER "vpnserver" #define SW_LONG_VPNSERVER _UU("SW_LONG_VPNSERVER") diff --git a/src/Cedar/Sam.c b/src/Cedar/Sam.c index 3836dc5e..e9a72b64 100644 --- a/src/Cedar/Sam.c +++ b/src/Cedar/Sam.c @@ -5,8 +5,31 @@ // Sam.c // Security Accounts Manager -#include "CedarPch.h" +#include "Sam.h" +#include "Account.h" +#include "Cedar.h" +#include "Hub.h" +#include "IPC.h" +#include "Proto_PPP.h" +#include "Radius.h" +#include "Server.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" + +#include + +#ifdef OS_UNIX +#include +#include + +#include +#include +#endif int base64_enc_len(unsigned int plainLen) { unsigned int n = plainLen; diff --git a/src/Cedar/Sam.h b/src/Cedar/Sam.h index 88a9bac6..c43aa2ee 100644 --- a/src/Cedar/Sam.h +++ b/src/Cedar/Sam.h @@ -8,6 +8,9 @@ #ifndef SAM_H #define SAM_H +#include "CedarType.h" + +#include "Mayaqua/MayaType.h" // Function prototype bool SamIsUser(HUB *h, char *username); diff --git a/src/Cedar/SeLowUser.c b/src/Cedar/SeLowUser.c index e8b45014..80c38fa9 100644 --- a/src/Cedar/SeLowUser.c +++ b/src/Cedar/SeLowUser.c @@ -5,20 +5,22 @@ // SeLowUser.c // SoftEther Lightweight Network Protocol User-mode Library -#include +#ifdef OS_WIN32 -#ifdef WIN32 +#include "SeLowUser.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "BridgeWin32.h" +#include "Win32Com.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" + +#include "See/Devioctl.h" // Load the drivers hive bool SuLoadDriversHive() diff --git a/src/Cedar/SeLowUser.h b/src/Cedar/SeLowUser.h index 92ad9465..fb249778 100644 --- a/src/Cedar/SeLowUser.h +++ b/src/Cedar/SeLowUser.h @@ -8,6 +8,10 @@ #ifndef SELOWUSER_H #define SELOWUSER_H +#include "CedarType.h" + +#include "Mayaqua/Mayaqua.h" + #include //// Macro diff --git a/src/Cedar/SecureInfo.c b/src/Cedar/SecureInfo.c deleted file mode 100644 index a2ece05b..00000000 --- a/src/Cedar/SecureInfo.c +++ /dev/null @@ -1,10 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SecureInfo.c -// Code related to a secure VPN tunnel data for system administrators - -#include "CedarPch.h" - - diff --git a/src/Cedar/SecureInfo.h b/src/Cedar/SecureInfo.h deleted file mode 100644 index 1a7c8057..00000000 --- a/src/Cedar/SecureInfo.h +++ /dev/null @@ -1,14 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SecureInfo.h -// Header of SecureInfo.c - -#ifndef SECUREINFO_H -#define SECUREINFO_H - - -#endif // SECUREINFO_H - - diff --git a/src/Cedar/SecureNAT.c b/src/Cedar/SecureNAT.c index bbcfed3a..3383a242 100644 --- a/src/Cedar/SecureNAT.c +++ b/src/Cedar/SecureNAT.c @@ -5,7 +5,18 @@ // SecureNAT.c // SecureNAT code -#include "CedarPch.h" +#include "SecureNAT.h" + +#include "Connection.h" +#include "Hub.h" +#include "Logging.h" +#include "Nat.h" +#include "Session.h" + +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" // SecureNAT server-side thread void SnSecureNATThread(THREAD *t, void *param) diff --git a/src/Cedar/SecureNAT.h b/src/Cedar/SecureNAT.h index 756a16ad..7f77a098 100644 --- a/src/Cedar/SecureNAT.h +++ b/src/Cedar/SecureNAT.h @@ -8,6 +8,10 @@ #ifndef SECURENAT_H #define SECURENAT_H +#include "CedarType.h" + +#include "Mayaqua/MayaType.h" + struct SNAT { LOCK *lock; // Lock diff --git a/src/Cedar/Server.c b/src/Cedar/Server.c index 42b987e3..a2294c94 100644 --- a/src/Cedar/Server.c +++ b/src/Cedar/Server.c @@ -5,7 +5,38 @@ // Server.c // VPN Server module -#include "CedarPch.h" +#include "Server.h" + +#include "Admin.h" +#include "AzureClient.h" +#include "BridgeUnix.h" +#include "BridgeWin32.h" +#include "Connection.h" +#include "DDNS.h" +#include "Layer3.h" +#include "Link.h" +#include "Listener.h" +#include "Nat.h" +#include "Proto_IPsec.h" +#include "Protocol.h" +#include "Radius.h" +#include "Sam.h" +#include "SecureNAT.h" +#include "WinUi.h" + +#include "Mayaqua/Cfg.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/OS.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/TcpIp.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Win32.h" static SERVER *server = NULL; static LOCK *server_lock = NULL; @@ -2841,28 +2872,8 @@ bool SiLoadConfigurationCfg(SERVER *s, FOLDER *root) } } - - { - HUB *h = NULL; - - // Remove the virtual HUB "VPNGATE" when VGS disabled - LockHubList(s->Cedar); - { - h = GetHub(s->Cedar, VG_HUBNAME); - } - UnlockHubList(s->Cedar); - - if (h != NULL) - { - StopHub(h); - DelHub(s->Cedar, h); - ReleaseHub(h); - } - } - s->IPsecMessageDisplayed = CfgGetBool(root, "IPsecMessageDisplayed"); - return true; } diff --git a/src/Cedar/Server.h b/src/Cedar/Server.h index 9961877d..01fbddf7 100644 --- a/src/Cedar/Server.h +++ b/src/Cedar/Server.h @@ -8,6 +8,9 @@ #ifndef SERVER_H #define SERVER_H +#include "Client.h" +#include "Proto_WireGuard.h" + // Default ports #define SERVER_DEF_PORTS_1 443 #define SERVER_DEF_PORTS_2 992 diff --git a/src/Cedar/Session.c b/src/Cedar/Session.c index 3f80511d..f91ec0f7 100644 --- a/src/Cedar/Session.c +++ b/src/Cedar/Session.c @@ -5,7 +5,34 @@ // Session.c // Session Manager -#include "CedarPch.h" +#include "Session.h" + +#include "BridgeUnix.h" +#include "BridgeWin32.h" +#include "Client.h" +#include "Connection.h" +#include "Hub.h" +#include "Link.h" +#include "Nat.h" +#include "Protocol.h" +#include "SecureNAT.h" +#include "Server.h" +#include "UdpAccel.h" +#include "VLanUnix.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/TcpIp.h" +#include "Mayaqua/Tick64.h" + +// TODO: Mayaqua should not depend on Cedar. +#include "Cedar/WinUi.h" // Main routine of the session void SessionMain(SESSION *s) diff --git a/src/Cedar/Session.h b/src/Cedar/Session.h index 15dc2322..a28485c7 100644 --- a/src/Cedar/Session.h +++ b/src/Cedar/Session.h @@ -8,6 +8,7 @@ #ifndef SESSION_H #define SESSION_H +#include "Cedar.h" // Interval to increment the number of logins after the connection #define NUM_LOGIN_INCREMENT_INTERVAL (30 * 1000) diff --git a/src/Cedar/UT.c b/src/Cedar/UT.c index 2149e08e..d9d4ccfc 100644 --- a/src/Cedar/UT.c +++ b/src/Cedar/UT.c @@ -5,30 +5,20 @@ // UT.c // SoftEther Network Utility For Win32 -#include - -#ifdef WIN32 +#ifdef OS_WIN32 #define UT_C -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "UT.h" + +#include "WinUi.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" + #include "../PenCore/resource.h" static char *selected_adapter = NULL; diff --git a/src/Cedar/UT.h b/src/Cedar/UT.h index d4415a6e..c7aa0b28 100644 --- a/src/Cedar/UT.h +++ b/src/Cedar/UT.h @@ -8,6 +8,8 @@ #ifndef UT_H #define UT_H +#include "Mayaqua/MayaType.h" + // Constant #define SPEED_METER_REFRESH_INTERVAL 500 diff --git a/src/Cedar/UdpAccel.c b/src/Cedar/UdpAccel.c index 5915c4b6..d100ba7d 100644 --- a/src/Cedar/UdpAccel.c +++ b/src/Cedar/UdpAccel.c @@ -5,7 +5,18 @@ // UdpAccel.c // UDP acceleration function -#include "CedarPch.h" +#include "UdpAccel.h" + +#include "Connection.h" + +#include "Mayaqua/Kernel.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/TcpIp.h" +#include "Mayaqua/Tick64.h" + +#include // Polling process void UdpAccelPoll(UDP_ACCEL *a) diff --git a/src/Cedar/UdpAccel.h b/src/Cedar/UdpAccel.h index b9d88c0e..f8eb87a6 100644 --- a/src/Cedar/UdpAccel.h +++ b/src/Cedar/UdpAccel.h @@ -8,6 +8,10 @@ #ifndef UDPACCEL_H #define UDPACCEL_H +#include "CedarType.h" + +#include "Mayaqua/Network.h" + // Constants #define UDP_ACCELERATION_COMMON_KEY_SIZE_V1 20 // V1: Common key size #define UDP_ACCELERATION_PACKET_KEY_SIZE_V1 20 // V1: Key size for the packet diff --git a/src/Cedar/VG.c b/src/Cedar/VG.c deleted file mode 100644 index 8c930e7e..00000000 --- a/src/Cedar/VG.c +++ /dev/null @@ -1,25 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VG.c -// VPN Gate Plugin Main Implementation - -#include "CedarPch.h" - - -bool InitVg() -{ - return false; -} - -void FreeVg() -{ -} - -void VgUseStaticLink() -{ -} - - - diff --git a/src/Cedar/VG.h b/src/Cedar/VG.h deleted file mode 100644 index cf01357e..00000000 --- a/src/Cedar/VG.h +++ /dev/null @@ -1,21 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VG.h -// Header for VG.c - -#ifndef VG_H -#define VG_H - -#define VG_HUBNAME "VPNGATE" - - -bool InitVg(); -void FreeVg(); -void VgUseStaticLink(); - -#endif // VG_H - - - diff --git a/src/Cedar/VLan.c b/src/Cedar/VLan.c deleted file mode 100644 index 0d7a9f01..00000000 --- a/src/Cedar/VLan.c +++ /dev/null @@ -1,28 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VLan.c -// Virtual LAN card adapter manipulation library - -#include - -#define VLAN_C - -#ifdef WIN32 -#define OS_WIN32 -#endif - -#ifdef OS_WIN32 - -// For Win32 -#include "VLanWin32.c" - -#else - -// For UNIX -#include "VLanUnix.c" - -#endif // OS_WIN32 - - diff --git a/src/Cedar/VLan.h b/src/Cedar/VLan.h index 51408422..069702e0 100644 --- a/src/Cedar/VLan.h +++ b/src/Cedar/VLan.h @@ -8,6 +8,8 @@ #ifndef VLAN_H #define VLAN_H +#include "Mayaqua/MayaType.h" + // Parameters related to VLAN struct VLAN_PARAM { @@ -15,18 +17,4 @@ struct VLAN_PARAM UCHAR Padding[2]; }; -#ifdef OS_WIN32 - -// For Win32 -#include - -#else // OS_WIN32 - -// For UNIX -#include - -#endif // OS_WIN32 - -#endif // VLAN_H - - +#endif diff --git a/src/Cedar/VLanUnix.c b/src/Cedar/VLanUnix.c index 2af36793..f78e4a90 100644 --- a/src/Cedar/VLanUnix.c +++ b/src/Cedar/VLanUnix.c @@ -5,32 +5,39 @@ // VLanUnix.c // Virtual device driver library for UNIX -#include +#ifdef UNIX -#ifdef VLAN_C +#include "VLanUnix.h" + +#include "Connection.h" +#include "Session.h" + +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/TunTap.h" + +#ifdef UNIX_BSD +// For "sockaddr" in +#include +#endif -#include -#include -#include -#include -#include -#include #include -#include -#include -#ifdef UNIX_BSD -#ifdef UNIX_OPENBSD -#include -#else // UNIX_OPENBSD -#include -#endif // UNIX_OPENBSD -#endif // UNIX_BSD +#include +#include +#include +#include -#ifdef OS_UNIX +#ifdef UNIX_OPENBSD +#include +#else +#include +#endif static LIST *unix_vlan = NULL; -#ifndef NO_VLAN +#ifndef NO_VLAN // Get the PACKET_ADAPTER PACKET_ADAPTER *VLanGetPacketAdapter() @@ -815,7 +822,4 @@ void UnixVLanFree() unix_vlan = NULL; } -#endif // OS_UNIX - -#endif // VLAN_C - +#endif diff --git a/src/Cedar/VLanUnix.h b/src/Cedar/VLanUnix.h index 04b1c8d3..6bd5f44a 100644 --- a/src/Cedar/VLanUnix.h +++ b/src/Cedar/VLanUnix.h @@ -5,9 +5,17 @@ // VLanUnix.h // Header of VLanUnix.c +#ifdef OS_UNIX + #ifndef VLANUNIX_H #define VLANUNIX_H +#include "CedarType.h" + +#include "VLan.h" + +#include "Mayaqua/MayaType.h" + // Constant #define TAP_READ_BUF_SIZE 1600 @@ -62,5 +70,6 @@ bool UnixVLanSetState(char* name, bool state_up); int UnixVLanGet(char *name); int UnixCompareVLan(void *p1, void *p2); -#endif // VLANUNIX_H +#endif // VLANUNIX_H +#endif // OS_UNIX diff --git a/src/Cedar/VLanWin32.c b/src/Cedar/VLanWin32.c index fc094fc4..b90ac2d2 100644 --- a/src/Cedar/VLanWin32.c +++ b/src/Cedar/VLanWin32.c @@ -5,22 +5,22 @@ // VLanWin32.c // Virtual device driver library for Win32 -#include +#ifdef OS_WIN32 -#ifdef VLAN_C +#include "VLanWin32.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Admin.h" +#include "Connection.h" +#include "UdpAccel.h" -#ifdef OS_WIN32 +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Win32.h" + +#include "Neo/Neo.h" typedef DWORD(CALLBACK* OPENVXDHANDLE)(HANDLE); @@ -1374,7 +1374,4 @@ CLEANUP: return NULL; } -#endif // OS_WIN32 - -#endif //VLAN_C - +#endif diff --git a/src/Cedar/VLanWin32.h b/src/Cedar/VLanWin32.h index 3bdee0b0..e8ee3b6a 100644 --- a/src/Cedar/VLanWin32.h +++ b/src/Cedar/VLanWin32.h @@ -5,9 +5,17 @@ // VLanWin32.h // Header of VLanWin32.c +#ifdef OS_WIN32 + #ifndef VLANWIN32_H #define VLANWIN32_H +#include "CedarType.h" + +#include "VLan.h" + +#include "Mayaqua/Network.h" + // Routing table tracking timer #define TRACKING_INTERVAL_INITIAL 444 // Initial #define TRACKING_INTERVAL_ADD 444 // Adding value @@ -89,4 +97,6 @@ void RouteTrackingMain(SESSION *s); void Win32GetWinVer(RPC_WINVER *v); -#endif // VLANWIN32_H +#endif // VLANWIN32_H + +#endif // OS_WIN32 diff --git a/src/Cedar/Virtual.c b/src/Cedar/Virtual.c index dab42cab..e61f4594 100644 --- a/src/Cedar/Virtual.c +++ b/src/Cedar/Virtual.c @@ -5,7 +5,21 @@ // Virtual.c // User-mode virtual host program -#include "CedarPch.h" +#include "Virtual.h" + +#include "BridgeUnix.h" +#include "BridgeWin32.h" +#include "Connection.h" +#include "Hub.h" +#include "IPC.h" +#include "NativeStack.h" +#include "Server.h" + +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Tick64.h" static UCHAR broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; static char v_vgs_hostname[256] = {0}; diff --git a/src/Cedar/Virtual.h b/src/Cedar/Virtual.h index f4086cbe..a7f344f1 100644 --- a/src/Cedar/Virtual.h +++ b/src/Cedar/Virtual.h @@ -8,6 +8,9 @@ #ifndef VIRTUAL_H #define VIRTUAL_H +#include "Cedar.h" + +#include "Mayaqua/TcpIp.h" #define NN_RAW_IP_PORT_START 61001 #define NN_RAW_IP_PORT_END 65535 diff --git a/src/Cedar/WaterMark.c b/src/Cedar/WaterMark.c index c039bb92..2b7f568d 100644 --- a/src/Cedar/WaterMark.c +++ b/src/Cedar/WaterMark.c @@ -5,7 +5,7 @@ // WaterMark.c // SoftEther protocol digital watermark data -#include "CedarPch.h" +#include "WaterMark.h" // Digital watermark image data (JPEG) BYTE WaterMark[] = diff --git a/src/Cedar/WaterMark.h b/src/Cedar/WaterMark.h index 964d86d8..5fd4f2f4 100644 --- a/src/Cedar/WaterMark.h +++ b/src/Cedar/WaterMark.h @@ -5,18 +5,11 @@ // WaterMark.h // Header of WaterMark.c -#include -#include -#include -#include -#include -#include -#include -#include - #ifndef WATERMARK_H #define WATERMARK_H +#include "Mayaqua/MayaType.h" + // Digital watermark extern BYTE WaterMark[]; extern BYTE Saitama[]; diff --git a/src/Cedar/WebUI.c b/src/Cedar/WebUI.c index 3d94a7f1..3375030e 100644 --- a/src/Cedar/WebUI.c +++ b/src/Cedar/WebUI.c @@ -5,7 +5,24 @@ // WebUI.c // Web User Interface module -#include "CedarPch.h" +#include "WebUI.h" + +#include "Admin.h" +#include "Command.h" +#include "Database.h" +#include "Nat.h" +#include "Remote.h" +#include "Sam.h" +#include "Server.h" + +#include "Mayaqua/Encrypt.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" static WU_CONTEXT *WuNewContext(WEBUI *wu, char *hubname); static void WuFreeContext(WU_CONTEXT *context); @@ -617,7 +634,7 @@ static wchar_t *WpNewHub(WEBUI *wu, LIST *params) char *passwd = (char*)StrMapSearch(params, "PASSWD"); char *passwd2 = (char*)StrMapSearch(params, "PASSWD2"); - if(strcmp(passwd,passwd2) != 0) + if(StrCmp(passwd,passwd2) != 0) { return WuErrorPage(ERR_INVALID_PARAMETER); } diff --git a/src/Cedar/WebUI.h b/src/Cedar/WebUI.h index 78e3afd7..df7a5297 100644 --- a/src/Cedar/WebUI.h +++ b/src/Cedar/WebUI.h @@ -5,6 +5,13 @@ // WebUI.h // Header of WebUI.c +#ifndef WEBUI_H +#define WEBUI_H + +#include "CedarType.h" + +#include "Mayaqua/MayaType.h" + #define WU_PASSWORD_NOCHANGE "********" #define WU_CONTEXT_EXPIRE 600000 @@ -37,3 +44,4 @@ WEBUI *WuNewWebUI(CEDAR *cedar); WU_WEBPAGE *WuGetPage(char *target, WEBUI *wu); void WuFreeWebPage(WU_WEBPAGE *page); +#endif diff --git a/src/Cedar/Win32Com.cpp b/src/Cedar/Win32Com.cpp index ad44ae22..89dfa339 100644 --- a/src/Cedar/Win32Com.cpp +++ b/src/Cedar/Win32Com.cpp @@ -5,46 +5,25 @@ // Win32Com.c // Win32 COM module call -#include +#ifdef OS_WIN32 -#ifdef WIN32 +#include "Win32Com.h" -#define _WIN32_DCOM - -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "netcfgn.h" -#include -#include -#include -#include -#include -#include -#include extern "C" { -#include -#include +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Str.h" } -#include "../PenCore/resource.h" + +#include +#include +#include +#include +#include +#include // Add a UPnP port bool Win32UPnPAddPort(UINT outside_port, UINT inside_port, bool udp, char *local_ip, wchar_t *description, bool remove_before_add) @@ -744,7 +723,7 @@ HRESULT ShowHTMLDialogFromURL(HWND hwndParent,wchar_t *szURL,VARIANT* pvarArgIn, try { - IMonikerPtr spMoniker; + IMoniker *spMoniker; hr = ::CreateURLMoniker(NULL, szURL, &spMoniker); if (FAILED(hr)) { diff --git a/src/Cedar/Win32Com.h b/src/Cedar/Win32Com.h index 271d35e1..4a472f95 100644 --- a/src/Cedar/Win32Com.h +++ b/src/Cedar/Win32Com.h @@ -5,8 +5,12 @@ // Win32Com.h // Header of Win32Com.c -#ifndef WIN32COM_H -#define WIN32COM_H +#ifdef OS_WIN32 + +#ifndef WIN32COM_H +#define WIN32COM_H + +#include "Mayaqua/MayaType.h" #if defined(__cplusplus) extern "C" @@ -206,106 +210,10 @@ typedef struct CT_RectF_c void CT_DrawImage(UCHAR* dest, CT_RectF_c destRect, int destWidth, int destHeight, UCHAR* src, CT_RectF_c srcRect, int srcWidth, int srcHeight); - - #if defined(__cplusplus) } #endif +#endif // WIN32COM_H -//EXTERN_C const IID IID_IObjectCollection; -//EXTERN_C const IID IID_ICustomDestinationList; - -#if defined(__cplusplus) - - -#ifndef __IObjectArray_INTERFACE_DEFINED__ -#define __IObjectArray_INTERFACE_DEFINED__ - -MIDL_INTERFACE("92CA9DCD-5622-4bba-A805-5E9F541BD8C9") -IObjectArray : public IUnknown -{ -public: - virtual HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out UINT *pcObjects) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAt( - /* [in] */ UINT uiIndex, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; - -}; - -MIDL_INTERFACE("5632b1a4-e38a-400a-928a-d4cd63230295") -IObjectCollection : public IObjectArray -{ -public: - virtual HRESULT STDMETHODCALLTYPE AddObject( - /* [in] */ __RPC__in_opt IUnknown *punk) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddFromArray( - /* [in] */ __RPC__in_opt IObjectArray *poaSource) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveObjectAt( - /* [in] */ UINT uiIndex) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; - -}; - -#endif // __IObjectArray_INTERFACE_DEFINED__ - -#ifndef __ICustomDestinationList_INTERFACE_DEFINED__ -#define __ICustomDestinationList_INTERFACE_DEFINED__ - -typedef /* [v1_enum] */ -enum KNOWNDESTCATEGORY -{ - KDC_FREQUENT = 1, - KDC_RECENT = ( KDC_FREQUENT + 1 ) -} KNOWNDESTCATEGORY; - -MIDL_INTERFACE("6332debf-87b5-4670-90c0-5e57b408a49e") -ICustomDestinationList : public IUnknown -{ -public: - virtual HRESULT STDMETHODCALLTYPE SetAppID( - /* [string][in] */ __RPC__in_string LPCWSTR pszAppID) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginList( - /* [out] */ __RPC__out UINT *pcMinSlots, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; - - virtual HRESULT STDMETHODCALLTYPE AppendCategory( - /* [string][in] */ __RPC__in_string LPCWSTR pszCategory, - /* [in] */ __RPC__in_opt IObjectArray *poa) = 0; - - virtual HRESULT STDMETHODCALLTYPE AppendKnownCategory( - /* [in] */ KNOWNDESTCATEGORY category) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddUserTasks( - /* [in] */ __RPC__in_opt IObjectArray *poa) = 0; - - virtual HRESULT STDMETHODCALLTYPE CommitList( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRemovedDestinations( - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeleteList( - /* [string][unique][in] */ __RPC__in_opt_string LPCWSTR pszAppID) = 0; - - virtual HRESULT STDMETHODCALLTYPE AbortList( void) = 0; - -}; - - -#endif // __ICustomDestinationList_INTERFACE_DEFINED__ - - -#endif //defined(__cplusplus) - - - -#endif // WIN32COM_H +#endif // OS_WIN32 diff --git a/src/Cedar/WinJumpList.cpp b/src/Cedar/WinJumpList.cpp index 66b6d45e..d425996f 100644 --- a/src/Cedar/WinJumpList.cpp +++ b/src/Cedar/WinJumpList.cpp @@ -5,79 +5,25 @@ // WinJumpList.cpp // HTML display module source code for Win32 -#include +#ifdef OS_WIN32 -#ifdef WIN32 +#define NTDDI_VERSION NTDDI_WIN7 +#define _WIN32_WINNT _WIN32_WINNT_WIN7 -//#define NTDDI_WIN7 0x06010000 -//#define _WIN32_WINNT _WIN32_WINNT_VISTA -//#define NTDDI_VERSION NTDDI_VISTA // Specifies that the minimum required platform is Windows 7. -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define STRICT_TYPED_ITEMIDS // Utilize strictly typed IDLists - -//#include -#include -#include -#include -//#include -//#include - - -#ifdef StrCpy -#undef StrCpy -#endif - -#ifdef StrCat -#undef StrCat -#endif - -#ifdef StrCmp -#undef StrCmp -#endif - -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Win32Com.h" extern "C" { -#include -#include +#include "Mayaqua/Str.h" } -#include "../PenCore/resource.h" + +#define STRICT_TYPED_ITEMIDS // Utilize strictly typed IDLists + +#include +#include extern "C" { - - ////////////////////////////////////////////////////////////////////////// - //JumpList - //#define NTDDI_WIN7 0x06010000 - //#define NTDDI_VERSION NTDDI_WIN7 // Specifies that the minimum required platform is Windows 7. - //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - //#define STRICT_TYPED_ITEMIDS // Utilize strictly typed IDLists - // - // - //#include - //#include - //#include - //#include - //#include - #define CREATE_PROPERTYKEY(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid } @@ -106,29 +52,7 @@ extern "C" JL_HRESULT JL_CreateCustomDestinationList(JL_PCustomDestinationList* poc, wchar_t* appID) { ICustomDestinationList *pcdl; - - //CLSID_DestinationList = 6332DEBF-87B5-4670-90C0-5E57-B408-A49E - - GUID destList; - - destList.Data1 = 2012286192; - destList.Data2 = 15797; - destList.Data3 = 18790; - - destList.Data4[0] = 181; - destList.Data4[1] = 32; - destList.Data4[2] = 183; - destList.Data4[3] = 197; - destList.Data4[4] = 79; - destList.Data4[5] = 211; - destList.Data4[6] = 94; - destList.Data4[7] = 214; - - //destList = CLSID_DestinationList; - - //HRESULT hr = CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl)); - HRESULT hr = CoCreateInstance(destList, - NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl)); + HRESULT hr = CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl)); if (SUCCEEDED(hr)) { diff --git a/src/Cedar/WinUi.c b/src/Cedar/WinUi.c index 8b6acbd1..5c3802df 100644 --- a/src/Cedar/WinUi.c +++ b/src/Cedar/WinUi.c @@ -5,33 +5,45 @@ // WinUi.c // User interface code for Win32 -#include +#ifdef OS_WIN32 -#ifdef WIN32 +#define WINUI_C -#define WINUI_C +#include "WinUi.h" + +#include "Client.h" +#include "CM.h" +#include "Protocol.h" +#include "Session.h" +#include "Win32Com.h" + +#include "Mayaqua/FileIO.h" +#include "Mayaqua/Internat.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Object.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Secure.h" +#include "Mayaqua/Str.h" +#include "Mayaqua/Table.h" +#include "Mayaqua/Tick64.h" +#include "Mayaqua/Win32.h" -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "../PenCore/resource.h" +#include +#include +#include + +// Process name list of incompatible anti-virus software +static BAD_PROCESS bad_processes[] = +{ + {"nod32krn.exe", "NOD32 Antivirus"}, + {"avp.exe", "Kaspersky"} +}; + +static const UINT num_bad_processes = sizeof(bad_processes) / sizeof(bad_processes[0]); + char cached_pin_code[MAX_SIZE] = {0}; UINT64 cached_pin_code_expires = 0; diff --git a/src/Cedar/WinUi.h b/src/Cedar/WinUi.h index d3db3c14..74cdd361 100644 --- a/src/Cedar/WinUi.h +++ b/src/Cedar/WinUi.h @@ -6,7 +6,12 @@ // WinUi.h // User interface code for Win32 -#ifdef OS_WIN32 +#ifdef OS_WIN32 + +#ifndef WINUI_H +#define WINUI_H + +#include "Cedar.h" #define WINUI_DEBUG_TEXT "@winui_debug.txt" @@ -17,24 +22,6 @@ #define WINUI_DEFAULT_DIALOG_UNIT_X 7 #define WINUI_DEFAULT_DIALOG_UNIT_Y 14 -// Make available the types for Windows even if windows.h is not included -#ifndef _WINDEF_ -typedef void *HWND; -typedef void *HFONT; -typedef void *HICON; -typedef void *HMENU; -typedef void *HINSTANCE; - -#ifdef CPU_64 -typedef unsigned __int64 *WPARAM; -typedef __int64 *LPARAM; -#else -typedef unsigned int *WPARAM; -typedef long *LPARAM; -#endif // CPU_64 -#endif // _WINDEF_ - - // Constants #define FREE_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN Client\\Free Edition Info" #define ONCE_MSG_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Common" @@ -130,7 +117,7 @@ typedef struct LVB } LVB; -#ifdef CreateWindow +#ifdef WINUI_C // Internal code @@ -241,6 +228,8 @@ typedef struct WINUI_REMOTE LIST *CandidateList; // Candidate list } WINUI_REMOTE; +#define CALLBACK __stdcall + void InitImageList(); void FreeImageList(); IMAGELIST_ICON *LoadIconForImageList(UINT id); @@ -345,7 +334,8 @@ typedef struct WINCONNECT_DLG_DATA } WINCONNECT_DLG_DATA; HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_y); - +#else +typedef struct FONT FONT; #endif // WINUI_C // The information screen about the free version @@ -376,19 +366,6 @@ typedef struct BAD_PROCESS char *Title; } BAD_PROCESS; -#ifdef WINUI_C - -// Process name list of incompatible anti-virus software -static BAD_PROCESS bad_processes[] = -{ - {"nod32krn.exe", "NOD32 Antivirus",}, - {"avp.exe", "Kaspersky",}, -}; - -static UINT num_bad_processes = sizeof(bad_processes) / sizeof(bad_processes[0]); - -#endif // WINUI_C - // Page in the wizard struct WIZARD_PAGE { @@ -746,12 +723,12 @@ void FreeBitmapList(LIST *o); bool GetBitmapSize(void *bmp, UINT *x, UINT *y); -bool GetFontParam(HFONT hFont, struct FONT *f); +bool GetFontParam(HFONT hFont, FONT *f); void AdjustFontSize(HWND hWnd, UINT id); bool IsFontFitInRect(struct FONT *f, UINT width, UINT height, wchar_t *text, UINT format, bool *aborted); void ShowTextFile(HWND hWnd, char *filename, wchar_t *caption, UINT icon); -#endif // OS_WIN32 - +#endif // WINUI_H +#endif // OS_WIN32 diff --git a/src/Cedar/Wpc.c b/src/Cedar/Wpc.c index 7b608562..06271093 100644 --- a/src/Cedar/Wpc.c +++ b/src/Cedar/Wpc.c @@ -5,9 +5,16 @@ // Wpc.c // RPC over HTTP -#include +#include "Wpc.h" -#include "CedarPch.h" +#include "Command.h" +#include "Protocol.h" + +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Pack.h" +#include "Mayaqua/Proxy.h" +#include "Mayaqua/Str.h" // Get whether the proxy server is specified by a private IP bool IsProxyPrivateIp(INTERNET_SETTING *s) diff --git a/src/Cedar/Wpc.h b/src/Cedar/Wpc.h index 016cd72c..d4a7b0de 100644 --- a/src/Cedar/Wpc.h +++ b/src/Cedar/Wpc.h @@ -8,6 +8,11 @@ #ifndef WPC_H #define WPC_H +#include "Cedar.h" + +#include "Mayaqua/Encrypt.h" +#include "Mayaqua/HTTP.h" + // Constant #define WPC_HTTP_POST_NAME "POST" // POST #define WPC_HTTP_GET_NAME "GET" // GET diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index 17305322..dfda7834 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -19,6 +19,9 @@ set_target_properties(mayaqua find_package(OpenSSL REQUIRED) find_package(ZLIB REQUIRED) +# Required because we include in Encrypt.h. +target_include_directories(mayaqua PUBLIC ${OPENSSL_INCLUDE_DIR}) + target_link_libraries(mayaqua PRIVATE OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB) if(WIN32) diff --git a/src/Mayaqua/Cfg.c b/src/Mayaqua/Cfg.c index daa9ba66..07d73f9e 100644 --- a/src/Mayaqua/Cfg.c +++ b/src/Mayaqua/Cfg.c @@ -5,18 +5,14 @@ // Cfg.c // Configuration information manipulation module -#include +#include "Cfg.h" -#define CFG_C - -#include -#include -#include -#include -#include -#include -#include -#include +#include "FileIO.h" +#include "Internat.h" +#include "Memory.h" +#include "Network.h" +#include "Object.h" +#include "Str.h" // Create a backup of the configuration file void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *original, UINT revision_number) diff --git a/src/Mayaqua/Cfg.h b/src/Mayaqua/Cfg.h index 580cadbd..855e5e12 100644 --- a/src/Mayaqua/Cfg.h +++ b/src/Mayaqua/Cfg.h @@ -8,6 +8,8 @@ #ifndef CFG_H #define CFG_H +#include "Encrypt.h" + // Macro //#define CHECK_CFG_NAME_EXISTS // Check duplication of the existing name diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index db070a55..50217ce9 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -5,19 +5,17 @@ // Encrypt.c // Encryption and digital certification routine -#include +#include "Encrypt.h" -#define ENCRYPT_C +#include "FileIO.h" +#include "Internat.h" +#include "Kernel.h" +#include "Memory.h" +#include "Object.h" +#include "Str.h" -#define __WINCRYPT_H__ - -#include -#include #include -#include -#include -#include -#include + #include #include #include @@ -40,7 +38,6 @@ #include #include #include -#include #ifdef _MSC_VER #include // For __cpuid() @@ -64,6 +61,23 @@ #endif #endif // _MSC_VER +// OpenSSL <1.1 Shims +#if OPENSSL_VERSION_NUMBER < 0x10100000L +# define EVP_PKEY_get0_RSA(obj) ((obj)->pkey.rsa) +# define EVP_PKEY_base_id(pkey) ((pkey)->type) +# define X509_get0_notBefore(x509) ((x509)->cert_info->validity->notBefore) +# define X509_get0_notAfter(x509) ((x509)->cert_info->validity->notAfter) +# define X509_get_serialNumber(x509) ((x509)->cert_info->serialNumber) +#endif + +#ifndef EVP_CTRL_AEAD_GET_TAG +# define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG +#endif + +#ifndef EVP_CTRL_AEAD_SET_TAG +# define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG +#endif + LOCK *openssl_lock = NULL; int ssl_clientcert_index = 0; @@ -295,7 +309,7 @@ MD *NewMdEx(char *name, bool hmac) return m; } - m->Md = (const struct evp_md_st *)EVP_get_digestbyname(name); + m->Md = EVP_get_digestbyname(name); if (m->Md == NULL) { Debug("NewMdEx(): Algorithm %s not found by EVP_get_digestbyname().\n", m->Name); @@ -303,7 +317,7 @@ MD *NewMdEx(char *name, bool hmac) return NULL; } - m->Size = EVP_MD_size((const EVP_MD *)m->Md); + m->Size = EVP_MD_size(m->Md); m->IsHMac = hmac; if (hmac) @@ -341,7 +355,7 @@ bool SetMdKey(MD *md, void *key, UINT key_size) return false; } - if (HMAC_Init_ex(md->Ctx, key, key_size, (const EVP_MD *)md->Md, NULL) == false) + if (HMAC_Init_ex(md->Ctx, key, key_size, md->Md, NULL) == false) { Debug("SetMdKey(): HMAC_Init_ex() failed with error: %s\n", OpenSSL_Error()); return false; @@ -3858,7 +3872,7 @@ CRYPT *NewCrypt(void *key, UINT size) { CRYPT *c = ZeroMalloc(sizeof(CRYPT)); - c->Rc4Key = Malloc(sizeof(struct rc4_key_st)); + c->Rc4Key = Malloc(sizeof(RC4_KEY)); RC4_set_key(c->Rc4Key, size, (UCHAR *)key); @@ -4039,8 +4053,8 @@ AES_KEY_VALUE *AesNewKey(void *data, UINT size) k = ZeroMalloc(sizeof(AES_KEY_VALUE)); - k->EncryptKey = ZeroMalloc(sizeof(struct aes_key_st)); - k->DecryptKey = ZeroMalloc(sizeof(struct aes_key_st)); + k->EncryptKey = ZeroMalloc(sizeof(AES_KEY)); + k->DecryptKey = ZeroMalloc(sizeof(AES_KEY)); k->KeySize = size; Copy(k->KeyValue, data, size); diff --git a/src/Mayaqua/Encrypt.h b/src/Mayaqua/Encrypt.h index 27876e92..ab92fc75 100644 --- a/src/Mayaqua/Encrypt.h +++ b/src/Mayaqua/Encrypt.h @@ -8,11 +8,9 @@ #ifndef ENCRYPT_H #define ENCRYPT_H -// Function of OpenSSL -void RAND_Init_For_SoftEther(); -void RAND_Free_For_SoftEther(); - +#include "MayaType.h" +#include // Constant #define MIN_SIGN_HASH_SIZE (15 + SHA1_SIZE) @@ -131,27 +129,31 @@ void RAND_Free_For_SoftEther(); // Macro #define HASHED_DATA(p) (((UCHAR *)p) + 15) -// OpenSSL <1.1 Shims -#if OPENSSL_VERSION_NUMBER < 0x10100000L -# define EVP_PKEY_get0_RSA(obj) ((obj)->pkey.rsa) -# define EVP_PKEY_base_id(pkey) ((pkey)->type) -# define X509_get0_notBefore(x509) ((x509)->cert_info->validity->notBefore) -# define X509_get0_notAfter(x509) ((x509)->cert_info->validity->notAfter) -# define X509_get_serialNumber(x509) ((x509)->cert_info->serialNumber) +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) +typedef struct PKCS12_st PKCS12; +typedef struct evp_md_st EVP_MD; +#else +#include +typedef struct env_md_st EVP_MD; #endif -#ifndef EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG -#endif - -#ifndef EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG -#endif +typedef struct aes_key_st AES_KEY; +typedef struct bignum_st BIGNUM; +typedef struct bio_st BIO; +typedef struct DES_ks DES_key_schedule; +typedef struct dh_st DH; +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; +typedef struct evp_pkey_st EVP_PKEY; +typedef struct rc4_key_st RC4_KEY; +typedef struct ssl_st SSL; +typedef struct x509_st X509; +typedef struct X509_crl_st X509_CRL; // Crypt context struct CRYPT { - struct rc4_key_st *Rc4Key; + RC4_KEY *Rc4Key; }; // Name in the certificate @@ -218,7 +220,7 @@ struct X_CRL // Key element of DES struct DES_KEY_VALUE { - struct DES_ks *KeySchedule; + DES_key_schedule *KeySchedule; UCHAR KeyValue[DES_KEY_SIZE]; }; @@ -231,8 +233,8 @@ struct DES_KEY // AES key struct AES_KEY_VALUE { - struct aes_key_st *EncryptKey; - struct aes_key_st *DecryptKey; + AES_KEY *EncryptKey; + AES_KEY *DecryptKey; UCHAR KeyValue[AES_MAX_KEY_SIZE]; UINT KeySize; }; @@ -240,7 +242,7 @@ struct AES_KEY_VALUE // DH struct DH_CTX { - struct dh_st *dh; + DH *dh; BUF *MyPublicKey; BUF *MyPrivateKey; UINT Size; @@ -251,8 +253,8 @@ struct CIPHER { char Name[MAX_PATH]; bool IsNullCipher, IsAeadCipher; - const struct evp_cipher_st *Cipher; - struct evp_cipher_ctx_st *Ctx; + const EVP_CIPHER *Cipher; + EVP_CIPHER_CTX *Ctx; bool Encrypt; UINT BlockSize, IvSize, KeySize; }; @@ -263,7 +265,7 @@ struct MD char Name[MAX_PATH]; bool IsNullMd; bool IsHMac; - const struct evp_md_st *Md; + const EVP_MD *Md; void *Ctx; UINT Size; }; @@ -448,11 +450,4 @@ void Enc_tls1_PRF(unsigned char *label, int label_len, const unsigned char *sec, int GetSslClientCertIndex(); -#ifdef ENCRYPT_C -// Inner function - - -#endif // ENCRYPT_C - #endif // ENCRYPT_H - diff --git a/src/Mayaqua/FileIO.c b/src/Mayaqua/FileIO.c index 4756d240..7b2fc6bc 100644 --- a/src/Mayaqua/FileIO.c +++ b/src/Mayaqua/FileIO.c @@ -5,16 +5,18 @@ // FileIO.c // File Input / Output code -#include +#include "FileIO.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include "Cfg.h" +#include "GlobalConst.h" +#include "Internat.h" +#include "Memory.h" +#include "Microsoft.h" +#include "Str.h" +#include "Tick64.h" +#include "Tracking.h" +#include "Unix.h" +#include "Win32.h" static char exe_file_name[MAX_SIZE] = "/tmp/a.out"; static wchar_t exe_file_name_w[MAX_SIZE] = L"/tmp/a.out"; diff --git a/src/Mayaqua/FileIO.h b/src/Mayaqua/FileIO.h index 54f47792..62643d80 100644 --- a/src/Mayaqua/FileIO.h +++ b/src/Mayaqua/FileIO.h @@ -8,6 +8,8 @@ #ifndef FILEIO_H #define FILEIO_H +#include "Mayaqua.h" + // Constant #define HAMCORE_DIR_NAME "hamcore" #define HAMCORE_FILE_NAME "hamcore.se2" diff --git a/src/Mayaqua/HTTP.c b/src/Mayaqua/HTTP.c index 7869a55c..22ace11b 100644 --- a/src/Mayaqua/HTTP.c +++ b/src/Mayaqua/HTTP.c @@ -1,6 +1,10 @@ -#include +#include "HTTP.h" -#include +#include "Kernel.h" +#include "Memory.h" +#include "Network.h" +#include "Pack.h" +#include "Str.h" static char http_404_str[] = "\r\n\r\n404 Not Found\r\n\r\n

Not Found

\r\nThe requested URL $TARGET$ was not found on this server.

\r\n


\r\n
HTTP Server at $HOST$ Port $PORT$
\r\n\r\n"; static char http_403_str[] = "\r\n\r\n403 Forbidden\r\n\r\n

Forbidden

\r\nYou don't have permission to access $TARGET$\r\non this server.

\r\n


\r\n
HTTP Server at $HOST$ Port $PORT$
\r\n\r\n"; diff --git a/src/Mayaqua/HTTP.h b/src/Mayaqua/HTTP.h index 8d45cf22..cbf8a9c7 100644 --- a/src/Mayaqua/HTTP.h +++ b/src/Mayaqua/HTTP.h @@ -1,6 +1,8 @@ #ifndef HTTP_H #define HTTP_H +#include "MayaType.h" + #define DEFAULT_USER_AGENT "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0" #define DEFAULT_ACCEPT "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */*" #define DEFAULT_ENCODING "gzip, deflate" diff --git a/src/Mayaqua/Internat.c b/src/Mayaqua/Internat.c index 4ae5d88f..097b2a2f 100644 --- a/src/Mayaqua/Internat.c +++ b/src/Mayaqua/Internat.c @@ -5,16 +5,22 @@ // Internat.c // String conversion library for internationalization -#include +#include "Internat.h" + +#include "Mayaqua.h" +#include "Memory.h" +#include "Network.h" +#include "Object.h" +#include "Str.h" +#include "Tracking.h" +#include "Win32.h" -#include #include -#include #include -#include -#include -#include -#include + +#ifdef OS_UNIX +#include +#endif extern LOCK *token_lock; static char charset[MAX_SIZE] = "EUCJP"; diff --git a/src/Mayaqua/Internat.h b/src/Mayaqua/Internat.h index 8537d47a..cebd1afa 100644 --- a/src/Mayaqua/Internat.h +++ b/src/Mayaqua/Internat.h @@ -8,6 +8,10 @@ #ifndef INTERNAT_H #define INTERNAT_H +#include "MayaType.h" + +#include + // String token struct UNI_TOKEN_LIST { diff --git a/src/Mayaqua/Kernel.c b/src/Mayaqua/Kernel.c index b641072d..99890a08 100644 --- a/src/Mayaqua/Kernel.c +++ b/src/Mayaqua/Kernel.c @@ -5,16 +5,27 @@ // Kernel.c // System service processing routine -#include +#include "Kernel.h" + +#include "Encrypt.h" +#include "Internat.h" +#include "Mayaqua.h" +#include "Memory.h" +#include "Microsoft.h" +#include "Object.h" +#include "Str.h" +#include "Table.h" +#include "Tracking.h" +#include "Unix.h" +#include "Win32.h" -#include #include #include -#include -#include #include -#include -#include + +#ifdef OS_UNIX +#include +#endif #ifndef TM_YEAR_MAX #define TM_YEAR_MAX 2106 diff --git a/src/Mayaqua/Kernel.h b/src/Mayaqua/Kernel.h index f2db8e22..b2aaa4d5 100644 --- a/src/Mayaqua/Kernel.h +++ b/src/Mayaqua/Kernel.h @@ -5,6 +5,8 @@ #ifndef KERNEL_H #define KERNEL_H +#include "MayaType.h" + // Memory usage information struct MEMINFO { diff --git a/src/Mayaqua/MayaType.h b/src/Mayaqua/MayaType.h index 37b76574..1efcb346 100644 --- a/src/Mayaqua/MayaType.h +++ b/src/Mayaqua/MayaType.h @@ -9,27 +9,27 @@ #define MAYATYPE_H #include +#include #include -// Check whether the windows.h header is included -#ifndef WINDOWS_H -#ifdef _WINDOWS_ -#define WINDOWS_H -#endif // _WINDOWS_ -#endif // WINDOWS_H +#ifdef OS_WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif -#if !defined(ENCRYPT_C) -// Structure which is used by OpenSSL -typedef struct x509_st X509; -typedef struct evp_pkey_st EVP_PKEY; -typedef struct bio_st BIO; -typedef struct ssl_st SSL; -typedef struct ssl_ctx_st SSL_CTX; -typedef struct X509_req_st X509_REQ; -typedef struct PKCS12 PKCS12; -typedef struct bignum_st BIGNUM; -typedef struct x509_crl_st X509_CRL; -#endif // ENCRYPT_C +#ifndef NTDDI_VERSION +#define NTDDI_VERSION NTDDI_VISTA +#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT _WIN32_WINNT_VISTA +#endif + +#include +#include +#else +#include +#endif // // Constant @@ -44,7 +44,7 @@ typedef struct x509_crl_st X509_CRL; #define SUPPORTED_WINDOWS_LIST "Windows 98 / 98 SE / ME / NT 4.0 SP6a / 2000 SP4 / XP SP2, SP3 / Vista SP1, SP2 / 7 SP1 / 8 / 8.1 / 10 / Server 2003 SP2 / Server 2008 SP1, SP2 / Hyper-V Server 2008 / Server 2008 R2 SP1 / Hyper-V Server 2008 R2 / Server 2012 / Hyper-V Server 2012 / Server 2012 R2 / Hyper-V Server 2012 R2 / Server 2016 / Server 2019" // Infinite -#ifndef WINDOWS_H +#ifndef INFINITE #define INFINITE (0xFFFFFFFF) #endif @@ -53,7 +53,7 @@ typedef struct x509_crl_st X509_CRL; #define SRC_LINE __LINE__ // Line number in the source code // Maximum path size -#ifndef WINDOWS_H +#ifndef MAX_PATH #define MAX_PATH 260 #endif // WINDOWS_H @@ -159,51 +159,30 @@ typedef int (COMPARE)(void *p1, void *p2); #define WRITE_UINT(buf, i) (((UCHAR *)(buf))[0]) = ((((UINT)(i)) >> 24) & 0xFF); (((UCHAR *)(buf))[1]) = ((((UINT)(i)) >> 16) & 0xFF); (((UCHAR *)(buf))[2]) = ((((UINT)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[3]) = ((((UINT)(i))) & 0xFF) #define WRITE_UINT64(buf, i) (((UCHAR *)(buf))[0]) = ((((UINT64)(i)) >> 56) & 0xFF); (((UCHAR *)(buf))[1]) = ((((UINT64)(i)) >> 48) & 0xFF); (((UCHAR *)(buf))[2]) = ((((UINT64)(i)) >> 40) & 0xFF); (((UCHAR *)(buf))[3]) = ((((UINT64)(i)) >> 32) & 0xFF); (((UCHAR *)(buf))[4]) = ((((UINT64)(i)) >> 24) & 0xFF); (((UCHAR *)(buf))[5]) = ((((UINT64)(i)) >> 16) & 0xFF); (((UCHAR *)(buf))[6]) = ((((UINT64)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[7]) = ((((UINT64)(i))) & 0xFF) - - // // Type declaration // +typedef int64_t time_64t; -// PID type -#ifdef OS_UNIX -typedef int PID; -#endif // OS_UNIX #ifdef OS_WIN32 -typedef unsigned long PID; -#endif // WINDOWS_H - -typedef int64_t time_64t; - -#ifndef _BASETSD_H_ +typedef uint32_t PID; +#else typedef int32_t INT; typedef int64_t INT64; typedef uint32_t UINT; typedef uint64_t UINT64; -#endif -#ifndef BASETYPES typedef uint8_t BYTE; typedef uint8_t UCHAR; typedef uint16_t USHORT; -#endif -#ifdef OS_UNIX -// Avoiding compile error +typedef int SOCKET; +typedef pid_t PID; + #define __cdecl #define __declspec(x) -// socket type -typedef int SOCKET; -#else // OS_UNIX -#ifndef _WINSOCK2API_ -#ifdef CPU_64 -typedef unsigned __int64 SOCKET; -#else -typedef unsigned int SOCKET; -#endif // CPU_64 -#endif // _WINSOCK2API_ -#endif // OS_UNIX +#endif // OS type #define OSTYPE_WINDOWS_95 1100 // Windows 95 @@ -272,7 +251,7 @@ typedef struct OS_INFO } OS_INFO; // Time type -#ifndef WINDOWS_H +#ifndef OS_WIN32 typedef struct SYSTEMTIME { USHORT wYear; @@ -286,7 +265,6 @@ typedef struct SYSTEMTIME } SYSTEMTIME; #endif // WINDOWS_H - // Object.h typedef struct LOCK LOCK; typedef struct COUNTER COUNTER; diff --git a/src/Mayaqua/Mayaqua.c b/src/Mayaqua/Mayaqua.c index 9814f40d..88f03684 100644 --- a/src/Mayaqua/Mayaqua.c +++ b/src/Mayaqua/Mayaqua.c @@ -5,17 +5,25 @@ // Mayaqua.c // Mayaqua Kernel program -#include +#include "Mayaqua.h" + +#include "Encrypt.h" +#include "FileIO.h" +#include "GlobalConst.h" +#include "Internat.h" +#include "Memory.h" +#include "Microsoft.h" +#include "Network.h" +#include "Object.h" +#include "OS.h" +#include "Secure.h" +#include "Str.h" +#include "Table.h" +#include "Tick64.h" +#include "Tracking.h" -#include -#include -#include -#include -#include #include -#include -#include -#include +#include // Global variable bool g_memcheck; // Enable memory check diff --git a/src/Mayaqua/Mayaqua.h b/src/Mayaqua/Mayaqua.h index 8db3ccf6..15a38af4 100644 --- a/src/Mayaqua/Mayaqua.h +++ b/src/Mayaqua/Mayaqua.h @@ -8,8 +8,8 @@ #ifndef MAYAQUA_H #define MAYAQUA_H -#include -#include +#include "Kernel.h" + #include #define PENCORE_DLL_NAME "|PenCore.dll" @@ -27,10 +27,9 @@ void InitProcessCallOnce(); -#ifdef VPN_EXE +#ifdef VPN_EXE // To build the executable file -#ifdef WIN32 -#include +#ifdef OS_WIN32 #include "../PenCore/resource.h" int main(int argc, char *argv[]); int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) @@ -48,13 +47,6 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) #define STRTABLE_ID "SE_VPN_20121007" // String table identifier -// Determining the OS -#ifdef WIN32 -#define OS_WIN32 // Microsoft Windows -#else -#define OS_UNIX // UNIX -#endif // WIN32 - // Directory separator #ifdef OS_WIN32 #define PATH_BACKSLASH // Backslash (\) @@ -121,172 +113,9 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) #define WHEN #endif // WIN32 -#ifdef OS_UNIX -#ifndef UNIX_SOLARIS -#ifndef CPU_SH4 -#if !defined(__UCLIBC__) || defined(__UCLIBC_SUPPORT_AI_ADDRCONFIG__) -// Getifaddrs system call is supported on UNIX other than Solaris. -// However, it is not supported also by the Linux on SH4 CPU -#define MAYAQUA_SUPPORTS_GETIFADDRS -#endif // !UCLIBC || UCLIBC_SUPPORT_AI_ADDRCONFIG -#endif // CPU_SH4 -#endif // UNIX_SOLARIS -#endif // OS_UNIX - -#ifdef OS_UNIX -// Header only needed in UNIX OS -#include -#include -#include -#include -#ifdef UNIX_LINUX -#include -#elif UNIX_BSD -#include -#include +#ifdef OS_UNIX +#define closesocket(s) close(s) #endif -#ifdef UNIX_SOLARIS -#include -#define USE_STATVFS -#endif // UNIX_SOLARIS -#include -#include -#include -#include -#include -#include -#include -#ifdef UNIX_SOLARIS -#include -#endif // UNIX_SOLARIS -#include -#include -#include -#ifdef UNIX_LINUX -#include -#endif // UNIX_LINUX -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -//#include -#ifdef MAYAQUA_SUPPORTS_GETIFADDRS -#include -#endif // MAYAQUA_SUPPORTS_GETIFADDRS - -#ifdef UNIX_LINUX -typedef void *iconv_t; -iconv_t iconv_open (__const char *__tocode, __const char *__fromcode); -size_t iconv (iconv_t __cd, char **__restrict __inbuf, - size_t *__restrict __inbytesleft, - char **__restrict __outbuf, - size_t *__restrict __outbytesleft); -int iconv_close (iconv_t __cd); -#else // UNIX_LINUX -#include -#endif // UNIX_LINUX - - - -#ifdef UNIX_LINUX -#include -#include -#include -#endif // UNIX_LINUX - -#ifdef UNIX_SOLARIS -#include -#include -#include -#endif // UNIX_SOLARIS - -#ifndef NO_VLAN - -#include - -#endif // NO_VLAN - -#define closesocket(s) close(s) - -#else // Win32 only - -#include - -#endif // OS_UNIX - -// IPv6 support flag -#ifndef WIN32 -#ifndef AF_INET6 -#define NO_IPV6 -#endif // AF_INET6 -#endif // WIN32 - -// Basic type declaration -#include - -// Object management -#include - -// Object tracking -#include - -// File I/O -#include - -// Memory management -#include - -// String processing -#include - -// Internationalized string processing -#include - -// Encryption processing -#include - -// Secure token -#include - -// Kernel -#include - -// Package -#include - -// Configuration file -#include - -// String table -#include - -// Network communication -#include - -// TCP/IP -#include - -// HTTP -#include - -// Proxy -#include - -// 64 bit real-time clock -#include - -// OS-dependent code -#include - -// Code for Microsoft Windows -#include - // Global variables extern bool g_memcheck; diff --git a/src/Mayaqua/Memory.c b/src/Mayaqua/Memory.c index b19e3722..b6d2dd03 100644 --- a/src/Mayaqua/Memory.c +++ b/src/Mayaqua/Memory.c @@ -5,17 +5,22 @@ // Memory.c // Memory management program -#include +#include "Memory.h" + +#include "Encrypt.h" +#include "FileIO.h" +#include "Internat.h" +#include "Kernel.h" +#include "Mayaqua.h" +#include "Object.h" +#include "OS.h" +#include "Str.h" +#include "Tracking.h" -#include #include #include -#include -#include -#include -#include + #include -#include #define MEMORY_SLEEP_TIME 150 #define MEMORY_MAX_RETRY 30 diff --git a/src/Mayaqua/Memory.h b/src/Mayaqua/Memory.h index acf32089..fb712649 100644 --- a/src/Mayaqua/Memory.h +++ b/src/Mayaqua/Memory.h @@ -8,6 +8,8 @@ #ifndef MEMORY_H #define MEMORY_H +#include "MayaType.h" + // MallocFast (not implemented) #define MallocFast Malloc #define ZeroMallocFast ZeroMalloc diff --git a/src/Mayaqua/Microsoft.c b/src/Mayaqua/Microsoft.c index af313043..5f9e015e 100644 --- a/src/Mayaqua/Microsoft.c +++ b/src/Mayaqua/Microsoft.c @@ -6,80 +6,68 @@ // For Microsoft Windows code // (not compiled on non-Windows environments) -#include - -#ifdef WIN32 +#ifdef OS_WIN32 #define MICROSOFT_C -typedef enum _PNP_VETO_TYPE { - PNP_VetoTypeUnknown, // Name is unspecified - PNP_VetoLegacyDevice, // Name is an Instance Path - PNP_VetoPendingClose, // Name is an Instance Path - PNP_VetoWindowsApp, // Name is a Module - PNP_VetoWindowsService, // Name is a Service - PNP_VetoOutstandingOpen, // Name is an Instance Path - PNP_VetoDevice, // Name is an Instance Path - PNP_VetoDriver, // Name is a Driver Service Name - PNP_VetoIllegalDeviceRequest, // Name is an Instance Path - PNP_VetoInsufficientPower, // Name is unspecified - PNP_VetoNonDisableable, // Name is an Instance Path - PNP_VetoLegacyDriver, // Name is a Service - PNP_VetoInsufficientRights // Name is unspecified -} PNP_VETO_TYPE, *PPNP_VETO_TYPE; +#include "Microsoft.h" -#define _WIN32_IE 0x0600 -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#define SECURITY_WIN32 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "FileIO.h" +#include "GlobalConst.h" +#include "Internat.h" +#include "Memory.h" +#include "Object.h" +#include "Str.h" +#include "Table.h" +#include "Tick64.h" +#include "Win32.h" + +// TODO: Mayaqua should not depend on Cedar. +#include +#include +#include +#include + +#define SECURITY_WIN32 + +// The struct is defined in Microsoft's , but Mayaqua's one gets included instead. +typedef enum _PNP_VETO_TYPE { + PNP_VetoTypeUnknown, // Name is unspecified + PNP_VetoLegacyDevice, // Name is an Instance Path + PNP_VetoPendingClose, // Name is an Instance Path + PNP_VetoWindowsApp, // Name is a Module + PNP_VetoWindowsService, // Name is a Service + PNP_VetoOutstandingOpen, // Name is an Instance Path + PNP_VetoDevice, // Name is an Instance Path + PNP_VetoDriver, // Name is a Driver Service Name + PNP_VetoIllegalDeviceRequest, // Name is an Instance Path + PNP_VetoInsufficientPower, // Name is unspecified + PNP_VetoNonDisableable, // Name is an Instance Path + PNP_VetoLegacyDriver, // Name is a Service + PNP_VetoInsufficientRights, // Name is unspecified + PNP_VetoAlreadyRemoved, // Name is unspecified +} PNP_VETO_TYPE, *PPNP_VETO_TYPE; + +#include #include -#include -#include +#include #include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include static MS *ms = NULL; -// Function prototype -UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg); -UINT MsgBoxEx(HWND hWnd, UINT flag, wchar_t *msg, ...); -void ShowTcpIpConfigUtil(HWND hWnd, bool util_mode); -void CmTraffic(HWND hWnd); -void CnStart(); -void InitCedar(); -void FreeCedar(); -void InitWinUi(wchar_t *software_name, char *font, UINT fontsize); -void FreeWinUi(); - // Global variable UINT64 ms_uint64_1 = 0; @@ -120,41 +108,6 @@ static UINT (WINAPI *_MsiConfigureProductW)(LPCWSTR, int, INSTALLSTATE) = NULL; static INSTALLUILEVEL (WINAPI *_MsiSetInternalUI)(INSTALLUILEVEL, HWND *) = NULL; static INSTALLSTATE (WINAPI *_MsiLocateComponentW)(LPCWSTR, LPWSTR, LPDWORD) = NULL; -#define SE_GROUP_INTEGRITY (0x00000020L) - -typedef enum _TOKEN_INFORMATION_CLASS_VISTA -{ - VistaTokenUser = 1, - VistaTokenGroups, - VistaTokenPrivileges, - VistaTokenOwner, - VistaTokenPrimaryGroup, - VistaTokenDefaultDacl, - VistaTokenSource, - VistaTokenType, - VistaTokenImpersonationLevel, - VistaTokenStatistics, - VistaTokenRestrictedSids, - VistaTokenSessionId, - VistaTokenGroupsAndPrivileges, - VistaTokenSessionReference, - VistaTokenSandBoxInert, - VistaTokenAuditPolicy, - VistaTokenOrigin, - VistaTokenElevationType, - VistaTokenLinkedToken, - VistaTokenElevation, - VistaTokenHasRestrictions, - VistaTokenAccessInformation, - VistaTokenVirtualizationAllowed, - VistaTokenVirtualizationEnabled, - VistaTokenIntegrityLevel, - VistaTokenUIAccess, - VistaTokenMandatoryPolicy, - VistaTokenLogonSid, - VistaMaxTokenInfoClass -} TOKEN_INFORMATION_CLASS_VISTA, *PTOKEN_INFORMATION_CLASS_VISTA; - typedef struct MS_MSCHAPV2_PARAMS { wchar_t Username[MAX_SIZE]; @@ -1585,7 +1538,7 @@ HANDLE MsCreateUserToken() return NULL; } - if (SetTokenInformation(hNewToken, VistaTokenIntegrityLevel, &til, + if (SetTokenInformation(hNewToken, TokenIntegrityLevel, &til, sizeof(TOKEN_MANDATORY_LABEL) + GetLengthSid(sid)) == false) { CloseHandle(hNewToken); diff --git a/src/Mayaqua/Microsoft.h b/src/Mayaqua/Microsoft.h index dbdf4067..c0d6a5ab 100644 --- a/src/Mayaqua/Microsoft.h +++ b/src/Mayaqua/Microsoft.h @@ -5,19 +5,13 @@ // Microsoft.h // Header of Microsoft.c -#ifdef OS_WIN32 - -// Make available the types for Windows even if windows.h is not included -#ifndef _WINDEF_ - -typedef void *HWND; -typedef unsigned long DWORD; - -#endif // _WINDEF_ +#ifdef OS_WIN32 #ifndef MICROSOFT_H #define MICROSOFT_H +#include "Network.h" + // Constant for Event log #define MS_EVENTLOG_TYPE_INFORMATION 0 #define MS_EVENTLOG_TYPE_WARNING 1 @@ -128,7 +122,7 @@ typedef unsigned long DWORD; #define DRIVER_DEVICE_ID_TAG "NeoAdapter_%s" -#ifdef MICROSOFT_C +#ifdef MICROSOFT_C // WCM related code on Windows 8 typedef enum _MS_WCM_PROPERTY { @@ -767,7 +761,8 @@ void MsProcLeaveSuspend(); UINT64 MsGetSuspendModeBeginTick(); // Inner functions -#ifdef MICROSOFT_C +#ifdef MICROSOFT_C +#include LONG CALLBACK MsExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo); HKEY MsGetRootKeyFromInt(UINT root); @@ -800,12 +795,8 @@ void MsFreeSid(SID *sid); BOOL CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam); LRESULT CALLBACK MsSuspendHandlerWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); void MsSuspendHandlerThreadProc(THREAD *thread, void *param); +#endif // MICROSOFT_C +#endif // MICROSOFT_H - -#endif // MICROSOFT_C - -#endif // MICROSOFT_H - -#endif // OS_WIN32 - +#endif // OS_WIN32 diff --git a/src/Mayaqua/Network.c b/src/Mayaqua/Network.c index 052c5c92..85ed4747 100644 --- a/src/Mayaqua/Network.c +++ b/src/Mayaqua/Network.c @@ -5,50 +5,57 @@ // Network.c // Network communication module -#include +#include "Network.h" -#define ENCRYPT_C -#define NETWORK_C +#include "Cfg.h" +#include "FileIO.h" +#include "HTTP.h" +#include "Internat.h" +#include "Memory.h" +#include "Microsoft.h" +#include "Object.h" +#include "Pack.h" +#include "Str.h" +#include "TcpIp.h" +#include "Tick64.h" +#include "Unix.h" -#define __WINCRYPT_H__ - -#ifdef WIN32 -// Include windows.h for Socket API -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include -#include -#include -#endif // WIN32 - -#include -#include #include -#include -#include -#include -#include + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef UNIX_MACOS +#include + +#ifdef OS_UNIX +#include +#include +#include +#include + +#include +#include +#include +#endif + +#ifdef UNIX_MACOS #include -#endif // UNIX_MACOS +#endif + +#ifdef UNIX +#ifdef UNIX_SOLARIS +#define USE_STATVFS +#include ' +#else +#define MAYAQUA_SUPPORTS_GETIFADDRS +#include +#endif +#endif #ifdef OS_WIN32 +#include +#include + +#include + struct ROUTE_CHANGE_DATA { OVERLAPPED Overlapped; diff --git a/src/Mayaqua/Network.h b/src/Mayaqua/Network.h index 9c01bb51..dcdc9211 100644 --- a/src/Mayaqua/Network.h +++ b/src/Mayaqua/Network.h @@ -8,6 +8,13 @@ #ifndef NETWORK_H #define NETWORK_H +#include "Encrypt.h" +#include "Mayaqua.h" + +#ifdef OS_UNIX +#include +#endif + // Dynamic Value struct DYN_VALUE { diff --git a/src/Mayaqua/OS.c b/src/Mayaqua/OS.c index 272a9eeb..99a819db 100644 --- a/src/Mayaqua/OS.c +++ b/src/Mayaqua/OS.c @@ -5,19 +5,9 @@ // OS.c // Operating system dependent code -#include +#include "OS.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#undef Lock -#undef Unlock +#undef Yield // Dispatch table static OS_DISPATCH_TABLE *os = NULL; diff --git a/src/Mayaqua/OS.h b/src/Mayaqua/OS.h index 247eed1e..4718730d 100644 --- a/src/Mayaqua/OS.h +++ b/src/Mayaqua/OS.h @@ -8,6 +8,8 @@ #ifndef OS_H #define OS_H +#include "MayaType.h" + // Function prototype char *OsTypeToStr(UINT type); diff --git a/src/Mayaqua/Object.c b/src/Mayaqua/Object.c index 904aa344..bec76aea 100644 --- a/src/Mayaqua/Object.c +++ b/src/Mayaqua/Object.c @@ -5,16 +5,15 @@ // Object.c // Object management code -#include +#include "Object.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include "Mayaqua.h" +#include "Memory.h" +#include "Kernel.h" +#include "OS.h" +#include "Str.h" +#include "Tick64.h" +#include "Tracking.h" // Thread to try to lock void CheckDeadLockThread(THREAD *t, void *param) diff --git a/src/Mayaqua/Object.h b/src/Mayaqua/Object.h index 4e63c3dd..abb573d2 100644 --- a/src/Mayaqua/Object.h +++ b/src/Mayaqua/Object.h @@ -8,6 +8,7 @@ #ifndef OBJECT_H #define OBJECT_H +#include "MayaType.h" // Constants #define OBJECT_ALLOC_FAIL_SLEEP_TIME 150 diff --git a/src/Mayaqua/Pack.c b/src/Mayaqua/Pack.c index f561b72c..f1ebbd9b 100644 --- a/src/Mayaqua/Pack.c +++ b/src/Mayaqua/Pack.c @@ -5,16 +5,14 @@ // Pack.c // Data package code -#include +#include "Pack.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include "Encrypt.h" +#include "Internat.h" +#include "Mayaqua.h" +#include "Memory.h" +#include "Network.h" +#include "Str.h" // Get a list of the element names in the PACK TOKEN_LIST *GetPackElementNames(PACK *p) diff --git a/src/Mayaqua/Pack.h b/src/Mayaqua/Pack.h index 319b9079..0113f670 100644 --- a/src/Mayaqua/Pack.h +++ b/src/Mayaqua/Pack.h @@ -8,6 +8,8 @@ #ifndef PACK_H #define PACK_H +#include "MayaType.h" + // Constant #ifdef CPU_64 diff --git a/src/Mayaqua/Proxy.c b/src/Mayaqua/Proxy.c index 9a5c4670..84ffd89d 100644 --- a/src/Mayaqua/Proxy.c +++ b/src/Mayaqua/Proxy.c @@ -1,6 +1,10 @@ -#include +#include "Proxy.h" -#include +// TODO: Mayaqua should not depend on Cedar. +#include "Cedar/WinUi.h" + +#include "Memory.h" +#include "Str.h" SOCK *Internal_ProxyTcpConnect(PROXY_PARAM_IN *param, volatile bool *cancel_flag, IP *resolved_ip) { diff --git a/src/Mayaqua/Proxy.h b/src/Mayaqua/Proxy.h index 27b67c36..a9d34ff2 100644 --- a/src/Mayaqua/Proxy.h +++ b/src/Mayaqua/Proxy.h @@ -1,6 +1,9 @@ #ifndef PROXY_H #define PROXY_H +#include "HTTP.h" +#include "Network.h" + #define PROXY_CONNECTION_TIMEOUT (4 * 1000) #define PROXY_MAX_USERNAME_LEN 255 diff --git a/src/Mayaqua/Secure.c b/src/Mayaqua/Secure.c index 69eef15b..18078cd5 100644 --- a/src/Mayaqua/Secure.c +++ b/src/Mayaqua/Secure.c @@ -5,45 +5,65 @@ // Secure.c // Security token management module -#include +#include "Secure.h" -#define SECURE_C -#define ENCRYPT_C +#include "Encrypt.h" +#include "GlobalConst.h" +#include "Internat.h" +#include "Kernel.h" +#include "Memory.h" +#include "Microsoft.h" +#include "Object.h" +#include "Str.h" -#ifdef WIN32 -#include -#endif // WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include -#include +#include #define MAX_OBJ 1024 // Maximum number of objects in the hardware (assumed) #define A_SIZE(a, i) (a[(i)].ulValueLen) #define A_SET(a, i, value, size) (a[i].pValue = value;a[i].ulValueLen = size;) +// Internal data structure +// The list of supported secure devices +static LIST *SecureDeviceList = NULL; + +// Supported hardware list +const SECURE_DEVICE SupportedList[] = +{ + {1, SECURE_IC_CARD, "Standard-9 IC Card", "Dai Nippon Printing", "DNPS9P11.DLL"}, + {2, SECURE_USB_TOKEN, "ePass 1000", "Feitian Technologies", "EP1PK111.DLL"}, + {3, SECURE_IC_CARD, "DNP Felica", "Dai Nippon Printing", "DNPFP11.DLL"}, + {4, SECURE_USB_TOKEN, "eToken", "Aladdin", "ETPKCS11.DLL"}, + {5, SECURE_IC_CARD, "Standard-9 IC Card", "Fujitsu", "F3EZSCL2.DLL"}, + {6, SECURE_IC_CARD, "ASECard", "Athena", "ASEPKCS.DLL"}, + {7, SECURE_IC_CARD, "Gemplus IC Card", "Gemplus", "PK2PRIV.DLL"}, + {8, SECURE_IC_CARD, "1-Wire & iButton", "DALLAS SEMICONDUCTOR", "DSPKCS.DLL"}, + {9, SECURE_IC_CARD, "JPKI IC Card", "Japanese Government", "JPKIPKCS11.DLL"}, + {10, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9.DLL"}, + {11, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9A.DLL"}, + {12, SECURE_USB_TOKEN, "iKey 1000", "Rainbow Technologies", "K1PK112.DLL"}, + {13, SECURE_IC_CARD, "JPKI IC Card #2", "Japanese Government", "libmusclepkcs11.dll"}, + {14, SECURE_USB_TOKEN, "SafeSign", "A.E.T.", "aetpkss1.dll"}, + {15, SECURE_USB_TOKEN, "LOCK STAR-PKI", "Logicaltech Co.,LTD", "LTPKCS11.dll"}, + {16, SECURE_USB_TOKEN, "ePass 2000", "Feitian Technologies", "ep2pk11.dll"}, + {17, SECURE_IC_CARD, "myuToken", "iCanal Inc.", "icardmodpk.dll"}, + {18, SECURE_IC_CARD, "Gemalto .NET", "Gemalto", "gtop11dotnet.dll"}, + {19, SECURE_IC_CARD, "Gemalto .NET 64bit", "Gemalto", "gtop11dotnet64.dll"}, + {20, SECURE_USB_TOKEN, "ePass 2003", "Feitian Technologies", "eps2003csp11.dll"}, + {21, SECURE_USB_TOKEN, "ePass 1000ND/2000/3000", "Feitian Technologies", "ngp11v211.dll"}, + {22, SECURE_USB_TOKEN, "CryptoID", "Longmai Technology", "cryptoide_pkcs11.dll"}, + {23, SECURE_USB_TOKEN, "RuToken", "Aktiv Co.", "rtPKCS11.dll"}, +}; + #ifdef OS_WIN32 -// Code for Win32 +// Win32 internal data +typedef struct SEC_DATA_WIN32 +{ + HINSTANCE hInst; +} SEC_DATA_WIN32; // DLL reading for Win32 HINSTANCE Win32SecureLoadLibraryEx(char *dllname, DWORD flags) diff --git a/src/Mayaqua/Secure.h b/src/Mayaqua/Secure.h index 53ccc599..70c071f9 100644 --- a/src/Mayaqua/Secure.h +++ b/src/Mayaqua/Secure.h @@ -8,17 +8,11 @@ #ifndef SECURE_H #define SECURE_H +#include "MayaType.h" + // Constant #define MAX_SEC_DATA_SIZE 4096 -// Type declaration related to PKCS#11 -#ifndef SECURE_C -typedef struct CK_FUNCTION_LIST *CK_FUNCTION_LIST_PTR; -typedef struct SEC_DATA_WIN32 SEC_DATA_WIN32; -typedef struct CK_TOKEN_INFO CK_TOKEN_INFO; -typedef struct CK_DATE CK_DATE; -#endif // SECURE_C - // Secure device struct SECURE_DEVICE { @@ -171,50 +165,4 @@ void Win32FreeSecModule(SECURE *sec); #endif // OS_WIN32 - -#ifdef SECURE_C -// Internal data structure -// The list of supported secure devices -static LIST *SecureDeviceList = NULL; - -// Supported hardware list -SECURE_DEVICE SupportedList[] = -{ - {1, SECURE_IC_CARD, "Standard-9 IC Card", "Dai Nippon Printing", "DNPS9P11.DLL"}, - {2, SECURE_USB_TOKEN, "ePass 1000", "Feitian Technologies", "EP1PK111.DLL"}, - {3, SECURE_IC_CARD, "DNP Felica", "Dai Nippon Printing", "DNPFP11.DLL"}, - {4, SECURE_USB_TOKEN, "eToken", "Aladdin", "ETPKCS11.DLL"}, - {5, SECURE_IC_CARD, "Standard-9 IC Card", "Fujitsu", "F3EZSCL2.DLL"}, - {6, SECURE_IC_CARD, "ASECard", "Athena", "ASEPKCS.DLL"}, - {7, SECURE_IC_CARD, "Gemplus IC Card", "Gemplus", "PK2PRIV.DLL"}, - {8, SECURE_IC_CARD, "1-Wire & iButton", "DALLAS SEMICONDUCTOR", "DSPKCS.DLL"}, - {9, SECURE_IC_CARD, "JPKI IC Card", "Japanese Government", "JPKIPKCS11.DLL"}, - {10, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9.DLL"}, - {11, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9A.DLL"}, - {12, SECURE_USB_TOKEN, "iKey 1000", "Rainbow Technologies", "K1PK112.DLL"}, - {13, SECURE_IC_CARD, "JPKI IC Card #2", "Japanese Government", "libmusclepkcs11.dll"}, - {14, SECURE_USB_TOKEN, "SafeSign", "A.E.T.", "aetpkss1.dll"}, - {15, SECURE_USB_TOKEN, "LOCK STAR-PKI", "Logicaltech Co.,LTD", "LTPKCS11.dll"}, - {16, SECURE_USB_TOKEN, "ePass 2000", "Feitian Technologies", "ep2pk11.dll"}, - {17, SECURE_IC_CARD, "myuToken", "iCanal Inc.", "icardmodpk.dll"}, - {18, SECURE_IC_CARD, "Gemalto .NET", "Gemalto", "gtop11dotnet.dll"}, - {19, SECURE_IC_CARD, "Gemalto .NET 64bit", "Gemalto", "gtop11dotnet64.dll"}, - {20, SECURE_USB_TOKEN, "ePass 2003", "Feitian Technologies", "eps2003csp11.dll"}, - {21, SECURE_USB_TOKEN, "ePass 1000ND/2000/3000", "Feitian Technologies", "ngp11v211.dll"}, - {22, SECURE_USB_TOKEN, "CryptoID", "Longmai Technology", "cryptoide_pkcs11.dll"}, - {23, SECURE_USB_TOKEN, "RuToken", "Aktiv Co.", "rtPKCS11.dll"}, -}; - -#ifdef OS_WIN32 - -// Win32 internal data -typedef struct SEC_DATA_WIN32 -{ - HINSTANCE hInst; -} SEC_DATA_WIN32; - -#endif // OS_WIN32 - -#endif // SECURE_C - #endif // SECURE_H diff --git a/src/Mayaqua/Str.c b/src/Mayaqua/Str.c index f44efa67..3a17c6dd 100644 --- a/src/Mayaqua/Str.c +++ b/src/Mayaqua/Str.c @@ -5,17 +5,19 @@ // Str.c // String processing routine -#include +#include "Str.h" +#include "Cfg.h" +#include "Internat.h" +#include "Mayaqua.h" +#include "Memory.h" +#include "Object.h" +#include "Tracking.h" + +#include #include #include #include -#include -#include -#include -#include -#include -#include // Locking for call the token handling function LOCK *token_lock = NULL; diff --git a/src/Mayaqua/Str.h b/src/Mayaqua/Str.h index 6ff9051c..6d76d333 100644 --- a/src/Mayaqua/Str.h +++ b/src/Mayaqua/Str.h @@ -8,6 +8,10 @@ #ifndef STR_H #define STR_H +#include "MayaType.h" + +#include + // String token struct TOKEN_LIST { @@ -201,7 +205,6 @@ enum JSON_TYPES { JSON_TYPE_ARRAY = 5, JSON_TYPE_BOOL = 6 }; -typedef unsigned int UINT; enum JSON_RETS { JSON_RET_OK = 0, diff --git a/src/Mayaqua/Table.c b/src/Mayaqua/Table.c index 294df20b..5d3bba84 100644 --- a/src/Mayaqua/Table.c +++ b/src/Mayaqua/Table.c @@ -5,16 +5,19 @@ // Table.c // Read and management routines for string table -#include +#include "Table.h" + +#include "Cfg.h" +#include "FileIO.h" +#include "Internat.h" +#include "Mayaqua.h" +#include "Memory.h" +#include "Microsoft.h" +#include "Network.h" +#include "Str.h" +#include "Tick64.h" -#include #include -#include -#include -#include -#include -#include -#include // List of TABLE static LIST *TableList = NULL; diff --git a/src/Mayaqua/Table.h b/src/Mayaqua/Table.h index 84cb8fe6..cd62cfbf 100644 --- a/src/Mayaqua/Table.h +++ b/src/Mayaqua/Table.h @@ -8,6 +8,8 @@ #ifndef TABLE_H #define TABLE_H +#include "Encrypt.h" + #define UNICODE_CACHE_FILE L".unicode_cache_%s.dat" #define LANGLIST_FILENAME "|languages.txt" diff --git a/src/Mayaqua/TcpIp.c b/src/Mayaqua/TcpIp.c index b16f508d..175f933e 100644 --- a/src/Mayaqua/TcpIp.c +++ b/src/Mayaqua/TcpIp.c @@ -5,16 +5,11 @@ // TcpIp.c // Utility module for TCP/IP packet processing -#include +#include "TcpIp.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include "Cfg.h" +#include "Memory.h" +#include "Str.h" // Release the memory for the ICMP response void IcmpFreeResult(ICMP_RESULT *r) @@ -2027,7 +2022,7 @@ bool ParsePacketL2Ex(PKT *p, UCHAR *buf, UINT size, bool no_l3, bool no_l3_l4_ex b2 = false; } } - if (b1 || b2 || (memcmp(p->MacHeader->SrcAddress, p->MacHeader->DestAddress, 6) == 0)) + if (b1 || b2 || (Cmp(p->MacHeader->SrcAddress, p->MacHeader->DestAddress, 6) == 0)) { p->InvalidSourcePacket = true; } diff --git a/src/Mayaqua/TcpIp.h b/src/Mayaqua/TcpIp.h index 83a4db8e..4d35c5ef 100644 --- a/src/Mayaqua/TcpIp.h +++ b/src/Mayaqua/TcpIp.h @@ -8,6 +8,9 @@ #ifndef TCPIP_H #define TCPIP_H +#include "Mayaqua.h" +#include "Network.h" + #ifdef OS_WIN32 #pragma pack(push, 1) #endif // OS_WIN32 diff --git a/src/Mayaqua/Tick64.c b/src/Mayaqua/Tick64.c index 71cecace..f99a623f 100644 --- a/src/Mayaqua/Tick64.c +++ b/src/Mayaqua/Tick64.c @@ -5,21 +5,15 @@ // Tick64.c // 64-bit real-time clock program -#include +#include "Tick64.h" -#ifdef WIN32 -#include -#endif // WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Kernel.h" +#include "Memory.h" +#include "Microsoft.h" +#include "Object.h" +#include "Str.h" +#include "Unix.h" +#include "Win32.h" static TICK64 *tk64 = NULL; static EVENT *halt_tick_event = NULL; diff --git a/src/Mayaqua/Tick64.h b/src/Mayaqua/Tick64.h index e212f8bf..1791c517 100644 --- a/src/Mayaqua/Tick64.h +++ b/src/Mayaqua/Tick64.h @@ -8,6 +8,8 @@ #ifndef TICK64_H #define TICK64_H +#include "MayaType.h" + // Maximum number of correction list entries #define MAX_ADJUST_TIME 1024 diff --git a/src/Mayaqua/Tracking.c b/src/Mayaqua/Tracking.c index 884c10b2..1f4814c8 100644 --- a/src/Mayaqua/Tracking.c +++ b/src/Mayaqua/Tracking.c @@ -5,16 +5,12 @@ // Tracking.c // Object tracking module -#include +#include "Tracking.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include "Mayaqua.h" +#include "Memory.h" +#include "OS.h" +#include "Str.h" // Global variables static LOCK *obj_lock; diff --git a/src/Mayaqua/Tracking.h b/src/Mayaqua/Tracking.h index 75798164..b08b2ddb 100644 --- a/src/Mayaqua/Tracking.h +++ b/src/Mayaqua/Tracking.h @@ -8,6 +8,8 @@ #ifndef TRACKING_H #define TRACKING_H +#include "MayaType.h" + // The number of array #define TRACKING_NUM_ARRAY 1048576 diff --git a/src/Mayaqua/Unix.c b/src/Mayaqua/Unix.c index 0f1428f3..cdb5e612 100755 --- a/src/Mayaqua/Unix.c +++ b/src/Mayaqua/Unix.c @@ -5,19 +5,46 @@ // Unix.c // UNIX dependent code -#include +#ifdef OS_UNIX -#ifdef UNIX +#include "Unix.h" +#include "Cfg.h" +#include "FileIO.h" +#include "GlobalConst.h" +#include "Internat.h" +#include "Kernel.h" +#include "Mayaqua.h" +#include "Memory.h" +#include "Network.h" +#include "Object.h" +#include "Str.h" +#include "Table.h" +#include "Tick64.h" + +#include #include #include #include -#include -#include -#include -#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include #include -#include +#include + +#ifdef UNIX_LINUX +#include +#endif #ifdef UNIX_MACOS #ifdef NO_VLAN diff --git a/src/Mayaqua/Unix.h b/src/Mayaqua/Unix.h index 63d1d334..e382d686 100644 --- a/src/Mayaqua/Unix.h +++ b/src/Mayaqua/Unix.h @@ -10,6 +10,8 @@ #ifndef UNIX_H #define UNIX_H +#include "OS.h" + // Constants #define UNIX_THREAD_STACK_SIZE (200 * 1000) // Stack size #define UNIX_MAX_CHILD_PROCESSES 2000000 // Maximum number of child processes diff --git a/src/Mayaqua/Win32.c b/src/Mayaqua/Win32.c index 797b0249..32d30be4 100644 --- a/src/Mayaqua/Win32.c +++ b/src/Mayaqua/Win32.c @@ -5,25 +5,25 @@ // Win32.c // Microsoft Windows dependent code -#include +#ifdef OS_WIN32 -#ifdef WIN32 +#include "Win32.h" + +#include "FileIO.h" +#include "GlobalConst.h" +#include "Internat.h" +#include "Microsoft.h" +#include "Memory.h" +#include "Object.h" +#include "Str.h" -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include + +#include +#include +#include +#include +#include static HANDLE heap_handle = NULL; static HANDLE hstdout = INVALID_HANDLE_VALUE; diff --git a/src/Mayaqua/Win32.h b/src/Mayaqua/Win32.h index f5655854..71ef793d 100644 --- a/src/Mayaqua/Win32.h +++ b/src/Mayaqua/Win32.h @@ -5,11 +5,13 @@ // Win32.h // Header of Win32.c -#ifdef OS_WIN32 +#ifdef OS_WIN32 #ifndef WIN32_H #define WIN32_H +#include "OS.h" + // Function prototype OS_DISPATCH_TABLE *Win32GetDispatchTable(); diff --git a/src/SeLow/SeLowCommon.h b/src/SeLow/SeLowCommon.h index ac0a51cf..3ee52f4c 100644 --- a/src/SeLow/SeLowCommon.h +++ b/src/SeLow/SeLowCommon.h @@ -5,6 +5,12 @@ // SeLowCommon.h // Common Header for Kernel Mode / User Mode +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include "Windows.h" + //// Version number // Change this number every time functions are added or modified on the driver. // As long as this number does not change, installation of SeLow during the update diff --git a/src/Wfp/Wfp.h b/src/Wfp/Wfp.h index 6456bb42..ed43b8aa 100644 --- a/src/Wfp/Wfp.h +++ b/src/Wfp/Wfp.h @@ -8,6 +8,10 @@ #ifndef WFP_H #define WFP_H +#include "Mayaqua/MayaType.h" + +#include + // Identify string #define WFP_DEVICE_NAME L"\\Device\\PXWFP_DEVICE" #define WFP_DEVICE_NAME_WIN32 L"\\DosDevices\\PXWFP_DEVICE" diff --git a/src/vpnbridge/vpnbridge.c b/src/vpnbridge/vpnbridge.c index 135644d3..ad3876b3 100644 --- a/src/vpnbridge/vpnbridge.c +++ b/src/vpnbridge/vpnbridge.c @@ -5,28 +5,14 @@ // vpnbridge.c // VPN Bridge Service Program -#include - #define VPN_EXE -#ifdef WIN32 -#include -#include -#include -#include -#include -#include -#include -#include "../PenCore/resource.h" -#endif // WIN32 -#include -#include -#include -#include -#include -#include -#include -#include +#include "Cedar/Server.h" + +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Unix.h" +#include "Mayaqua/Win32.h" // Process start function void StartProcess() @@ -51,8 +37,6 @@ int main(int argc, char *argv[]) { InitProcessCallOnce(); - VgUseStaticLink(); - #ifdef OS_WIN32 return MsService(GC_SVC_NAME_VPNBRIDGE, StartProcess, StopProcess, ICO_BRIDGE, argv[0]); #else // OS_WIN32 diff --git a/src/vpnclient/CMakeLists.txt b/src/vpnclient/CMakeLists.txt index a9998f24..03b19b0d 100644 --- a/src/vpnclient/CMakeLists.txt +++ b/src/vpnclient/CMakeLists.txt @@ -4,7 +4,6 @@ set(COMPONENT_INTERNAL_NAME "vpnclient") if(WIN32) add_executable(vpnclient WIN32 "vpncsvc.c" - "vpncsvc.h" "${TOP_DIRECTORY}/src/BuildFiles/Manifests/common.manifest" ) @@ -20,7 +19,7 @@ if(WIN32) configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc") target_sources(vpnclient PRIVATE "vpnclient.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc") else() - add_executable(vpnclient vpncsvc.c vpncsvc.h) + add_executable(vpnclient "vpncsvc.c") endif() set_target_properties(vpnclient diff --git a/src/vpnclient/vpncsvc.c b/src/vpnclient/vpncsvc.c index c08055cf..74d6da06 100644 --- a/src/vpnclient/vpncsvc.c +++ b/src/vpnclient/vpncsvc.c @@ -5,18 +5,14 @@ // vpncsvc.c // VPN Client Service Program -#include - #define VPN_EXE -#include -#include -#include -#include -#include -#include -#include -#include +#include "Cedar/Client.h" + +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Unix.h" +#include "Mayaqua/Win32.h" // Process start function void StartProcess() diff --git a/src/vpnclient/vpncsvc.h b/src/vpnclient/vpncsvc.h deleted file mode 100644 index 675b77ee..00000000 --- a/src/vpnclient/vpncsvc.h +++ /dev/null @@ -1,18 +0,0 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpncsvc.h -// Header of vpncsvc.c - -#ifndef VPNCSVC_H -#define VPNCSVC_H - -// Function prototype -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow); -void StartProcess(); -void StopProcess(); - - -#endif // VPNCSVC_H - diff --git a/src/vpncmd/vpncmd.c b/src/vpncmd/vpncmd.c index 17fa3b1f..78c28aa4 100644 --- a/src/vpncmd/vpncmd.c +++ b/src/vpncmd/vpncmd.c @@ -5,25 +5,14 @@ // vpncmd.c // VPN Command Line Management Utility -#include +#include "Cedar/Cedar.h" -#ifdef WIN32 -#include -#include -#include -#include -#include -#include -#include -#endif // WIN32 -#include -#include -#include -#include -#include -#include -#include -#include +#include "Cedar/Command.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Str.h" // main function int main(int argc, char *argv[]) @@ -35,9 +24,9 @@ int main(int argc, char *argv[]) #ifdef OS_WIN32 SetConsoleTitleA(CEDAR_PRODUCT_STR " VPN Command Line Utility"); -#else - // For *nix, disable output buffering to allow for interactive use - setbuf(stdout,NULL); +#else + // For *nix, disable output buffering to allow for interactive use + setbuf(stdout,NULL); #endif // OS_WIN32 #if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". diff --git a/src/vpncmgr/vpncmgr.c b/src/vpncmgr/vpncmgr.c index 4f8b24f8..1fb5067b 100644 --- a/src/vpncmgr/vpncmgr.c +++ b/src/vpncmgr/vpncmgr.c @@ -5,25 +5,8 @@ // vpncmgr.c // VPN Client connection manager program -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - +#include "Cedar/Cedar.h" +#include "Cedar/CM.h" // WinMain function int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) @@ -51,5 +34,3 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) FreeMayaqua(); return 0; } - - diff --git a/src/vpnserver/vpnserver.c b/src/vpnserver/vpnserver.c index 6a39ab65..ef7d4278 100644 --- a/src/vpnserver/vpnserver.c +++ b/src/vpnserver/vpnserver.c @@ -5,28 +5,14 @@ // vpnserver.c // VPN Server service program -#include - #define VPN_EXE -#ifdef WIN32 -#include -#include -#include -#include -#include -#include -#include -#include "../PenCore/resource.h" -#endif // WIN32 -#include -#include -#include -#include -#include -#include -#include -#include +#include "Cedar/Server.h" + +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Unix.h" +#include "Mayaqua/Win32.h" // Process starting function void StartProcess() @@ -51,10 +37,7 @@ int main(int argc, char *argv[]) { InitProcessCallOnce(); - VgUseStaticLink(); - #ifdef OS_WIN32 - return MsService(GC_SVC_NAME_VPNSERVER, StartProcess, StopProcess, ICO_CASCADE, argv[0]); #else // OS_WIN32 return UnixService(argc, argv, "vpnserver", StartProcess, StopProcess); diff --git a/src/vpnsetup/vpnsetup.c b/src/vpnsetup/vpnsetup.c index fc401cf9..abdd86ac 100644 --- a/src/vpnsetup/vpnsetup.c +++ b/src/vpnsetup/vpnsetup.c @@ -1,27 +1,9 @@ // SoftEther VPN Source Code - Developer Edition Master Branch // Cedar Communication Module +#include "Cedar/SW.h" -#include - -// vpnsetup.c -// VPN Setup Wizard - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Mayaqua/Mayaqua.h" // WinMain function int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) @@ -30,13 +12,9 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) InitProcessCallOnce(); - VgUseStaticLink(); - ret = SWExec(); ExitProcess(ret); return (int)ret; } - - diff --git a/src/vpnsmgr/vpnsmgr.c b/src/vpnsmgr/vpnsmgr.c index d341dc00..d95cc149 100644 --- a/src/vpnsmgr/vpnsmgr.c +++ b/src/vpnsmgr/vpnsmgr.c @@ -5,23 +5,8 @@ // vpncmgr.c // VPN Client connection manager program -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Cedar/Cedar.h" +#include "Cedar/SM.h" // WinMain function int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) diff --git a/src/vpntest/CMakeLists.txt b/src/vpntest/CMakeLists.txt index 7d13f2f6..5820740a 100644 --- a/src/vpntest/CMakeLists.txt +++ b/src/vpntest/CMakeLists.txt @@ -1,7 +1,7 @@ set(COMPONENT_NAME "Testing Utility") set(COMPONENT_INTERNAL_NAME "vpntest") -add_executable(vpntest vpntest.c vpntest.h) +add_executable(vpntest vpntest.c) set_target_properties(vpntest PROPERTIES diff --git a/src/vpntest/vpntest.c b/src/vpntest/vpntest.c index 8dd3061e..084c393e 100644 --- a/src/vpntest/vpntest.c +++ b/src/vpntest/vpntest.c @@ -1,18 +1,19 @@ // vpntest.c // VPN Server / VPN Client / VPN Bridge test program -#include -#define VPN_EXE +#define VPN_EXE -#include -#include -#include -#include -#include -#include -#include -#include -#include "vpntest.h" +#include "Cedar/Client.h" +#include "Cedar/CM.h" +#include "Cedar/Command.h" +#include "Cedar/Server.h" +#include "Cedar/SM.h" + +#include "Mayaqua/Internat.h" +#include "Mayaqua/Mayaqua.h" +#include "Mayaqua/Memory.h" +#include "Mayaqua/Microsoft.h" +#include "Mayaqua/Str.h" void client_test(UINT num, char **arg) { diff --git a/src/vpntest/vpntest.h b/src/vpntest/vpntest.h deleted file mode 100644 index d3f5a12f..00000000 --- a/src/vpntest/vpntest.h +++ /dev/null @@ -1 +0,0 @@ -