alroyso 3 жил өмнө
parent
commit
a43b2a45f5
44 өөрчлөгдсөн 985 нэмэгдсэн , 35 устгасан
  1. 21 1
      SProxy/CApp.cpp
  2. 20 1
      SProxy/CApp.h
  3. 189 0
      SProxy/CLashConfig.cpp
  4. 47 0
      SProxy/CLashConfig.h
  5. 27 0
      SProxy/CManageNetWork.cpp
  6. 2 1
      SProxy/CManageNetWork.h
  7. 29 1
      SProxy/CNetWork.cpp
  8. 5 0
      SProxy/CNetWork.h
  9. 134 0
      SProxy/CProcess.cpp
  10. 41 0
      SProxy/CProcess.h
  11. 72 0
      SProxy/CTool.cpp
  12. 22 0
      SProxy/CTool.h
  13. 14 12
      SProxy/CUserInfo.cpp
  14. 5 1
      SProxy/CUserInfo.h
  15. 2 0
      SProxy/IBaseClash.cpp
  16. 17 0
      SProxy/IBaseClash.h
  17. 4 1
      SProxy/IBaseCurl.h
  18. 61 0
      SProxy/Logger.cpp
  19. 50 0
      SProxy/Logger.h
  20. BIN
      SProxy/LoginDlg.cpp
  21. BIN
      SProxy/LoginDlg.h
  22. BIN
      SProxy/MainDlg.cpp
  23. BIN
      SProxy/MainDlg.h
  24. BIN
      SProxy/SProxy.cpp
  25. 10 0
      SProxy/SProxy.vcxproj
  26. 33 0
      SProxy/SProxy.vcxproj.filters
  27. 13 0
      SProxy/comm.h
  28. 20 0
      SProxy/event.h
  29. BIN
      SProxy/res/resource.h
  30. BIN
      SProxy/res/soui_res.rc2
  31. BIN
      SProxy/stdafx.h
  32. BIN
      SProxy/uires/image/btn-selection.png
  33. BIN
      SProxy/uires/image/btn-switch-off.png
  34. BIN
      SProxy/uires/image/btn-switch-on.png
  35. BIN
      SProxy/uires/image/default.png
  36. 10 3
      SProxy/uires/uires.idx
  37. 5 0
      SProxy/uires/values/skin.xml
  38. 10 9
      SProxy/uires/xml/dlg_main.xml
  39. 48 0
      SProxy/uires/xml/page_home.xml
  40. 59 0
      SProxy/uires/xml/page_node.xml
  41. 15 5
      __INCLUDE/AsynFunctionT.hpp
  42. BIN
      __bin/x64/Debug/config/Country.mmdb
  43. BIN
      __bin/x64/Debug/config/syscode.exe
  44. BIN
      __bin/x64/Debug/config/wintun.dll

+ 21 - 1
SProxy/CApp.cpp

@@ -4,7 +4,7 @@
 
 CApp* SSingleton<CApp>::ms_Singleton = NULL;
 
-CApp::CApp() : m_is_out(0), m_userinfo(nullptr)
+CApp::CApp() : m_is_out(0), m_userinfo(nullptr), m_proxy_mode(PROXY_MODE::sys_mode), m_route_mode(ROUT_MODE::cn_mode)
 {
 
 }
@@ -54,3 +54,23 @@ int CApp::GetOut()
 {
 	return m_is_out;
 }
+
+void CApp::SetSysMode(PROXY_MODE mode)
+{
+	m_proxy_mode = mode;
+}
+
+PROXY_MODE CApp::GetSysMode()
+{
+	return m_proxy_mode;
+}
+
+void CApp::SetRouteMode(ROUT_MODE mode)
+{
+	m_route_mode = mode;
+}
+
+ROUT_MODE CApp::GetRouteMode()
+{
+	return m_route_mode;
+}

+ 20 - 1
SProxy/CApp.h

@@ -17,7 +17,17 @@ enum ROUT_MODE {
 
 };
 
+struct SysMode {
+	int id;
+	PROXY_MODE proxy_mode;
+	SStringW  name;
+};
 
+struct RouteMode {
+	int id;
+	ROUT_MODE route_mode;
+	SStringW  name;
+};
 class CApp : public SSingleton<CApp>
 {
 public:
@@ -38,10 +48,19 @@ public:
 
 	int GetOut();
 
+	void SetSysMode(PROXY_MODE mode);
+
+	PROXY_MODE GetSysMode();
+
+	void SetRouteMode(ROUT_MODE mode);
+
+	ROUT_MODE GetRouteMode();
+
 private:
 	int m_is_out;
 
 	CUserInfo*   m_userinfo;
-
+	PROXY_MODE m_proxy_mode;
+	ROUT_MODE  m_route_mode;
 };
 

+ 189 - 0
SProxy/CLashConfig.cpp

@@ -0,0 +1,189 @@
+#include "stdafx.h"
+#include "CLashConfig.h"
+#include "CApp.h"
+#include "comm.h"
+#include "FileOperate.h"
+
+
+CLashConfig::CLashConfig() : m_socks_port(9200), m_http_port(9300), m_c_port(9090), m_process(nullptr), m_Asyntask(1), m_is_qut(false), m_log(nullptr)
+{
+}
+
+CLashConfig::~CLashConfig(void)
+{
+	if (m_process)
+	{
+		delete m_process;
+		m_process = nullptr;
+	}
+	if (m_log)
+	{
+		delete m_log;
+		m_log = nullptr;
+	}
+}
+
+BOOL CLashConfig::MakeClash()
+{
+    return 0;
+}
+
+BOOL CLashConfig::InitClash()
+{
+	if (!m_process)
+	{
+		m_process = new CProcess();
+	}
+	
+	m_http_port = CTool::getSingletonPtr()->FindAvailableTcpPort(9300,9500);
+	m_socks_port = CTool::getSingletonPtr()->FindAvailableTcpPort(9600,9800);
+	m_c_port = CTool::getSingletonPtr()->FindAvailableTcpPort(9900);
+
+    std::string path = std::filesystem::current_path().string();
+
+	std::string dir = CLASHCONFIGDIR;
+
+	auto name_file = dir + "\\" + CLASHCONFIINIT;
+
+	std::string logfile = path + "\\config\\log.log";
+	if (m_log == nullptr)
+	{
+		m_log = new Logger(Logger::file_and_terminal, Logger::info, logfile);
+	}
+	
+
+	if (CApp::getSingletonPtr()->GetSysMode() == PROXY_MODE::tun_mode) {
+		name_file = dir + "\\" + CLASHCONFIINIT;
+	}
+	YAML::Node root;
+	root["port"] = m_http_port;
+	root["socks-port"] = m_socks_port;
+	root["allow-lan"] = true;
+	root["external-controller"] = "127.0.0.1:" + std::to_string(m_c_port);
+
+
+	try
+	{
+		std::ofstream ofstream(name_file);
+		ofstream << root << std::endl;
+		ofstream.close();
+		return TRUE;
+	}
+	catch (const std::exception&)
+	{
+		return FALSE;
+	}
+
+
+    return TRUE;
+}
+
+BOOL CLashConfig::StartClash()
+{
+	std::wstring path = std::filesystem::current_path().wstring();
+	std::wstring config = path + L"\\" + WCLASHCONFIGDIR;
+	//args.push_back("-d");
+	////args.push_back(std::filesystem::current_path().string() + "\\route");
+	//args.push_back(path + "\\config");
+	//args.push_back("-f");
+	//args.push_back(path + "\\config\\configinit.yaml");
+	std::wstring run_config = config + L"\\" + S_CA2W(CLASHCONFIINIT).GetBuffer(0);
+	SStringW path_config;
+	path_config.Format(L"%s\\%s -d %s -f %s", config.c_str(),CLASHEXE,config.c_str(), run_config.c_str());
+	if (m_process)
+	{
+		m_process->Create(CProcess::ASYNC);
+		if (m_process->Execute(path_config.GetBuffer(0)))
+		{
+			m_Asyntask.AddTask(&CLashConfig::ThreadFun_process_Config, this, (LPARAM)NULL);
+		}
+
+		
+	}
+    return 0;
+}
+
+BOOL CLashConfig::StopClash()
+{
+	m_is_qut = true;
+	m_Asyntask.Close();
+	char ch[MAX_PATH];
+	memset(ch, 0, MAX_PATH);
+	sprintf_s(ch, "ok\n");
+	m_process->WriteSome(ch, sizeof(ch));
+    return 0;
+}
+
+YAML::Node CLashConfig::buildShadowsocks()
+{
+    return YAML::Node();
+}
+
+YAML::Node CLashConfig::buildtrojan()
+{
+    return YAML::Node();
+}
+
+YAML::Node CLashConfig::buildv2ray()
+{
+    return YAML::Node();
+}
+
+std::vector<YAML::Node> CLashConfig::buildv2rayHost()
+{
+    return std::vector<YAML::Node>();
+}
+
+YAML::Node CLashConfig::builTunConfig()
+{
+    return YAML::Node();
+}
+
+YAML::Node CLashConfig::buildDnsConfig()
+{
+    return YAML::Node();
+}
+
+std::vector<YAML::Node> CLashConfig::buildProxyGroups()
+{
+    return std::vector<YAML::Node>();
+}
+
+std::vector<YAML::Node> CLashConfig::buildRules()
+{
+    return std::vector<YAML::Node>();
+}
+
+void CLashConfig::ThreadFun_process_Config(LPARAM lParam)
+{
+	if (m_process)
+	{
+		char ch[MAX_PATH];
+		memset(ch, 0, MAX_PATH);
+		do
+		{
+			size_t bytesRead = m_process->ReadLine(ch, sizeof(ch));
+			
+			if (bytesRead == 0)
+			{
+				
+				break;
+			}
+
+			if (m_is_qut)
+			{
+				
+				break;
+			}
+
+			if (m_log)
+			{
+				std::string log(ch);
+				m_log->INFO(log);
+			}
+
+			/*if (ch[bytesRead - 1] == '\n') break;*/
+		} while (true);
+		
+	}
+}

+ 47 - 0
SProxy/CLashConfig.h

@@ -0,0 +1,47 @@
+#pragma once
+
+#include "IBaseClash.h"
+#include <yaml-cpp/yaml.h>
+#include "CTool.h"
+#include "CProcess.h"
+#include "Logger.h"
+class CLashConfig : public IBaseClash
+{
+public:
+	CLashConfig();
+	~CLashConfig(void);
+
+	// ͨ¹ý IBaseClash ¼Ì³Ð
+	virtual BOOL MakeClash() override;
+
+	virtual BOOL InitClash() override;
+
+
+	// ͨ¹ý IBaseClash ¼Ì³Ð
+	virtual BOOL StartClash() override;
+
+	virtual BOOL StopClash() override;
+
+private:
+	YAML::Node buildShadowsocks();
+	YAML::Node buildtrojan();
+	YAML::Node buildv2ray();
+	std::vector<YAML::Node> buildv2rayHost();
+
+	YAML::Node builTunConfig();
+	YAML::Node buildDnsConfig();
+	std::vector<YAML::Node> buildProxyGroups();
+	std::vector<YAML::Node> buildRules();
+private:
+	void ThreadFun_process_Config(LPARAM lParam);
+
+private:
+	int m_socks_port;
+	int m_http_port;
+	int m_c_port;
+	bool   m_is_qut;
+	CProcess* m_process;
+	AsynTaskHandle<LPARAM>	m_Asyntask;
+	Logger*     m_log;
+};
+

+ 27 - 0
SProxy/CManageNetWork.cpp

@@ -23,6 +23,7 @@ void CManageNetWork::init()
 
 
 	SNotifyCenter::getSingleton().addEvent(EVENTID(EventLogin));
+	SNotifyCenter::getSingleton().addEvent(EVENTID(EventDoWNload));
 
 
 	if (!m_base_curl)
@@ -70,6 +71,15 @@ SStringA CManageNetWork::GetPassWord()
 	return m_password;
 }
 
+void CManageNetWork::DonloadConfg()
+{
+	if (!m_base_curl)
+	{
+		return;
+	}
+	m_Asyntask.AddTask(&CManageNetWork::ThreadFun_Dowlon_Config, this, (LPARAM)m_base_curl);
+}
+
 void CManageNetWork::ThreadFun_login(LPARAM lParam)
 {
 	IBaseCurl* lpAsyncParam = reinterpret_cast<IBaseCurl*>(lParam);
@@ -102,6 +112,23 @@ void CManageNetWork::ThreadFun_login(LPARAM lParam)
 	pEvt->Release();
 }
 
+void CManageNetWork::ThreadFun_Dowlon_Config(LPARAM lParam)
+{
+	IBaseCurl* lpAsyncParam = reinterpret_cast<IBaseCurl*>(lParam);
+	int code = 200;
+	SStringW msg = L"";
+	std::string data;
+	if (!m_base_curl->Download(CApp::getSingletonPtr()->GetUserinfo()->clash_config)) {
+		code = 0;
+		msg = L"ÏÂÔØÎļþʧ°Ü";
+	}
+	EventDoWNload* pEvt = new EventDoWNload(nullptr);
+	pEvt->status = code;
+	pEvt->msg = msg;
+	SNotifyCenter::getSingleton().FireEventAsync(pEvt);
+	pEvt->Release();
+}
+
 void CManageNetWork::LoadFileToData() {
 	FileOperate f;
 	std::string path = std::filesystem::current_path().string();

+ 2 - 1
SProxy/CManageNetWork.h

@@ -21,10 +21,11 @@ public:
 	SStringA GetUsername();
 	SStringA GetPassWord();
 	
+	void DonloadConfg();
 
 private:
 	void ThreadFun_login(LPARAM lParam);
-
+	void ThreadFun_Dowlon_Config(LPARAM lParam);
 	void LoadFileToData();
 
 	void DataToFile();

+ 29 - 1
SProxy/CNetWork.cpp

@@ -20,7 +20,7 @@ HTTPRET CNetWork::PostLogin(LPCSTR username, LPCSTR password, std::string& data)
 	std::vector<cpr::Pair> p;
 	p.push_back({ "email",username });
 	p.push_back({ "password",password });
-	std::string text = PostUrl("/api/client/v2/login", p);
+	std::string text = PostUrl("/api/client/v3/login", p);
 	if (text.empty()) {
 
 		return http_f;
@@ -85,6 +85,34 @@ std::string CNetWork::PostUrl(std::string path, std::vector<cpr::Pair> parame)
 	return std::string("");
 }
 
+bool  write_data(std::string /*data*/, intptr_t /*userdata*/)
+{
+
+	return true;
+}
+
+bool CNetWork::Download(std::string path)
+{
+
+	std::string configdir = std::filesystem::current_path().string() + "\\" + CLASHCONFIGDIR;
+
+	std::filesystem::path p(configdir);
+
+	if (!std::filesystem::exists(p)) {
+		std::filesystem::create_directory(p);
+	}
+
+	std::string configname = configdir + "\\" CLASHCONFIGNAME;
+
+	std::ofstream ofs(configname);
+	cpr::Url url{ path };
+	cpr::Session session;
+	session.SetUrl(url);
+	cpr::Response response = session.Download(ofs);
+	return response.status_code == 200;
+}
+
+
 void CNetWork::Init()
 {
 

+ 5 - 0
SProxy/CNetWork.h

@@ -15,9 +15,14 @@ public:
 	SStringA  GetLastErrorA();
 	SStringW  GetLastErrorW();
 
+	bool Download(std::string path);
+
+
 private:
 	std::string GetUrl(std::string path, std::vector<cpr::Parameter> parame);
 	std::string PostUrl(std::string path, std::vector<cpr::Pair> parame);
+
+	 
 	void Init();
 	void UnInit();
 private:

+ 134 - 0
SProxy/CProcess.cpp

@@ -0,0 +1,134 @@
+#include "stdafx.h"
+#include "CProcess.h"
+
+CProcess::CProcess()
+{
+	m_dwProcessId = 0;
+	m_execType = SYNC;
+	// 初始化管道句柄为空句柄
+	for (int i = 0; i < _countof(m_hPipes); ++i)
+		for (int j = 0; j < _countof(m_hPipes[i]); ++j)
+			m_hPipes[i][j] = INVALID_HANDLE_VALUE;
+}
+CProcess::CProcess(ExecType execType) :CProcess()
+{
+	if (!Create(execType)) ClosePipes();
+}
+CProcess::~CProcess()
+{
+	ClosePipes();
+}
+
+BOOL CProcess::Create(ExecType execType)
+{
+	BOOL bRet = TRUE;
+	bRet |= CreatePipes();
+	m_execType = execType;
+	return bRet;
+}
+
+BOOL CProcess::Execute(LPCTSTR Command)
+{
+	BOOL bRet = TRUE;
+
+	STARTUPINFO si;
+	ZeroMemory(&si, sizeof(si));
+	si.cb = sizeof(si);
+	si.hStdInput = m_hPipes[pIn][Read];
+	si.hStdOutput = m_hPipes[pOut][Write];
+	si.hStdError = m_hPipes[pErr][Write];
+	si.wShowWindow = SW_HIDE;
+	si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
+
+	PROCESS_INFORMATION pi;
+
+	TCHAR cmd[MAX_PATH];
+	_tcscpy_s(cmd, _countof(cmd), Command);
+
+	bRet |= ::CreateProcess(NULL, cmd, NULL, NULL, TRUE, NULL, NULL, NULL, &si, &pi);
+	if (!bRet) {
+		ClosePipes();
+		return FALSE;
+	}
+
+	m_dwProcessId = pi.dwProcessId;
+	// 关闭不要的读写句柄
+	::CloseHandle(m_hPipes[pIn][Read]);		m_hPipes[pIn][Read] = INVALID_HANDLE_VALUE;
+	::CloseHandle(m_hPipes[pOut][Write]);	m_hPipes[pOut][Write] = INVALID_HANDLE_VALUE;
+	::CloseHandle(m_hPipes[pErr][Write]);	m_hPipes[pErr][Write] = INVALID_HANDLE_VALUE;
+
+	if (m_execType == SYNC) WaitForSingleObject(pi.hProcess, INFINITE);
+	::CloseHandle(pi.hProcess);
+	::CloseHandle(pi.hThread);
+
+	return bRet;
+}
+
+size_t CProcess::ReadLine(LPVOID lpBuffer, size_t len, char seq)
+{
+	if (!IsOk()) return 0;
+
+	DWORD totalRead = 0;
+	DWORD bytesRead;
+	char* buffer = new char[len + 1];
+	ZeroMemory(buffer, len + 1);
+	char ch;
+	do {
+		if (!::ReadFile(m_hPipes[pOut][Read], &ch, 1, &bytesRead, NULL)) break;
+		buffer[totalRead] = ch;
+		++totalRead;
+	} while (bytesRead == 1 && ch != seq && totalRead < len + 1);
+
+	if (totalRead > 0) strcpy_s((char*)lpBuffer, len, buffer);
+	delete[] buffer;
+
+	return totalRead;
+}
+
+size_t CProcess::WriteSome(LPVOID lpBuffer, size_t len)
+{
+	if (!IsOk()) return 0;
+
+	DWORD totalWritten = 0;
+	while (len > 0)
+	{
+		DWORD chunkWritten;
+		if (!::WriteFile(m_hPipes[pIn][Write], lpBuffer, len, &chunkWritten, NULL)) break;
+		if (!chunkWritten) break;
+
+		lpBuffer = (char*)lpBuffer + chunkWritten;
+		totalWritten += chunkWritten;
+		len -= chunkWritten;
+	}
+
+	return totalWritten;
+}
+
+BOOL CProcess::CreatePipes()
+{
+	BOOL bRet = TRUE;
+	for (int i = 0; i < pOut + 1; ++i)
+	{
+		SECURITY_ATTRIBUTES security;
+		security.nLength = sizeof(security);
+		security.lpSecurityDescriptor = NULL;
+		security.bInheritHandle = TRUE;
+		bRet |= ::CreatePipe(&m_hPipes[i][Read], &m_hPipes[i][Write], &security, 0);
+	}
+	bRet |= ::SetHandleInformation(m_hPipes[pIn][Write], HANDLE_FLAG_INHERIT, 0);
+	bRet |= ::SetHandleInformation(m_hPipes[pOut][Read], HANDLE_FLAG_INHERIT, 0);
+	bRet |= ::SetHandleInformation(m_hPipes[pErr][Read], HANDLE_FLAG_INHERIT, 0);
+	return bRet;
+}
+
+void CProcess::ClosePipes()
+{
+	for (int i = 0; i < _countof(m_hPipes); ++i) {
+		for (int j = 0; j < _countof(m_hPipes[i]); ++j) {
+			if (m_hPipes[i][j] != INVALID_HANDLE_VALUE) {
+				::CloseHandle(m_hPipes[i][j]);
+				m_hPipes[i][j] = INVALID_HANDLE_VALUE;
+			}
+		}
+	}
+}

+ 41 - 0
SProxy/CProcess.h

@@ -0,0 +1,41 @@
+#pragma once
+ 
+#include "tchar.h"
+#include "windows.h"
+
+class CProcess
+{
+public:
+	// 管道类型
+	enum PipeType { pIn, pOut, pErr };
+	// 读写方式
+	enum Direction { Read, Write };
+	// 程序执行的方式
+	enum ExecType { ASYNC, SYNC };
+
+	CProcess();
+	CProcess(ExecType execType);
+	~CProcess();
+	// 创建一个指定执行方式的进程类
+	BOOL Create(ExecType execType);
+	// 执行脚本
+	BOOL Execute(LPCTSTR Command);
+	// 进程类是否正常
+	BOOL IsOk() { return m_hPipes[pIn][Write] != INVALID_HANDLE_VALUE; }
+	// 获取进程id
+	DWORD GetPid() { return m_dwProcessId; }
+	// 从管道读取一行
+	size_t ReadLine(LPVOID lpBuffer, size_t len, char seq = '\n');
+	// 向管道写入
+	size_t WriteSome(LPVOID lpBuffer, size_t len);
+	// 关闭管道
+	void ClosePipes();
+protected:
+	BOOL CreatePipes();
+	
+private:
+	DWORD m_dwProcessId;
+	HANDLE m_hPipes[3][2];
+	ExecType m_execType;
+};
+

+ 72 - 0
SProxy/CTool.cpp

@@ -0,0 +1,72 @@
+#include "stdafx.h"
+#include "CTool.h"
+
+#include <WinSock.h>
+#include <tcpmib.h>
+#include <IPHlpApi.h>
+#pragma comment(lib, "IPHlpApi.lib")
+#pragma comment(lib, "WS2_32.lib")
+
+CTool* SSingleton<CTool>::ms_Singleton = NULL;
+
+
+CTool::CTool()
+{
+	WSADATA wsaData;
+	WSAStartup(0x0201, &wsaData);
+}
+
+CTool::~CTool()
+{
+	WSACleanup();
+}
+
+std::vector<uint16_t> CTool::GetAllTcpConnectionsPort()
+{
+	std::vector<uint16_t> ret;
+	ULONG size = 0;
+	GetTcpTable(NULL, &size, TRUE);
+	std::unique_ptr<char[]> buffer(new char[size]);
+
+	PMIB_TCPTABLE tcpTable = reinterpret_cast<PMIB_TCPTABLE>(buffer.get());
+	if (GetTcpTable(tcpTable, &size, FALSE) == NO_ERROR)
+		for (size_t i = 0; i < tcpTable->dwNumEntries; i++)
+			ret.push_back(ntohs((uint16_t)tcpTable->table[i].dwLocalPort));
+	std::sort(std::begin(ret), std::end(ret));
+	return ret;
+}
+
+std::vector<uint16_t> CTool::GetAllUdpConnectionsPort()
+{
+	std::vector<uint16_t> ret;
+	ULONG size = 0;
+	GetUdpTable(NULL, &size, TRUE);
+	std::unique_ptr<char[]> buffer(new char[size]);
+
+	PMIB_UDPTABLE udpTable = reinterpret_cast<PMIB_UDPTABLE>(buffer.get());
+	if (GetUdpTable(udpTable, &size, FALSE) == NO_ERROR)
+		for (size_t i = 0; i < udpTable->dwNumEntries; i++)
+			ret.push_back(ntohs((uint16_t)udpTable->table[i].dwLocalPort));
+	std::sort(std::begin(ret), std::end(ret));
+	return ret;
+}
+
+uint16_t CTool::FindAvailableTcpPort(uint16_t begin, uint16_t end)
+{
+	auto vec = GetAllTcpConnectionsPort();
+	for (uint16_t port = begin; port != end; ++port)
+		if (!std::binary_search(std::begin(vec), std::end(vec), port))
+			return port;
+	return 0;
+}
+
+uint16_t CTool::FindAvailableUdpPort(uint16_t begin, uint16_t end)
+{
+	auto vecTcp = GetAllTcpConnectionsPort(),
+		vecUdp = GetAllUdpConnectionsPort();
+	for (uint16_t port = begin; port != end; ++port)
+		if (!std::binary_search(std::begin(vecTcp), std::end(vecTcp), port) &&
+			!std::binary_search(std::begin(vecUdp), std::end(vecUdp), port))
+			return port;
+	return 0;
+}

+ 22 - 0
SProxy/CTool.h

@@ -0,0 +1,22 @@
+#pragma once
+
+
+#define PORT_DOWN 49152
+#define PORT_UP 65535
+ 
+ 
+
+class CTool : public SSingleton<CTool>
+{
+public:
+	CTool();
+	~CTool();
+
+	uint16_t FindAvailableTcpPort(uint16_t begin = PORT_DOWN, uint16_t end = PORT_UP);
+	uint16_t FindAvailableUdpPort(uint16_t begin = PORT_DOWN, uint16_t end = PORT_UP);
+ 
+private:
+	std::vector<uint16_t> GetAllTcpConnectionsPort();
+	std::vector<uint16_t> GetAllUdpConnectionsPort();
+};
+

+ 14 - 12
SProxy/CUserInfo.cpp

@@ -24,20 +24,22 @@ bool CUserInfo::Init(std::string data)
 
 		if (j["ret"].get<int>() == 1)
 		{
-			auto userinfo = j["data"]["user"];
-			//
-			this->id = userinfo.at("id").get<int>();
-			this->username = userinfo.at("account").get<std::string>();
-			this->expiretime = userinfo.at("expired_at").get<std::string>();
-			this->password = userinfo.at("passwd").get<std::string>();
-			this->unusedTraffic = userinfo.at("unusedTraffic").get<std::string>();
-			this->uuid = userinfo.at("uuid").get<std::string>();
-			this->level = userinfo.at("level").get<std::string>();
-			this->port = userinfo.at("port").get<int>();
-
 			//
 			this->access_token = j["data"]["access_token"].get<std::string>();
-			this->token_type   = j["data"]["token_type"].get<std::string>();
+			this->affurl = j["data"]["affurl"].get<std::string>();
+			this->swoftdownload = j["data"]["swoftdownload"].get<std::string>();
+			this->clash_config = j["data"]["clash_config"].get<std::string>();
+			//
+			this->id = j["data"]["user"].at("id").get<int>();
+			this->username = j["data"]["user"].at("account").get<std::string>();
+			this->expiretime = j["data"]["user"].at("expired_at").get<std::string>();
+			this->password = j["data"]["user"].at("passwd").get<std::string>();
+			this->unusedTraffic = j["data"]["user"].at("unusedTraffic").get<std::string>();
+			this->uuid = j["data"]["user"].at("uuid").get<std::string>();
+			this->level = j["data"]["user"].at("level").get<std::string>();
+			this->port = j["data"]["user"].at("port").get<int>();
+
+			
 			return true;
 
 		}

+ 5 - 1
SProxy/CUserInfo.h

@@ -22,6 +22,7 @@ public:
 	
 
 public:
+	//user
 	std::string username;
 	std::string expiretime; //到期时间
 	std::string acctoken;
@@ -30,7 +31,10 @@ public:
 	std::string uuid;		   //uuid
 	std::string level;		   //用户级别
 	std::string access_token;
-	std::string token_type;
+
+	std::string affurl; //推荐地址
+	std::string swoftdownload; //软件下载地址
+	std::string clash_config; //配置地址
 	int id;
 	int port;
 

+ 2 - 0
SProxy/IBaseClash.cpp

@@ -0,0 +1,2 @@
+#include "stdafx.h"
+#include "IBaseClash.h"

+ 17 - 0
SProxy/IBaseClash.h

@@ -0,0 +1,17 @@
+#pragma once
+class IBaseClash
+{
+public:
+	virtual ~IBaseClash(void) {};
+
+
+	virtual BOOL MakeClash() = 0;
+
+	virtual BOOL InitClash() = 0;
+
+	virtual BOOL StartClash() = 0;
+
+	virtual BOOL StopClash() = 0;
+ 
+};
+

+ 4 - 1
SProxy/IBaseCurl.h

@@ -18,7 +18,10 @@ public:
 
 	virtual void SetUrl(LPCSTR url) = 0;
 
-	//怬
+	//
+	virtual bool Download(std::string path) = 0;
+
+	//怬xia'zai
 	virtual HTTPRET PostLogin(LPCSTR username, LPCSTR password, std::string& data) = 0;
 
 

+ 61 - 0
SProxy/Logger.cpp

@@ -0,0 +1,61 @@
+#include "stdafx.h"
+#include "Logger.h"
+ 
+
+Logger::Logger() {
+	// 默认构造函数
+	this->target = terminal;
+	this->level = debug;
+	cout << "[WELCOME] " << __FILE__ << " " << currTime() << " : " << "=== Start logging ===" << endl;
+}
+
+Logger::Logger(log_target target, log_level level, string path) {
+	this->target = target;
+	this->path = path;
+	this->level = level;
+	string tmp = "";  // 双引号下的常量不能直接相加,所以用一个string类型做转换
+	string welcome_dialog = tmp + "[Welcome] " + __FILE__ + " " + currTime() + " : " + "=== Start logging ===\n";
+	if (target != terminal) {
+		this->outfile.open(path, ios::out | ios::app);   // 打开输出文件
+		this->outfile << welcome_dialog;
+	}
+	if (target != file) {
+		// 如果日志对象不是仅文件
+		cout << welcome_dialog;
+	}
+}
+
+void Logger::output(string text, log_level act_level) {
+	string prefix;
+	if (act_level == debug) prefix = "[DEBUG]   ";
+	else if (act_level == info) prefix = "[INFO]    ";
+	else if (act_level == warning) prefix = "[WARNING] ";
+	else if (act_level == error) prefix = "[ERROR]   ";
+	else prefix = "";
+	prefix += __FILE__;
+	prefix += " ";
+	string output_content = prefix + currTime() + " : " + text + "\n";
+	if (this->level <= act_level && this->target != file) {
+		// 当前等级设定的等级才会显示在终端,且不能是只文件模式
+		cout << output_content;
+	}
+	if (this->target != terminal)
+		outfile << output_content;
+}
+
+
+void Logger::DEBUG(string text) {
+	this->output(text, debug);
+}
+
+void Logger::INFO(string text) {
+	this->output(text, info);
+}
+
+void Logger::WARNING(string text) {
+	this->output(text, warning);
+}
+
+void Logger::LERROR(string text) {
+	this->output(text, error);
+}

+ 50 - 0
SProxy/Logger.h

@@ -0,0 +1,50 @@
+#pragma once
+# ifndef LOG_SYS_H
+# define LOG_SYS_H
+
+# include <iostream>
+# include <fstream>
+# include <string>
+# include <time.h>
+# include <stdio.h>
+# include <stdlib.h>
+
+using std::cout;
+using std::string;
+using std::endl;
+using std::to_string;
+using std::ios;
+
+
+class Logger {
+public:
+	enum log_level { debug, info, warning, error };// 日志等级
+	enum log_target { file, terminal, file_and_terminal };// 日志输出目标
+private:
+
+	string currTime() {
+		// 获取当前时间,并规范表示
+		char tmp[64];
+		time_t ptime;
+		time(&ptime);  // time_t time (time_t* timer);
+		strftime(tmp, sizeof(tmp), "%Y-%m-%d %H:%M:%S", localtime(&ptime));
+		return tmp;
+	}
+
+
+
+	std::ofstream outfile;    // 将日志输出到文件的流对象
+	log_target target;        // 日志输出目标
+	string path;              // 日志文件路径
+	log_level level;          // 日志等级
+	void output(string text, log_level act_level);            // 输出行为
+public:
+	Logger();  // 默认构造函数
+	Logger(log_target target, log_level level, string path);
+	void DEBUG(string text);
+	void INFO(string text);
+	void WARNING(string text);
+	void LERROR(string text);
+};
+
+# endif

BIN
SProxy/LoginDlg.cpp


BIN
SProxy/LoginDlg.h


BIN
SProxy/MainDlg.cpp


BIN
SProxy/MainDlg.h


BIN
SProxy/SProxy.cpp


+ 10 - 0
SProxy/SProxy.vcxproj

@@ -192,11 +192,16 @@
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="CApp.cpp" />
+    <ClCompile Include="CLashConfig.cpp" />
     <ClCompile Include="CManageNetWork.cpp" />
     <ClCompile Include="CNetWork.cpp" />
+    <ClCompile Include="CProcess.cpp" />
+    <ClCompile Include="CTool.cpp" />
     <ClCompile Include="CUserInfo.cpp" />
     <ClCompile Include="FileOperate.cpp" />
+    <ClCompile Include="IBaseClash.cpp" />
     <ClCompile Include="IBaseCurl.cpp" />
+    <ClCompile Include="Logger.cpp" />
     <ClCompile Include="LoginDlg.cpp" />
     <ClCompile Include="MainDlg.cpp" />
     <ClCompile Include="SouiInit.cpp" />
@@ -217,13 +222,18 @@
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="CApp.h" />
+    <ClInclude Include="CLashConfig.h" />
     <ClInclude Include="CManageNetWork.h" />
     <ClInclude Include="CNetWork.h" />
     <ClInclude Include="comm.h" />
+    <ClInclude Include="CProcess.h" />
+    <ClInclude Include="CTool.h" />
     <ClInclude Include="CUserInfo.h" />
     <ClInclude Include="event.h" />
     <ClInclude Include="FileOperate.h" />
+    <ClInclude Include="IBaseClash.h" />
     <ClInclude Include="IBaseCurl.h" />
+    <ClInclude Include="Logger.h" />
     <ClInclude Include="LoginDlg.h" />
     <ClInclude Include="MainDlg.h" />
     <ClInclude Include="resource.h" />

+ 33 - 0
SProxy/SProxy.vcxproj.filters

@@ -29,6 +29,9 @@
     <Filter Include="Model">
       <UniqueIdentifier>{888c495a-cd33-4d46-98fe-0e8b624ae3c0}</UniqueIdentifier>
     </Filter>
+    <Filter Include="clash">
+      <UniqueIdentifier>{4f60341f-54b7-4ecc-a880-6094416f6b09}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <Text Include="license.txt" />
@@ -80,6 +83,21 @@
     <ClCompile Include="FileOperate.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="IBaseClash.cpp">
+      <Filter>clash</Filter>
+    </ClCompile>
+    <ClCompile Include="CProcess.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="CLashConfig.cpp">
+      <Filter>clash</Filter>
+    </ClCompile>
+    <ClCompile Include="CTool.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="Logger.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="SProxy.rc">
@@ -138,6 +156,21 @@
     <ClInclude Include="FileOperate.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="IBaseClash.h">
+      <Filter>clash</Filter>
+    </ClInclude>
+    <ClInclude Include="CProcess.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="CLashConfig.h">
+      <Filter>clash</Filter>
+    </ClInclude>
+    <ClInclude Include="CTool.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="Logger.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="res\soui_res.rc2">

+ 13 - 0
SProxy/comm.h

@@ -1,2 +1,15 @@
 #pragma once
 
+#define CLASHCONFIGDIR "config"
+#define WCLASHCONFIGDIR L"config"
+#define CLASHCONFIGNAME "sysconfig.yml"
+#define WCLASHCONFIGNAME L"sysconfig.yml"
+
+
+#define CLASHCONFIINIT "config.yml"
+
+
+#define CLASHCONFIGTUNNAME "tunconfig.yml"
+
+
+#define CLASHEXE L"syscode.exe"

+ 20 - 0
SProxy/event.h

@@ -16,6 +16,26 @@ public:
 		EventID = EVT_LOGIN
 	};
 
+	int		 status;
+	SStringW msg;
+};
+
+
+
+#define EVT_DOWNLOAD (SOUI::EVT_EXTERNAL_BEGIN + 1001)
+
+class EventDoWNload : public TplEventArgs<EventDoWNload>
+{
+	SOUI_CLASS_NAME(EventDoWNload, L"on_event_download")
+public:
+	EventDoWNload(SOUI::SWindow* pSender) : TplEventArgs<EventDoWNload>(pSender)
+	{
+
+	}
+	enum {
+		EventID = EVT_DOWNLOAD
+	};
+
 	int		 status;
 	SStringW msg;
 };

BIN
SProxy/res/resource.h


BIN
SProxy/res/soui_res.rc2


BIN
SProxy/stdafx.h


BIN
SProxy/uires/image/btn-selection.png


BIN
SProxy/uires/image/btn-switch-off.png


BIN
SProxy/uires/image/btn-switch-on.png


BIN
SProxy/uires/image/default.png


+ 10 - 3
SProxy/uires/uires.idx

@@ -5,8 +5,10 @@
 	</UIDEF>
 	<LAYOUT>
 		<file name="XML_MAINWND" path="xml\dlg_main.xml" />
-    <file name="XML_LOGIN" path="xml\dlg_login.xml" />
-    <file name="tabtype_control" path="xml\tabtype_control.xml"/>
+		<file name="XML_LOGIN" path="xml\dlg_login.xml" />
+		<file name="tabtype_control" path="xml\tabtype_control.xml"/>
+	    <file name="XML_PAGEHOME" path="xml\page_home.xml"/>
+	    <file name="XML_NODE" path="xml\page_node.xml"/>
 	</LAYOUT>
 	<values>
 		<file name="string" path="values\string.xml" />
@@ -23,7 +25,12 @@
     <file name="line-2" path="image\line-2.png"/>
     <file name="user" path="image\user.png"/>
     <file name="password" path="image\password.png"/>
-      <file name="tyte_selection" path="image\tyte_selection.png"/>
+    <file name="tyte_selection" path="image\tyte_selection.png"/>
+	<file name="btn-switch-off" path="image\btn-switch-off.png"/>
+    <file name="btn-switch-on" path="image\btn-switch-on.png"/>
+	<file name="default" path="image\default.png"/>
+	<file name="btn-selection" path="image\btn-selection.png"/>
+	<file name="btn-back" path="image\btn-back.png"/>
   </IMG>
 	<ICON>
 		<file name="ICON_LOGO" path="image\soui.ico" />

+ 5 - 0
SProxy/uires/values/skin.xml

@@ -10,5 +10,10 @@
 	<imglist name="skin_user" src="img:user"/>
 	<imglist name="skin_password" src="img:password"/>
 	<imglist name="skin_tyteselection" src="img:tyte_selection" states="3"/>
+	<imglist name="skin_btnswitchoff" src="img:btn-switch-off" states="4"/>
+	<imglist name="skin_btnswitchon" src="img:btn-switch-on" states="4"/>
+	<imglist name="skin_default" src="img:default" />
+	<imglist name="skin_btnselection" src="img:btn-selection" states="4"/>
+	<imglist name="skin_btnback" src="img:btn-back"  states="4"/>
 	<vscrollbar name="skin.common.vscroll" src="IMG:ID_DEF_VSCROLL" states="3" margin="3" hasgripper="0"/> 
 </skin>

+ 10 - 9
SProxy/uires/xml/dlg_main.xml

@@ -2,17 +2,18 @@
 appWnd="1"
 >
   <root skin="bg-home_png" cache="1">
-    <caption pos="0,0,-0,30" show="1" font="adding:0">
-      <text pos="29,9">@string/title</text>
-      <imgbtn name="btn_close" skin="_skin.sys.btn.close"    pos="-45,0" tip="close" animate="1"/>
-    </caption>
- 
-    <window pos="5,[2,-5,-5">
 
+    <tabctrl name="tabmain" size="-2,-2" extend="0,0,0,0" colorBkgnd="" interpolator="Decelerate" curSel="0" focusable="0" animateSteps="30" animateType="1" tabHeight="0" tabSkin="" text-y="" iconSkin="" icon-x="" colorTextHover="#ff0000" fontHover="italic:1">
+      <page>
+        <include src="layout:XML_PAGEHOME"/>
+      </page>
+      
+      <page>
+        <include src="layout:XML_NODE"/>
+      </page>
 
-    </window>
+    </tabctrl>
 
-
-     <shellnotifyicon id="110" menu="SMENU:menu_tray" ico="ICON_LOGO:16" tip="退出"/>
+     <shellnotifyicon id="110" menu="SMENU:menu_tray" ico="ICON_LOGO:16"/>
   </root>
 </SOUI>

+ 48 - 0
SProxy/uires/xml/page_home.xml

@@ -0,0 +1,48 @@
+    
+    <include>
+            <caption pos="0,0,-0,30" show="1" font="adding:0">
+            <text pos="29,9">@string/title</text>
+            <imgbtn name="btn_close" skin="_skin.sys.btn.close"    pos="-45,0" tip="close" animate="1"/>
+            </caption>
+        
+            <window pos="5,[2,-5,-5">
+            <window size="-2,-2" layout="vbox" gravity="center" >
+                <window size="-2,-1" layout="vbox"   gravity="left"  extend="0,30,0,0">
+                    <text name="edit_username" extend="35,0,0,0" colorText="#ffffff">用户名</text>
+                    <img skin="skin_line" extend="35,10,0,0"/>
+                    <text name="edit_username" extend="35,10,0,0" colorText="#ffffff">到期时间</text>
+                    <img skin="skin_line" extend="35,10,0,0"/>
+                    <text name="edit_username" extend="35,10,0,0" colorText="#ffffff">用户流量</text>
+                    <img skin="skin_line" extend="35,10,0,0"/>
+                    <window size="-2,-1" layout="hbox"   gravity="center"  extend="0,10,0,0">
+                            <link name="edit_username" extend="35,0,0,0" colorText="#ffffff">使用教程</link>
+                            <link name="edit_username" extend="35,0,0,0" colorText="#ffffff">充值续费</link>
+                    </window>
+                    <img skin="skin_line" extend="35,10,0,0"/>
+                </window>
+
+                
+                <window size="-2,-1" layout="vbox"   gravity="center"  extend="0,20,0,0">
+                    <text name="text_touch" colorText="#ffffff88" font="adding:5,bold:1" extend="0,0,0,0" >消息</text>
+                    <imgbtn name="connect_touch" skin="skin_btnswitchoff" extend="0,11,0,0" tip="Touch to connect" animate="1"/>
+
+                </window>
+
+                    <window name="selectnode" size="230,59" layout="hbox"  skin="skin_btnselection"  gravity="center" extend="0,10,0,0"> 
+                            <img skin="skin_default" extend="10,0,0,0"/>
+                            <text name="node_name" colorText="#D8D8D8"  extend="5,0,0,0" font="adding:5,bold:1">切换服务器</text>
+                            <text name="node_delay" colorText="#D8D8D8" extend="15,0,0,0" ></text>
+                    </window>
+
+
+                <tabtypecontrol name="sysmode" size="400,45" gravity="center" extend="47,25,44,0"/>
+                <tabtypecontrol name="routemode" size="400,45" gravity="center" extend="47,5,44,0"/>
+
+                <window size="220,10" layout="vbox" gravity="center" extend="0,15,0,0">     
+                    <link name="app_version" colorText="#707070"  extend="5,0,0,0" >版本号:1.0.0</link> 
+                </window>
+                
+            </window>
+
+            </window>
+    </include>

+ 59 - 0
SProxy/uires/xml/page_node.xml

@@ -0,0 +1,59 @@
+<include>
+  <caption pos="0,0,-0,99" show="1" font="adding:0">
+  
+      <imgbtn name="list_back" skin="skin_btnback" pos="15,30" tip="Back to Home" animate="1"/>
+      
+
+      <text pos="[100,38" colorText="#ffffff88" font="adding:5,bold:1" >选择节点</text>
+ 
+    </caption>
+    <window pos="5,[2,-5,-5">
+         <window size="-2,-2" layout="vbox" gravity="center"  extend="0,0,0,0">
+
+                 <!-- <window name="nodeclass" size="-2,51" layout="hbox"  skin="skin_group"  gravity="center" extend="0,0,0,0"> 
+                          <radio2 size="0,-1" name="" colorTextPush="#D8D8D8" colorText="#D8D8D844" font="adding:12,bold:1" checked="1" skin="skin_tyteselection" align="center" weight="1" extend="0,0,0,0" >US</radio2>
+                         <radio2 size="0,-1" name="" colorTextPush="#D8D8D8" colorText="#D8D8D844" font="adding:12,bold:1" checked="0" skin="skin_tyteselection" align="center"  weight="1" extend="5,0,0,0"  >ES</radio2>
+                         <radio2 size="0,-1" name="" colorTextPush="#D8D8D8" colorText="#D8D8D844" font="adding:12,bold:1" checked="0" skin="skin_tyteselection"  align="center" weight="1" extend="5,0,0,0"  >AC</radio2>
+                         <radio2 size="0,-1" name="" colorTextPush="#D8D8D8" colorText="#D8D8D844" font="adding:12,bold:1" checked="0" skin="skin_tyteselection"  align="center" weight="1" extend="5,0,0,0"  >AC</radio2>
+                         <radio2 size="0,-1" name="" colorTextPush="#D8D8D8" colorText="#D8D8D844" font="adding:12,bold:1" checked="0" skin="skin_tyteselection"  align="center" weight="1" extend="5,0,0,0"  >AC</radio2>  
+                </window> -->
+                 
+                <!-- <tabtypecontrol name="nodeclass" size="400,45" gravity="center" extend="5,0,0,5"/> -->
+            
+                <window size="-2,0" weight="1.5" layout="hbox"  gravity="center" extend="0,0,0,0">
+
+                  <listview size="-2,-2" colorBkgnd="" extend="5,5,5,15" name="nodelistview" dividerSize="15" wantTab="1" sbSkin="skin.common.vscroll" hotTrack="1" > 
+									<template itemHeight="46" color="#D8D8D8"  colorHover="#D8D8D844" colorSelected="#D8D8D844" trackMouseEvent="1">
+										<window size="-2,-2" layout="hbox" colorBkgnd="">
+											<window size="0,-2" weight="2.5" layout="hbox" gravity="center" extend="10,0,0,0">
+
+                        <img skin="skin_default" size="43,23" extend="5,0,0,0"/>
+
+												<text name="servername" size="100,23" extend="10,0,0,0" colorText="#D8D8D8" dotted="1" >US 01</text>
+											</window>
+                      <window size="0,-2" weight="2" layout="hbox" gravity="center" extend="10,0,0,0">
+												<text name="serverms" pos="5,5" colorText="#D8D8D8" > 0 ms</text>
+											</window>
+
+											<!-- <window size="0,-2" weight="2" layout="hbox" gravity="center" extend="10,0,0,0">
+												<text name="serverms" pos="5,5" colorText="#D8D8D8" > 0 ms</text>
+											</window>
+
+                      <window size="0,-2" weight="2" layout="hbox" gravity="center" extend="10,0,0,0">
+												<text name="servercount" pos="5,5" colorText="#D8D8D8" > 0</text>
+											</window> -->
+
+
+										</window>
+									</template>
+								</listview>
+
+                </window>
+
+                <window size="-2,0" weight="0.2" layout="vbox"  gravity="center" extend="0,0,0,0">
+                    <imgbtn name="start_Acc" skin="skin_btnborder"  colorText="#A79BB8" font="adding:12,bold:1"  extend="0,0,0,0">开始加速</imgbtn>
+                </window>
+         </window>
+       
+    </window>
+</include>

+ 15 - 5
__INCLUDE/AsynFunctionT.hpp

@@ -60,9 +60,12 @@ public:
 		{
 			CloseHandle(m_phThread[i]);
 		}
-		delete[] m_phThread;
-		m_phThread = NULL;
-		DeleteCriticalSection(&m_csLock);
+		if (m_phThread) {
+			delete[] m_phThread;
+			m_phThread = NULL;
+			DeleteCriticalSection(&m_csLock);
+		}
+		
 	}
 
 public:
@@ -101,10 +104,17 @@ public:
 		//SetEvent(m_hListEvent);
 		ReleaseSemaphore(m_hSemaphore, m_nThreadCount, NULL);
 		//	
-		for (unsigned int i=0; i<m_nThreadCount; ++i)
+		for (unsigned int i = 0; i < m_nThreadCount; ++i)
 		{
-			WaitForSingleObject(m_hThread[i], dwWait);
+			WaitForSingleObject(m_phThread[i], dwWait);
+			 
 		}
+	 
+
+		/*for (unsigned int i = 0; i < m_nThreadCount; ++i)
+		{
+			WaitForSingleObject(m_hThread[i], dwWait);
+		}*/
 	}
 protected:
 	unsigned int Handle()

BIN
__bin/x64/Debug/config/Country.mmdb


BIN
__bin/x64/Debug/config/syscode.exe


BIN
__bin/x64/Debug/config/wintun.dll