mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-25 02:49:52 +03:00
Cedar, Mayaqua: Set minimum Windows version to Vista
This commit is contained in:
parent
a79f91161f
commit
5cab279a8c
@ -466,11 +466,6 @@ bool EnumEthVLanWin32(RPC_ENUM_ETH_VLAN *t)
|
||||
|
||||
Zero(t, sizeof(RPC_ENUM_ETH_VLAN));
|
||||
|
||||
if (MsIsWin2000OrGreater() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsEthSupported() == false)
|
||||
{
|
||||
return false;
|
||||
@ -1488,7 +1483,7 @@ LIST *GetEthAdapterListInternal()
|
||||
|
||||
i = 0;
|
||||
|
||||
if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType))
|
||||
if (true)
|
||||
{
|
||||
// Windows NT
|
||||
if (size >= 2 && buf[0] != 0 && buf[1] != 0)
|
||||
@ -1526,7 +1521,6 @@ LIST *GetEthAdapterListInternal()
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows 9x
|
||||
ANSI_STR:
|
||||
while (true)
|
||||
{
|
||||
@ -1564,18 +1558,6 @@ ANSI_STR:
|
||||
StrCpy(a->Title, sizeof(a->Title), &buf[i]);
|
||||
i += StrSize(a->Title);
|
||||
|
||||
// If device description is "Unknown" in Win9x, skip 1 byte
|
||||
if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType))
|
||||
{
|
||||
if (StrCmp(a->Title, "Unknown") == 0)
|
||||
{
|
||||
if (buf[i] == 0)
|
||||
{
|
||||
i+=sizeof(char);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TrimCrlf(a->Title);
|
||||
Trim(a->Title);
|
||||
TrimCrlf(a->Title);
|
||||
@ -1790,31 +1772,7 @@ bool IsEthSupportedInner()
|
||||
// Is the PCD driver supported in current OS
|
||||
bool IsPcdSupported()
|
||||
{
|
||||
UINT type;
|
||||
OS_INFO *info = GetOsInfo();
|
||||
|
||||
if (MsIsWindows10())
|
||||
{
|
||||
// Windows 10 or later never supports PCD driver.
|
||||
return false;
|
||||
}
|
||||
|
||||
type = info->OsType;
|
||||
|
||||
if (OS_IS_WINDOWS_NT(type) == false)
|
||||
{
|
||||
// Only on Windows NT series
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GET_KETA(type, 100) >= 2)
|
||||
{
|
||||
// Good for Windows 2000 or later
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not good for Windows NT 4.0 or Longhorn
|
||||
return false;
|
||||
return !MsIsWindows10();
|
||||
}
|
||||
|
||||
// Save build number of PCD driver
|
||||
@ -2085,8 +2043,7 @@ void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name)
|
||||
UniStrCpy(dst, size, L"");
|
||||
|
||||
// Validate arguments
|
||||
if (device_name == NULL || IsEthSupported() == false ||
|
||||
IsNt() == false || MsIsWin2000OrGreater() == false)
|
||||
if (device_name == NULL || IsEthSupported() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
197
src/Cedar/CM.c
197
src/Cedar/CM.c
@ -13,8 +13,8 @@
|
||||
#define SM_C
|
||||
#define MICROSOFT_C
|
||||
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#define SECURITY_WIN32
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
@ -232,14 +232,7 @@ UINT CmGetSecureBitmapId(char *dest_hostname)
|
||||
// Activate the window of UAC
|
||||
void CmSetUacWindowActive()
|
||||
{
|
||||
HWND hWnd;
|
||||
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hWnd = FindWindowA("$$$Secure UAP Dummy Window Class For Interim Dialog", NULL);
|
||||
HWND hWnd = FindWindowA("$$$Secure UAP Dummy Window Class For Interim Dialog", NULL);
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
return;
|
||||
@ -1485,22 +1478,8 @@ void CmTrafficRunDlgAddStr(HWND hWnd, wchar_t *str)
|
||||
UniReplaceStrEx(tmp, tmp_size, tmp, L"\r\n", L"\n", false);
|
||||
UniReplaceStrEx(tmp, tmp_size, tmp, L"\n", L"\r\n", false);
|
||||
|
||||
if (MsIsNt())
|
||||
{
|
||||
SendMsg(hWnd, E_EDIT, EM_SETSEL, 0x7fffffff, 0x7fffffff);
|
||||
SendMsg(hWnd, E_EDIT, EM_REPLACESEL, false, (LPARAM)tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *s = CopyUniToStr(tmp);
|
||||
UINT len;
|
||||
|
||||
len = GetWindowTextLength(DlgItem(hWnd, E_EDIT));
|
||||
SendMsg(hWnd, E_EDIT, EM_SETSEL, 0x7fffffff, 0x7fffffff);
|
||||
SendMsg(hWnd, E_EDIT, EM_SETSEL, len, len);
|
||||
SendMsg(hWnd, E_EDIT, EM_REPLACESEL, false, (LPARAM)s);
|
||||
Free(s);
|
||||
}
|
||||
|
||||
Free(tmp);
|
||||
}
|
||||
@ -3568,11 +3547,6 @@ bool CmStopInstallVLan(HWND hWnd)
|
||||
// There is no need to be prohibited if the client is an UNIX
|
||||
return true;
|
||||
}
|
||||
if (cm->Client->Win9x)
|
||||
{
|
||||
// There is no need to prohibit if the client is a Win9x
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -5474,27 +5448,12 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
|
||||
name = CmNewVLanDlg(hWnd);
|
||||
if (name != NULL)
|
||||
{
|
||||
wchar_t tmp[MAX_SIZE];
|
||||
void *helper = NULL;
|
||||
RPC_CLIENT_CREATE_VLAN c;
|
||||
Zero(&c, sizeof(c));
|
||||
StrCpy(c.DeviceName, sizeof(c.DeviceName), name);
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
// Change the title of the window
|
||||
GetTxt(hWnd, 0, tmp, sizeof(tmp));
|
||||
SetText(hWnd, 0, _UU("CM_VLAN_INSTALLING"));
|
||||
}
|
||||
// Minimize
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
ShowWindow(hWnd, SW_SHOWMINIMIZED);
|
||||
}
|
||||
|
||||
if (MsIsVista())
|
||||
{
|
||||
helper = CmStartUacHelper();
|
||||
}
|
||||
|
||||
if (CALL(hWnd, CcCreateVLan(cm->Client, &c)))
|
||||
{
|
||||
@ -5503,16 +5462,6 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
|
||||
|
||||
CmStopUacHelper(helper);
|
||||
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
// Restore the title of the window
|
||||
SetText(hWnd, 0, tmp);
|
||||
}
|
||||
// Restore
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
ShowWindow(hWnd, SW_SHOWNORMAL);
|
||||
}
|
||||
Free(name);
|
||||
|
||||
CmRefresh(hWnd);
|
||||
@ -5522,8 +5471,6 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
|
||||
// Delete the Virtual LAN card
|
||||
index = LvGetSelected(hWnd, L_VLAN);
|
||||
if (index != INFINITE)
|
||||
{
|
||||
if (cm->Client->Win9x == false)
|
||||
{
|
||||
// Windows 2000 or later
|
||||
wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 0);
|
||||
@ -5546,16 +5493,6 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
|
||||
}
|
||||
Free(s);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows 9x
|
||||
if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("CM_9X_VLAN_UNINSTALL")) == IDYES)
|
||||
{
|
||||
Run("rundll32.exe", "shell32.dll,Control_RunDLL NETCPL.CPL",
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
|
||||
CmRefresh(hWnd);
|
||||
}
|
||||
@ -5629,26 +5566,11 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
|
||||
UniToStr(str, sizeof(str), s);
|
||||
if (CmPrintNameToVLanName(c.DeviceName, sizeof(c.DeviceName), str))
|
||||
{
|
||||
void *helper = NULL;
|
||||
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
ShowWindow(hWnd, SW_SHOWMINIMIZED);
|
||||
}
|
||||
|
||||
if (MsIsVista())
|
||||
{
|
||||
helper = CmStartUacHelper();
|
||||
}
|
||||
void *helper = CmStartUacHelper();
|
||||
|
||||
CALL(hWnd, CcUpgradeVLan(cm->Client, &c));
|
||||
|
||||
CmStopUacHelper(helper);
|
||||
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
ShowWindow(hWnd, SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
Free(s);
|
||||
|
||||
@ -5720,11 +5642,7 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
|
||||
break;
|
||||
case CMD_MMCSS:
|
||||
// Optimization utility for Windows Vista
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
MsgBox(hWnd, MB_ICONINFORMATION, _UU("VISTA_MMCSS_MSG_4"));
|
||||
}
|
||||
else
|
||||
if (true)
|
||||
{
|
||||
if (MsIsAdmin() == false)
|
||||
{
|
||||
@ -5792,7 +5710,6 @@ void CmConfigDlgInit(HWND hWnd)
|
||||
{
|
||||
bool use_alpha;
|
||||
UINT alpha_value;
|
||||
UINT os;
|
||||
CLIENT_CONFIG c;
|
||||
// Validate arguments
|
||||
if (hWnd == NULL)
|
||||
@ -5827,15 +5744,7 @@ void CmConfigDlgInit(HWND hWnd)
|
||||
SetInt(hWnd, E_ALPHA_VALUE, alpha_value == 0 ? 50 : alpha_value);
|
||||
Check(hWnd, R_ALPHA, use_alpha);
|
||||
|
||||
os = GetOsInfo()->OsType;
|
||||
if (OS_IS_WINDOWS_NT(os) && GET_KETA(os, 100) >= 2)
|
||||
{
|
||||
Enable(hWnd, R_ALPHA);
|
||||
}
|
||||
else
|
||||
{
|
||||
Disable(hWnd, R_ALPHA);
|
||||
}
|
||||
|
||||
CmConfigDlgRefresh(hWnd);
|
||||
}
|
||||
@ -6437,8 +6346,8 @@ UINT CmNewVLanDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *p
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
LimitText(hWnd, E_NAME, cm->Client->Win9x ? MAX_DEVICE_NAME_LEN_9X : MAX_DEVICE_NAME_LEN);
|
||||
FormatText(hWnd, S_INFO, cm->Client->Win9x ? MAX_DEVICE_NAME_LEN_9X : MAX_DEVICE_NAME_LEN);
|
||||
LimitText(hWnd, E_NAME, MAX_DEVICE_NAME_LEN);
|
||||
FormatText(hWnd, S_INFO, MAX_DEVICE_NAME_LEN);
|
||||
|
||||
Zero(&ver, sizeof(ver));
|
||||
|
||||
@ -6463,15 +6372,7 @@ UINT CmNewVLanDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *p
|
||||
switch (wParam)
|
||||
{
|
||||
case IDOK:
|
||||
if (cm->Client->Win9x)
|
||||
{
|
||||
// For Windows 9x, show a confirmation message
|
||||
if (MsgBox(hWnd, MB_ICONQUESTION | MB_OKCANCEL, _UU("CM_9X_VLAN_INSTALL")) == IDCANCEL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
GetTxtA(hWnd, E_NAME, tmp, (cm->Client->Win9x ? MAX_DEVICE_NAME_LEN_9X : MAX_DEVICE_NAME_LEN) + 1);
|
||||
GetTxtA(hWnd, E_NAME, tmp, MAX_DEVICE_NAME_LEN + 1);
|
||||
Trim(tmp);
|
||||
|
||||
if (CcGetClientVersion(cm->Client, &ver) == ERR_NO_ERROR)
|
||||
@ -9933,30 +9834,6 @@ void CmConnect(HWND hWnd, wchar_t *account_name)
|
||||
return;
|
||||
}
|
||||
|
||||
if (hWnd == cm->hMainWnd)
|
||||
{
|
||||
if (LvNum(hWnd, L_VLAN) == 0 && cm->Client->Win9x)
|
||||
{
|
||||
if (MsgBox(hWnd, MB_ICONINFORMATION | MB_YESNO, _UU("CM_NO_VLAN_2")) == IDNO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cm->server_name == NULL || cm->Client->Unix)
|
||||
{
|
||||
Command(hWnd, CMD_NEW_VLAN);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_VLAN_REMOTE_ERROR"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// (If necessary) display a warning
|
||||
if (CmWarningDesktop(hWnd, account_name) == false)
|
||||
{
|
||||
@ -10095,7 +9972,7 @@ bool CmIsEnabled(HWND hWnd, UINT id)
|
||||
switch (id)
|
||||
{
|
||||
case CMD_LANGUAGE:
|
||||
return MsIsNt();
|
||||
return true;
|
||||
case CMD_SHOWPORT:
|
||||
case CMD_GRID:
|
||||
if (cm->IconView)
|
||||
@ -10104,7 +9981,7 @@ bool CmIsEnabled(HWND hWnd, UINT id)
|
||||
}
|
||||
return true;
|
||||
case CMD_MMCSS:
|
||||
if (MsIsVista() == false || IsEmptyStr(cm->server_name) == false)
|
||||
if (IsEmptyStr(cm->server_name) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -10115,12 +9992,7 @@ bool CmIsEnabled(HWND hWnd, UINT id)
|
||||
return true;
|
||||
case CMD_TRAYICON:
|
||||
case CMD_TRAFFIC:
|
||||
return (cm->server_name == NULL);
|
||||
case CMD_NETIF:
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (cm->server_name == NULL);
|
||||
case CMD_CM_SETTING:
|
||||
return cm->CmSettingSupported;
|
||||
@ -10257,21 +10129,11 @@ bool CmIsEnabled(HWND hWnd, UINT id)
|
||||
}
|
||||
break;
|
||||
case CMD_NEW_VLAN:
|
||||
if (cm->Client->Unix == false && cm->Client->Win9x == false)
|
||||
{
|
||||
if (cm->server_name != NULL)
|
||||
if (cm->Client->Unix == false && cm->server_name != NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (cm->Client->Win9x)
|
||||
{
|
||||
if (LvNum(hWnd, L_VLAN) >= 1)
|
||||
{
|
||||
// You can not install two or more virtual LAN cards in Win9x
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case CMD_PROPERTY:
|
||||
name = LvGetSelectedStr(hWnd, L_ACCOUNT, 0);
|
||||
@ -10296,10 +10158,6 @@ bool CmIsEnabled(HWND hWnd, UINT id)
|
||||
}
|
||||
return LvIsSelected(hWnd, L_VLAN);
|
||||
case CMD_ENABLE_VLAN:
|
||||
if (cm->Client->Win9x)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (LvIsMultiMasked(hWnd, L_VLAN))
|
||||
{
|
||||
return false;
|
||||
@ -10325,10 +10183,6 @@ bool CmIsEnabled(HWND hWnd, UINT id)
|
||||
}
|
||||
break;
|
||||
case CMD_DISABLE_VLAN:
|
||||
if (cm->Client->Win9x)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (LvIsMultiMasked(hWnd, L_VLAN))
|
||||
{
|
||||
return false;
|
||||
@ -10358,7 +10212,7 @@ bool CmIsEnabled(HWND hWnd, UINT id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (cm->Client->Win9x || cm->Client->Unix)
|
||||
if (cm->Client->Unix)
|
||||
{
|
||||
// Upgrading the virtual LAN card on a UNIX system or Win9x is unavailable
|
||||
return false;
|
||||
@ -10369,24 +10223,7 @@ bool CmIsEnabled(HWND hWnd, UINT id)
|
||||
}
|
||||
return LvIsSelected(hWnd, L_VLAN);
|
||||
case CMD_WINNET:
|
||||
{
|
||||
UINT os_type = GetOsInfo()->OsType;
|
||||
|
||||
if (OS_IS_WINDOWS_NT(os_type) && GET_KETA(os_type, 100) >= 2)
|
||||
{
|
||||
if (cm->server_name != NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
return (cm->server_name == NULL);
|
||||
case CMD_EXIT:
|
||||
return cm->TrayInited;
|
||||
}
|
||||
@ -11274,7 +11111,7 @@ void CmMainWindowOnInit(HWND hWnd)
|
||||
}
|
||||
else
|
||||
{
|
||||
cm->VistaStyle = MsIsVista();
|
||||
cm->VistaStyle = true;
|
||||
}
|
||||
|
||||
if (MsRegIsValue(REG_CURRENT_USER, CM_REG_KEY, "ShowPort"))
|
||||
@ -12078,10 +11915,6 @@ RETRY:
|
||||
{
|
||||
cm->CmSettingSupported = true;
|
||||
cm->CmEasyModeSupported = true;
|
||||
if (OS_IS_WINDOWS_9X(a.OsType))
|
||||
{
|
||||
cm->CmEasyModeSupported = false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -118,7 +118,6 @@
|
||||
#define MAX_SESSION_NAME_LEN 255 // Session name maximum length
|
||||
#define MAX_CONNECTION_NAME_LEN 255 // Maximum length of connection name
|
||||
#define MAX_DEVICE_NAME_LEN 31 // Device name maximum length
|
||||
#define MAX_DEVICE_NAME_LEN_9X 4 // Maximum length of Virtual LAN card name in Win9x
|
||||
#define MAX_ACCESSLIST_NOTE_LEN 255 // Maximum length of the note of access list entry
|
||||
#define MAX_SECURE_DEVICE_FILE_LEN 255 // Secure device file name maximum length
|
||||
#define MAX_ADMIN_OPTION_NAME_LEN 63 // Management option name
|
||||
|
@ -1108,11 +1108,7 @@ void Win32CnNicInfoThreadProc(THREAD *thread, void *param)
|
||||
return;
|
||||
}
|
||||
|
||||
if (MsIsNt())
|
||||
{
|
||||
// Do not show a dialog on Windows 9x system
|
||||
NicInfo(info);
|
||||
}
|
||||
|
||||
Disconnect(info->Sock);
|
||||
}
|
||||
@ -1370,10 +1366,7 @@ void Win32CnExecDriverInstaller(SOCK *s, PACK *p)
|
||||
return;
|
||||
}
|
||||
|
||||
if (MsIsVista())
|
||||
{
|
||||
helper = CmStartUacHelper();
|
||||
}
|
||||
|
||||
ret = MsExecDriverInstaller(arg);
|
||||
|
||||
@ -5725,7 +5718,6 @@ L_TRY:
|
||||
CcGetClientVersion(ret, &t);
|
||||
ret->OsType = t.OsType;
|
||||
ret->Unix = OS_IS_UNIX(ret->OsType);
|
||||
ret->Win9x = OS_IS_WINDOWS_9X(ret->OsType);
|
||||
ret->IsVgcSupported = t.IsVgcSupported;
|
||||
ret->ShowVgcLink = t.ShowVgcLink;
|
||||
StrCpy(ret->ClientId, sizeof(ret->ClientId), t.ClientId);
|
||||
@ -6282,18 +6274,13 @@ bool CtConnect(CLIENT *c, RPC_CLIENT_CONNECT *connect)
|
||||
{
|
||||
if (t.NumItem == 0)
|
||||
{
|
||||
// There are no virtual LAN cards in the system
|
||||
if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) || OS_IS_UNIX(GetOsInfo()->OsType))
|
||||
{
|
||||
// Only in Linux system or Windows NT system,
|
||||
// create a new virtual LAN card which named as "VPN" automatically
|
||||
// Create a new virtual LAN card named "VPN" automatically
|
||||
RPC_CLIENT_CREATE_VLAN t;
|
||||
|
||||
Zero(&t, sizeof(t));
|
||||
StrCpy(t.DeviceName, sizeof(t.DeviceName), "VPN");
|
||||
CtCreateVLan(c, &t);
|
||||
}
|
||||
}
|
||||
|
||||
CiFreeClientEnumVLan(&t);
|
||||
}
|
||||
@ -7641,13 +7628,6 @@ bool CtDeleteVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *d)
|
||||
|
||||
#else // OS_WIN32
|
||||
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
// Not available in Win9x
|
||||
CiSetError(c, ERR_NOT_SUPPORTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check whether the virtual LAN card are present
|
||||
if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, d->DeviceName) == false &&
|
||||
MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, d->DeviceName) == false)
|
||||
@ -8022,7 +8002,6 @@ bool CtUpgradeVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
|
||||
bool use_old_name = false;
|
||||
|
||||
#ifdef OS_WIN32
|
||||
KAKUSHI *k = NULL;
|
||||
MS_DRIVER_VER ver;
|
||||
#endif // OS_WIN32
|
||||
|
||||
@ -8042,13 +8021,6 @@ bool CtUpgradeVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
|
||||
|
||||
CiInitDriverVerStruct(&ver);
|
||||
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
// Not available in Win9x
|
||||
CiSetError(c, ERR_NOT_SUPPORTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check whether the LAN card with the specified name already exists
|
||||
if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, create->DeviceName) == false &&
|
||||
MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, create->DeviceName) == false)
|
||||
@ -8065,46 +8037,18 @@ bool CtUpgradeVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
|
||||
use_old_name = true;
|
||||
}
|
||||
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
k = InitKakushi();
|
||||
}
|
||||
|
||||
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
// Perform the installation (other than Windows Vista)
|
||||
if (MsUpgradeVLan(use_old_name ? VLAN_ADAPTER_NAME_TAG_OLD : VLAN_ADAPTER_NAME_TAG,
|
||||
use_old_name ? VLAN_CONNECTION_NAME_OLD : VLAN_CONNECTION_NAME,
|
||||
create->DeviceName, &ver) == false)
|
||||
{
|
||||
// Installation Failed
|
||||
FreeKakushi(k);
|
||||
CiSetError(c, ERR_VLAN_INSTALL_ERROR);
|
||||
CiNotify(c);
|
||||
CiSendGlobalPulse(c);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Perform the installation (Windows Vista)
|
||||
// Perform the installation
|
||||
char tmp[MAX_SIZE];
|
||||
|
||||
Format(tmp, sizeof(tmp), "upgradevlan %s", create->DeviceName);
|
||||
|
||||
if (CncExecDriverInstaller(tmp) == false)
|
||||
{
|
||||
// Installation Failed
|
||||
FreeKakushi(k);
|
||||
CiSetError(c, ERR_VLAN_INSTALL_ERROR);
|
||||
CiNotify(c);
|
||||
CiSendGlobalPulse(c);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
FreeKakushi(k);
|
||||
|
||||
CLog(c, "LC_UPDATE_VLAN", create->DeviceName);
|
||||
|
||||
@ -8122,10 +8066,6 @@ bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
|
||||
TOKEN_LIST *t;
|
||||
UINT max_len;
|
||||
|
||||
#ifdef OS_WIN32
|
||||
KAKUSHI *k = NULL;
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Validate arguments
|
||||
if (c == NULL || create == NULL)
|
||||
{
|
||||
@ -8206,25 +8146,6 @@ bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
|
||||
return true;
|
||||
|
||||
#else // OS_WIN32
|
||||
|
||||
if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType))
|
||||
{
|
||||
// Only one LAN card is available in the Win9x
|
||||
TOKEN_LIST *t;
|
||||
|
||||
t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD);
|
||||
if (t != NULL)
|
||||
{
|
||||
if (t->NumTokens >= 1)
|
||||
{
|
||||
FreeToken(t);
|
||||
CiSetError(c, ERR_NOT_SUPPORTED);
|
||||
return false;
|
||||
}
|
||||
FreeToken(t);
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether the specified name is valid or not
|
||||
if (IsSafeStr(create->DeviceName) == false)
|
||||
{
|
||||
@ -8233,7 +8154,7 @@ bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
|
||||
return false;
|
||||
}
|
||||
|
||||
max_len = MsIsNt() ? MAX_DEVICE_NAME_LEN : MAX_DEVICE_NAME_LEN_9X;
|
||||
max_len = MAX_DEVICE_NAME_LEN;
|
||||
if (StrLen(create->DeviceName) > max_len)
|
||||
{
|
||||
// Name is too long
|
||||
@ -8261,50 +8182,17 @@ bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (MsIsNt())
|
||||
{
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
k = InitKakushi();
|
||||
}
|
||||
}
|
||||
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
MS_DRIVER_VER ver;
|
||||
|
||||
CiInitDriverVerStruct(&ver);
|
||||
|
||||
// Perform the installation (other than Windows Vista)
|
||||
if (MsInstallVLan(VLAN_ADAPTER_NAME_TAG, VLAN_CONNECTION_NAME, create->DeviceName, &ver) == false)
|
||||
{
|
||||
// Installation Failed
|
||||
FreeKakushi(k);
|
||||
CiSetError(c, ERR_VLAN_INSTALL_ERROR);
|
||||
CiNotify(c);
|
||||
CiSendGlobalPulse(c);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Perform the installation (Windows Vista)
|
||||
char tmp[MAX_SIZE];
|
||||
|
||||
Format(tmp, sizeof(tmp), "instvlan %s", create->DeviceName);
|
||||
|
||||
if (CncExecDriverInstaller(tmp) == false)
|
||||
{
|
||||
// Installation Failed
|
||||
FreeKakushi(k);
|
||||
CiSetError(c, ERR_VLAN_INSTALL_ERROR);
|
||||
CiNotify(c);
|
||||
CiSendGlobalPulse(c);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
FreeKakushi(k);
|
||||
|
||||
t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD);
|
||||
if (t->NumTokens == 1)
|
||||
@ -8340,17 +8228,6 @@ bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
|
||||
|
||||
CiSaveConfigurationFile(c);
|
||||
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
if (GetOsInfo()->OsType == OSTYPE_WINDOWS_ME)
|
||||
{
|
||||
// Show the warning in the case of Windows Me
|
||||
MsgBox(NULL, 0x00000040L, _UU("CM_9X_VLAN_ME_MESSAGE"));
|
||||
}
|
||||
|
||||
ReleaseThread(NewThread(Win9xRebootThread, NULL));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
#endif // OS_WIN32
|
||||
@ -9741,12 +9618,7 @@ bool CiReadSettingFromCfg(CLIENT *c, FOLDER *root)
|
||||
UINT ostype = GetOsInfo()->OsType;
|
||||
// CM_SETTING
|
||||
CM_SETTING *s = c->CmSetting;
|
||||
|
||||
if (OS_IS_UNIX(ostype) || OS_IS_WINDOWS_NT(ostype))
|
||||
{
|
||||
s->EasyMode = CfgGetBool(cmsetting, "EasyMode");
|
||||
}
|
||||
|
||||
s->LockMode = CfgGetBool(cmsetting, "LockMode");
|
||||
CfgGetByte(cmsetting, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword));
|
||||
}
|
||||
@ -10432,16 +10304,6 @@ CLIENT *CiNewClient()
|
||||
// Raise the priority
|
||||
OSSetHighPriority();
|
||||
|
||||
|
||||
|
||||
#ifdef OS_WIN32
|
||||
// For Win9x, release the DHCP address of all the virtual LAN card
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
Win32ReleaseAllDhcp9x(true);
|
||||
}
|
||||
#endif // OS_WIN32
|
||||
|
||||
CiChangeAllVLanMacAddressIfMachineChanged(c);
|
||||
|
||||
CiChangeAllVLanMacAddressIfCleared(c);
|
||||
@ -10564,14 +10426,6 @@ void CiCleanupClient(CLIENT *c)
|
||||
|
||||
Free(c);
|
||||
|
||||
#ifdef OS_WIN32
|
||||
// For Win9x, release the DHCP address of all the virtual LAN card
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
Win32ReleaseAllDhcp9x(true);
|
||||
}
|
||||
#endif // OS_WIN32
|
||||
|
||||
StopCedarLog();
|
||||
|
||||
if (ci_active_sessions_lock != NULL)
|
||||
@ -10632,9 +10486,6 @@ void CtStartClient()
|
||||
return;
|
||||
}
|
||||
|
||||
// OS check
|
||||
CiCheckOs();
|
||||
|
||||
#ifdef OS_WIN32
|
||||
RegistWindowsFirewallAll();
|
||||
#endif
|
||||
@ -10754,27 +10605,6 @@ void CtStopClient()
|
||||
client = NULL;
|
||||
}
|
||||
|
||||
// OS check
|
||||
void CiCheckOs()
|
||||
{
|
||||
// Get the OS type
|
||||
OS_INFO *info = GetOsInfo();
|
||||
|
||||
if (OS_IS_WINDOWS(info->OsType))
|
||||
{
|
||||
bool ok = IS_CLIENT_SUPPORTED_OS(info->OsType);
|
||||
|
||||
if (ok == false)
|
||||
{
|
||||
Alert(
|
||||
CEDAR_PRODUCT_STR " VPN Client doesn't support this Windows Operating System.\n"
|
||||
CEDAR_PRODUCT_STR " VPN Client requires Windows 98, Windows Me, Windows 2000, Windows XP, Windows Server 2003 or Greater.\n\n"
|
||||
"Please contact your system administrator.", CEDAR_PRODUCT_STR " VPN Client");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Client status indicator
|
||||
void CiClientStatusPrinter(SESSION *s, wchar_t *status)
|
||||
{
|
||||
|
@ -12,12 +12,6 @@
|
||||
#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
|
||||
|
||||
|
||||
// Check whether the client can run on the specified OS_TYPE
|
||||
#define IS_CLIENT_SUPPORTED_OS(t) \
|
||||
((OS_IS_WINDOWS_NT(t) && GET_KETA(t, 100) >= 2) || (OS_IS_WINDOWS_9X(t)))
|
||||
|
||||
|
||||
// Constants
|
||||
#define CLIENT_CONFIG_FILE_NAME "$vpn_client.config"
|
||||
#define CLIENT_DEFAULT_KEEPALIVE_HOST "keepalive.softether.org"
|
||||
@ -420,7 +414,6 @@ struct REMOTE_CLIENT
|
||||
RPC *Rpc;
|
||||
UINT OsType;
|
||||
bool Unix;
|
||||
bool Win9x;
|
||||
UINT ProcessId;
|
||||
UINT ClientBuildInt;
|
||||
bool IsVgcSupported;
|
||||
@ -643,7 +636,6 @@ void CiFreeGetCa(RPC_GET_CA *a);
|
||||
void CiFreeGetIssuer(RPC_GET_ISSUER *a);
|
||||
void CiFreeClientEnumAccount(RPC_CLIENT_ENUM_ACCOUNT *a);
|
||||
void CiSetError(CLIENT *c, UINT err);
|
||||
void CiCheckOs();
|
||||
CLIENT *CiNewClient();
|
||||
void CiCleanupClient(CLIENT *c);
|
||||
bool CiLoadConfigurationFile(CLIENT *c);
|
||||
|
@ -916,14 +916,7 @@ void VpnCmdInitBootPath()
|
||||
{
|
||||
bool b = false;
|
||||
// Copy the vpncmdsys.exe to system32
|
||||
if (MsIsNt())
|
||||
{
|
||||
Format(tmp, sizeof(tmp), "%s\\vpncmd.exe", MsGetSystem32Dir());
|
||||
}
|
||||
else
|
||||
{
|
||||
Format(tmp, sizeof(tmp), "%s\\vpncmd.exe", MsGetWindowsDir());
|
||||
}
|
||||
|
||||
if (MsIs64BitWindows() == false || Is64())
|
||||
{
|
||||
@ -24700,19 +24693,13 @@ void Win32CmdDebug(bool is_uac)
|
||||
|
||||
UniPrint(_UU("CMD_DEBUG_PRINT"));
|
||||
|
||||
if (MsIsWin2000OrGreater() == false)
|
||||
{
|
||||
MsgBox(NULL, 0x00000040L, _UU("CMD_DEBUG_NOT_2000"));
|
||||
goto LABEL_CLEANUP;
|
||||
}
|
||||
|
||||
if ((MsIsVista() == false || is_uac) && MsIsAdmin() == false)
|
||||
if (is_uac && MsIsAdmin() == false)
|
||||
{
|
||||
MsgBox(NULL, 0x00000040L, _UU("CMD_DEBUG_NOT_ADMIN"));
|
||||
goto LABEL_CLEANUP;
|
||||
}
|
||||
|
||||
if (MsIsVista() && MsIsAdmin() == false)
|
||||
if (MsIsAdmin() == false)
|
||||
{
|
||||
void *process_handle = NULL;
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
#define NM_C
|
||||
#define EM_C
|
||||
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
@ -1120,14 +1120,6 @@ RES_ERROR:
|
||||
return;
|
||||
}
|
||||
|
||||
// Message after the end
|
||||
if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) == false)
|
||||
{
|
||||
// Need to restart the computer
|
||||
MsgBox(hWnd, MB_ICONINFORMATION, _UU("EM_WPCAP_REBOOT1"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Need to restart the service
|
||||
if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("EM_WPCAP_REBOOT2")) == IDNO)
|
||||
{
|
||||
@ -1147,7 +1139,6 @@ RES_ERROR:
|
||||
CALL(hWnd, EcGetBridgeSupport(r, &t2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Main screen
|
||||
void EMMain(RPC *r)
|
||||
|
@ -13,8 +13,8 @@
|
||||
#define CM_C
|
||||
#define NM_C
|
||||
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
|
@ -49,11 +49,6 @@ IPSEC_WIN7 *IPsecWin7Init()
|
||||
|
||||
Debug("IPsecWin7Init()\n");
|
||||
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (MsIsAdmin() == false)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -13,8 +13,8 @@
|
||||
#define CM_C
|
||||
#define NM_C
|
||||
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
@ -834,10 +834,10 @@ void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d)
|
||||
SetFont(hWnd, S_SUFFIX, GetFont("Verdana", 10, false, false, false, false));
|
||||
SetFont(hWnd, E_NEWHOST, GetFont("Verdana", 10, false, false, false, false));
|
||||
|
||||
SetFont(hWnd, E_HOST, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false));
|
||||
SetFont(hWnd, E_IPV4, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false));
|
||||
SetFont(hWnd, E_IPV6, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false));
|
||||
SetFont(hWnd, E_KEY, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 8, false, false, false, false));
|
||||
SetFont(hWnd, E_HOST, GetFont("Verdana", 10, false, false, false, false));
|
||||
SetFont(hWnd, E_IPV4, GetFont("Verdana", 10, false, false, false, false));
|
||||
SetFont(hWnd, E_IPV6, GetFont("Verdana", 10, false, false, false, false));
|
||||
SetFont(hWnd, E_KEY, GetFont("Verdana", 8, false, false, false, false));
|
||||
|
||||
DlgFont(hWnd, IDOK, 0, true);
|
||||
|
||||
@ -1056,7 +1056,6 @@ void SmOpenVpn(HWND hWnd, SM_SERVER *s)
|
||||
UINT SmOpenVpnDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
|
||||
{
|
||||
SM_SERVER *s = (SM_SERVER *)param;
|
||||
char tmp[MAX_SIZE];
|
||||
// Validate arguments
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
@ -1993,14 +1992,7 @@ void SmHubMsgDlgInit(HWND hWnd, SM_EDIT_HUB *s)
|
||||
return;
|
||||
}
|
||||
|
||||
if (MsIsVista())
|
||||
{
|
||||
SetFont(hWnd, E_TEXT, GetMeiryoFont());
|
||||
}
|
||||
else
|
||||
{
|
||||
DlgFont(hWnd, E_TEXT, 11, false);
|
||||
}
|
||||
|
||||
FormatText(hWnd, S_MSG_2, s->HubName);
|
||||
|
||||
@ -8195,7 +8187,7 @@ void SmInstallWinPcap(HWND hWnd, SM_SERVER *s)
|
||||
UniFormat(temp_name, sizeof(temp_name), L"%s\\winpcap_installer.exe", MsGetTempDirW());
|
||||
|
||||
// Read from hamcore
|
||||
buf = ReadDump(MsIsNt() ? "|winpcap_installer.exe" : "|winpcap_installer_win9x.exe");
|
||||
buf = ReadDump("|winpcap_installer.exe");
|
||||
if (buf == NULL)
|
||||
{
|
||||
RES_ERROR:
|
||||
@ -8231,14 +8223,6 @@ RES_ERROR:
|
||||
return;
|
||||
}
|
||||
|
||||
// Message after completed
|
||||
if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) == false)
|
||||
{
|
||||
// Need to restart the computer
|
||||
MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_WPCAP_REBOOT1"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Need to restart the service
|
||||
if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_BRIDGE_WPCAP_REBOOT2")) == IDNO)
|
||||
{
|
||||
@ -8257,7 +8241,6 @@ RES_ERROR:
|
||||
CALL(hWnd, ScTest(s->Rpc, &t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bridge dialog
|
||||
void SmBridgeDlg(HWND hWnd, SM_SERVER *s)
|
||||
@ -8517,14 +8500,14 @@ void SmCreateCertDlgInit(HWND hWnd, SM_CERT *s)
|
||||
}
|
||||
|
||||
// Font
|
||||
SetFont(hWnd, E_CN, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false));
|
||||
SetFont(hWnd, E_O, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false));
|
||||
SetFont(hWnd, E_OU, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false));
|
||||
SetFont(hWnd, E_C, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false));
|
||||
SetFont(hWnd, E_ST, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false));
|
||||
SetFont(hWnd, E_L, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false));
|
||||
SetFont(hWnd, E_SERIAL, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false));
|
||||
SetFont(hWnd, E_EXPIRE, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false));
|
||||
SetFont(hWnd, E_CN, GetFont("Verdana", 0, false, false, false, false));
|
||||
SetFont(hWnd, E_O, GetFont("Verdana", 0, false, false, false, false));
|
||||
SetFont(hWnd, E_OU, GetFont("Verdana", 0, false, false, false, false));
|
||||
SetFont(hWnd, E_C, GetFont("Verdana", 0, false, false, false, false));
|
||||
SetFont(hWnd, E_ST, GetFont("Verdana", 0, false, false, false, false));
|
||||
SetFont(hWnd, E_L, GetFont("Verdana", 0, false, false, false, false));
|
||||
SetFont(hWnd, E_SERIAL, GetFont("Verdana", 0, false, false, false, false));
|
||||
SetFont(hWnd, E_EXPIRE, GetFont("Verdana", 0, false, false, false, false));
|
||||
SetFont(hWnd, C_BITS, GetFont("Verdana", 0, false, false, false, false));
|
||||
|
||||
FocusEx(hWnd, E_CN);
|
||||
@ -18681,7 +18664,6 @@ UINT SmServerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *pa
|
||||
case B_APPLY:
|
||||
{
|
||||
// Apply UDP ports
|
||||
bool ret;
|
||||
LIST* ports;
|
||||
RPC_PORTS t;
|
||||
char tmp[MAX_SIZE];
|
||||
|
189
src/Cedar/SW.c
189
src/Cedar/SW.c
@ -14,8 +14,8 @@
|
||||
#define NM_C
|
||||
#define SW_C
|
||||
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
@ -1188,16 +1188,8 @@ void SwLang1Init(HWND hWnd, SW *sw)
|
||||
UniFormat(tmp, sizeof(tmp), L"%s (%s)", t.TitleEnglish, t.TitleLocal);
|
||||
|
||||
SetText(hWnd, E_CURRENT, tmp);
|
||||
|
||||
if (MsIsVista())
|
||||
{
|
||||
SetFont(hWnd, E_CURRENT, GetMeiryoFontEx(11));
|
||||
}
|
||||
else
|
||||
{
|
||||
DlgFont(hWnd, E_CURRENT, 11, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update of control
|
||||
@ -1239,14 +1231,7 @@ UINT SwLang1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard,
|
||||
case WM_INITDIALOG:
|
||||
LvInitEx2(hWnd, L_LIST, false, true);
|
||||
|
||||
if (MsIsVista())
|
||||
{
|
||||
SetFont(hWnd, L_LIST, GetMeiryoFontEx(12));
|
||||
}
|
||||
else
|
||||
{
|
||||
DlgFont(hWnd, L_LIST, 12, false);
|
||||
}
|
||||
|
||||
LvInsertColumn(hWnd, L_LIST, 0, L"English Name", 250);
|
||||
LvInsertColumn(hWnd, L_LIST, 1, L"Local Name", 250);
|
||||
@ -1276,14 +1261,6 @@ UINT SwLang1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard,
|
||||
break;
|
||||
}
|
||||
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
// Win9x
|
||||
MsgBox(hWnd, MB_ICONSTOP,
|
||||
L"Windows 9x / Me doesn't support multi-language switcing.\r\n\r\nIf you want to switch to another language, please use Windows NT 4.0, 2000 or greater.");
|
||||
break;
|
||||
}
|
||||
|
||||
// Get the current selection
|
||||
id = (UINT)LvGetSelectedParam(hWnd, L_LIST);
|
||||
if (id != 0)
|
||||
@ -1374,8 +1351,6 @@ LABEL_RUN_CHILD_PROCESS:
|
||||
|
||||
// In the case of system mode
|
||||
if (MsIsAdmin() == false)
|
||||
{
|
||||
if (MsIsVista())
|
||||
{
|
||||
if (sw->IsReExecForUac == false)
|
||||
{
|
||||
@ -1402,12 +1377,6 @@ LABEL_RUN_CHILD_PROCESS:
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Jump to guide screen indicating that it is not the Admin in the case of XP or earlier
|
||||
return D_SW_NOT_ADMIN;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start the process if there is a Admin privileges
|
||||
goto LABEL_RUN_CHILD_PROCESS;
|
||||
@ -1506,8 +1475,6 @@ UINT SwUninst1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard
|
||||
|
||||
// In the case of system mode
|
||||
if (MsIsAdmin() == false)
|
||||
{
|
||||
if (MsIsVista())
|
||||
{
|
||||
if (sw->IsReExecForUac == false)
|
||||
{
|
||||
@ -1531,12 +1498,6 @@ UINT SwUninst1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Jump to guide screen indicating that it is not the Admin in the case of XP or earlier
|
||||
return D_SW_NOT_ADMIN;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start the uninstallation if it has Admin privileges
|
||||
return D_SW_PERFORM;
|
||||
@ -1987,7 +1948,7 @@ bool SwUninstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c)
|
||||
|
||||
if (UniIsEmptyStr(svc_title) == false)
|
||||
{
|
||||
if (sw->IsSystemMode && MsIsNt())
|
||||
if (sw->IsSystemMode)
|
||||
{
|
||||
// WinNT and system mode
|
||||
if (MsIsServiceRunning(c->SvcName))
|
||||
@ -2157,17 +2118,7 @@ LABEL_RETRY_1:
|
||||
|
||||
if (UniIsEmptyStr(svc_title) == false)
|
||||
{
|
||||
if (sw->IsSystemMode == false || MsIsNt() == false)
|
||||
{
|
||||
// Win9x or user mode
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
// Remove the Run key from the registry for Win9x
|
||||
MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, c->SvcName);
|
||||
MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, c->SvcName);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (sw->IsSystemMode)
|
||||
{
|
||||
// System mode
|
||||
UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_UNINSTALL_SVC"), svc_title);
|
||||
@ -2437,8 +2388,7 @@ void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c)
|
||||
_UU("SW_LINK_NAME_TCP"),
|
||||
_UU("SW_LINK_NAME_TCP_COMMENT"), false));
|
||||
|
||||
if (MsIsWin2000OrGreater())
|
||||
{
|
||||
|
||||
Add(t->LinkTasks, SwNewLinkTask(MsGetSystem32DirW(), L"services.msc", NULL, L"filemgmt.dll", 0, dir_config_program,
|
||||
_UU("SW_LINK_NAME_SERVICES"),
|
||||
_UU("SW_LINK_NAME_SERVICES_COMMENT"), false));
|
||||
@ -2450,7 +2400,6 @@ void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c)
|
||||
_UU("SW_LINK_NAME_DEBUG"),
|
||||
_UU("SW_LINK_NAME_DEBUG_COMMENT"), false));
|
||||
}
|
||||
}
|
||||
|
||||
if (sw->IsSystemMode == false)
|
||||
{
|
||||
@ -2508,8 +2457,6 @@ void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c)
|
||||
_UU("SW_LINK_NAME_TCP"),
|
||||
_UU("SW_LINK_NAME_TCP_COMMENT"), false));
|
||||
|
||||
if (MsIsWin2000OrGreater())
|
||||
{
|
||||
Add(t->LinkTasks, SwNewLinkTask(MsGetSystem32DirW(), L"services.msc", NULL, L"filemgmt.dll", 0, dir_config_program,
|
||||
_UU("SW_LINK_NAME_SERVICES"),
|
||||
_UU("SW_LINK_NAME_SERVICES_COMMENT"), false));
|
||||
@ -2521,7 +2468,6 @@ void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c)
|
||||
_UU("SW_LINK_NAME_DEBUG"),
|
||||
_UU("SW_LINK_NAME_DEBUG_COMMENT"), false));
|
||||
}
|
||||
}
|
||||
|
||||
if (sw->IsSystemMode == false)
|
||||
{
|
||||
@ -2621,8 +2567,6 @@ void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c)
|
||||
_UU("SW_LINK_NAME_TCP"),
|
||||
_UU("SW_LINK_NAME_TCP_COMMENT"), false));
|
||||
|
||||
if (MsIsWin2000OrGreater())
|
||||
{
|
||||
Add(t->LinkTasks, SwNewLinkTask(MsGetSystem32DirW(), L"services.msc", NULL, L"filemgmt.dll", 0, dir_config_program,
|
||||
_UU("SW_LINK_NAME_SERVICES"),
|
||||
_UU("SW_LINK_NAME_SERVICES_COMMENT"), false));
|
||||
@ -2634,11 +2578,8 @@ void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c)
|
||||
_UU("SW_LINK_NAME_DEBUG"),
|
||||
_UU("SW_LINK_NAME_DEBUG_COMMENT"), false));
|
||||
}
|
||||
}
|
||||
|
||||
// Programs\PacketiX VPN Client\System administrators tool
|
||||
if (MsIsNt())
|
||||
{
|
||||
Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, L"vpnsetup.exe", L"/easy:true", L"vpnsetup.exe", 12, dir_admin_tools,
|
||||
_UU("SW_LINK_NAME_EASYINSTALLER"),
|
||||
_UU("SW_LINK_NAME_EASYINSTALLER_COMMENT"), false));
|
||||
@ -2646,7 +2587,6 @@ void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c)
|
||||
Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, L"vpnsetup.exe", L"/web:true", L"vpnsetup.exe", 1, dir_admin_tools,
|
||||
_UU("SW_LINK_NAME_WEBINSTALLER"),
|
||||
_UU("SW_LINK_NAME_WEBINSTALLER_COMMENT"), false));
|
||||
}
|
||||
|
||||
// Startup
|
||||
Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/startup", NULL, 0, dir_startup,
|
||||
@ -2717,16 +2657,13 @@ void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c)
|
||||
tmp1,
|
||||
tmp2, false));
|
||||
|
||||
// Language settings (except for Win9x)
|
||||
if (MsIsNt())
|
||||
{
|
||||
// Language settings
|
||||
UniFormat(tmp1, sizeof(tmp1), _UU("SW_LINK_NAME_LANGUAGE"), c->Title);
|
||||
UniFormat(tmp2, sizeof(tmp2), _UU("SW_LINK_NAME_LANGUAGE_COMMENT"), c->Title);
|
||||
Add(t->LinkTasks, SwNewLinkTask(setup_exe->DstDir, setup_exe->DstFileName, L"/language:yes",
|
||||
L"vpnsetup.exe", 10, dir_config_language,
|
||||
tmp1,
|
||||
tmp2, false));
|
||||
}
|
||||
|
||||
// Hamcore!
|
||||
Add(t->CopyTasks, SwNewCopyTask(L"hamcore.se2", NULL, sw->InstallSrc, sw->InstallDir, true, true));
|
||||
@ -3082,7 +3019,7 @@ bool SwInstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c)
|
||||
|
||||
if (UniIsEmptyStr(svc_title) == false)
|
||||
{
|
||||
if (sw->IsSystemMode && MsIsNt())
|
||||
if (sw->IsSystemMode)
|
||||
{
|
||||
// WinNT and system mode
|
||||
if (MsIsServiceRunning(c->SvcName))
|
||||
@ -3337,7 +3274,7 @@ LABEL_RETRY_2:
|
||||
}
|
||||
|
||||
|
||||
if (sw->IsSystemMode && MsIsNt())
|
||||
if (sw->IsSystemMode)
|
||||
{
|
||||
// ACL settings only in the system mode
|
||||
for (i = 0;i < LIST_NUM(t->SetSecurityPaths);i++)
|
||||
@ -3398,7 +3335,7 @@ LABEL_RETRY_2:
|
||||
|
||||
if (UniIsEmptyStr(svc_title) == false)
|
||||
{
|
||||
if (sw->IsSystemMode == false || MsIsNt() == false)
|
||||
if (sw->IsSystemMode == false)
|
||||
{
|
||||
// Just simply start in user mode or Win9x mode
|
||||
wchar_t fullpath[MAX_SIZE];
|
||||
@ -3407,7 +3344,7 @@ LABEL_RETRY_USERMODE_EXEC:
|
||||
|
||||
CombinePathW(fullpath, sizeof(fullpath), sw->InstallDir, c->SvcFileName);
|
||||
|
||||
if (MsExecuteW(fullpath, (MsIsNt() ? L"/usermode" : L"/win9x_service")) == false)
|
||||
if (MsExecuteW(fullpath, L"/usermode") == false)
|
||||
{
|
||||
UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SVC_USERMODE_EXEC_FAILED"), fullpath);
|
||||
|
||||
@ -3422,19 +3359,6 @@ LABEL_RETRY_USERMODE_EXEC:
|
||||
goto LABEL_RETRY_USERMODE_EXEC;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
// Register into the registry as a background service in the case of Win9x
|
||||
wchar_t fullpath2[MAX_SIZE];
|
||||
|
||||
UniFormat(fullpath2, sizeof(fullpath2), L"\"%s\" /win9x_service", fullpath);
|
||||
|
||||
MsRegWriteStrW(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, c->SvcName, fullpath2);
|
||||
MsRegWriteStrW(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, c->SvcName, fullpath2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3565,7 +3489,7 @@ LABEL_CREATE_SHORTCUT:
|
||||
|
||||
if (UniIsEmptyStr(svc_description) == false)
|
||||
{
|
||||
if (sw->IsSystemMode && MsIsNt())
|
||||
if (sw->IsSystemMode)
|
||||
{
|
||||
MsSetServiceDescription(c->SvcName, svc_description);
|
||||
}
|
||||
@ -4306,18 +4230,10 @@ void SwPerformInit(HWND hWnd, SW *sw, WIZARD_PAGE *wp)
|
||||
|
||||
SetTextA(hWnd, S_STATUS, "");
|
||||
|
||||
if (MsIsWinXPOrWinVista())
|
||||
{
|
||||
// Display the progress bar for Windows XP or later
|
||||
// Display the progress bar
|
||||
SendMsg(hWnd, IDC_PROGRESS1, PBM_SETMARQUEE, TRUE, 100);
|
||||
SetStyle(hWnd, IDC_PROGRESS1, PBS_MARQUEE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hide the progress bar in the case of Windows 2000 or earlier
|
||||
Hide(hWnd, IDC_PROGRESS1);
|
||||
}
|
||||
}
|
||||
|
||||
// Do the set-up process
|
||||
UINT SwPerform(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param)
|
||||
@ -4572,22 +4488,11 @@ void SwInitDefaultInstallDir(SW *sw)
|
||||
UniStrCpy(sw->DefaultInstallDir_User, sizeof(sw->DefaultInstallDir_User), reg_dir_user);
|
||||
}
|
||||
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
// Set to system mode for Win9x
|
||||
sw->IsSystemMode = true;
|
||||
}
|
||||
|
||||
if (MsIsAdmin() == false)
|
||||
{
|
||||
sw->IsAvailableSystemMode = false;
|
||||
sw->IsAvailableUserMode = true;
|
||||
}
|
||||
else if (MsIsNt() == false)
|
||||
{
|
||||
sw->IsAvailableSystemMode = true;
|
||||
sw->IsAvailableUserMode = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sw->IsAvailableSystemMode = true;
|
||||
@ -5272,16 +5177,8 @@ UINT SwComponents(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wiz
|
||||
case WM_INITDIALOG:
|
||||
LvInitEx2(hWnd, L_LIST, false, true);
|
||||
|
||||
if (MsIsVista())
|
||||
{
|
||||
SetFont(hWnd, L_LIST, GetMeiryoFontEx(12));
|
||||
SetFont(hWnd, S_TITLE, GetMeiryoFontEx(11));
|
||||
}
|
||||
else
|
||||
{
|
||||
DlgFont(hWnd, L_LIST, 12, false);
|
||||
DlgFont(hWnd, S_TITLE, 11, false);
|
||||
}
|
||||
|
||||
LvInsertColumn(hWnd, L_LIST, 0, L"Component", 515);
|
||||
break;
|
||||
@ -5306,13 +5203,6 @@ UINT SwComponents(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wiz
|
||||
|
||||
if (c != NULL)
|
||||
{
|
||||
if (SwCheckOs(sw, c) == false)
|
||||
{
|
||||
// OS Check Failed
|
||||
MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_OS_FAILED"), c->Title);
|
||||
break;
|
||||
}
|
||||
|
||||
sw->CurrentComponent = c;
|
||||
|
||||
if (sw->CurrentComponent->SystemModeOnly == false || MsIsAdmin())
|
||||
@ -5480,7 +5370,7 @@ UINT SwModeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard
|
||||
|
||||
if (sw->IsSystemMode)
|
||||
{
|
||||
if (MsIsVista() && MsIsAdmin() == false && sw->IsReExecForUac == false)
|
||||
if (MsIsAdmin() == false && sw->IsReExecForUac == false)
|
||||
{
|
||||
// If UAC is available and this isn't invoked via UAC,
|
||||
// give the user a chance to get administrator privileges on UAC start again
|
||||
@ -5578,8 +5468,6 @@ UINT SwWelcomeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wiz
|
||||
sw->DoubleClickBlocker = true;
|
||||
|
||||
if (MsIsAdmin() == false)
|
||||
{
|
||||
if (MsIsVista())
|
||||
{
|
||||
if (sw->IsReExecForUac == false)
|
||||
{
|
||||
@ -5604,12 +5492,6 @@ UINT SwWelcomeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wiz
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Jump to the mode selection screen in the case of older than Vista
|
||||
return D_SW_MODE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skip to the component list screen if the user has Admin privileges
|
||||
return D_SW_COMPONENTS;
|
||||
@ -5710,10 +5592,7 @@ void SwUiMain(SW *sw)
|
||||
AddWizardPage(w, NewWizardPage(D_SW_WEB1, SwWeb1, _UU("SW_WEB1_TITLE")));
|
||||
AddWizardPage(w, NewWizardPage(D_SW_WEB2, SwWeb2, _UU("SW_WEB2_TITLE")));
|
||||
|
||||
if (MsIsVista())
|
||||
{
|
||||
w->IsAreoStyle = true;
|
||||
}
|
||||
|
||||
if (sw->UninstallMode)
|
||||
{
|
||||
@ -5984,48 +5863,6 @@ SW_COMPONENT *SwNewComponent(char *name, char *svc_name, UINT id, UINT icon, UIN
|
||||
return c;
|
||||
}
|
||||
|
||||
// Examine the OS requirements
|
||||
bool SwCheckOs(SW *sw, SW_COMPONENT *c)
|
||||
{
|
||||
// Validate arguments
|
||||
if (sw == NULL || c == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (c->Id == SW_CMP_VPN_CLIENT)
|
||||
{
|
||||
OS_INFO *info = GetOsInfo();
|
||||
|
||||
if (OS_IS_WINDOWS_NT(info->OsType))
|
||||
{
|
||||
if (MsIsWin2000OrGreater() == false)
|
||||
{
|
||||
// It doesn't work with WinNT 4.0
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GET_KETA(info->OsType, 100) <= 1)
|
||||
{
|
||||
// It doesn't work with Win95
|
||||
return false;
|
||||
}
|
||||
else if (info->OsType == OSTYPE_WINDOWS_98)
|
||||
{
|
||||
if (EndWith(info->OsVersion, "A") == false)
|
||||
{
|
||||
// It doesn't work in Win98 First Edition
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Define the component
|
||||
void SwDefineComponents(SW *sw)
|
||||
{
|
||||
|
@ -287,8 +287,6 @@ void SwFreeLogFile(SW_LOGFILE *logfile);
|
||||
void SwInstallShortcuts(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c, SW_TASK *t);
|
||||
void SwDeleteShortcuts(SW_LOGFILE *logfile);
|
||||
|
||||
bool SwCheckOs(SW *sw, SW_COMPONENT *c);
|
||||
|
||||
bool SwEnterSingle(SW *sw);
|
||||
void SwLeaveSingle(SW *sw);
|
||||
|
||||
|
@ -1578,7 +1578,7 @@ void GetServerCapsMain(SERVER *s, CAPSLIST *t)
|
||||
AddCapsBool(t, "b_support_ipv6_ac", true);
|
||||
|
||||
// Support for VLAN tagged packet transmission configuration tool
|
||||
AddCapsBool(t, "b_support_eth_vlan", (OS_IS_WINDOWS_NT(GetOsType()) && GET_KETA(GetOsType(), 100) >= 2));
|
||||
AddCapsBool(t, "b_support_eth_vlan", true);
|
||||
|
||||
// Support for the message display function when the VPN connect to the Virtual HUB
|
||||
AddCapsBool(t, "b_support_msg", true);
|
||||
|
@ -1913,12 +1913,6 @@ SESSION *NewClientSessionEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *au
|
||||
s->VirtualHost = true;
|
||||
}
|
||||
|
||||
if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType))
|
||||
{
|
||||
// Prohibit the half-duplex mode in the case of Win9x
|
||||
s->ClientOption->HalfConnection = false;
|
||||
}
|
||||
|
||||
// Copy the client authentication data
|
||||
s->ClientAuth = Malloc(sizeof(CLIENT_AUTH));
|
||||
Copy(s->ClientAuth, auth, sizeof(CLIENT_AUTH));
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
#define UT_C
|
||||
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
|
@ -37,26 +37,8 @@ void Win32GetWinVer(RPC_WINVER *v)
|
||||
|
||||
v->IsWindows = true;
|
||||
|
||||
if (OS_IS_WINDOWS_NT(GetOsType()) == false)
|
||||
if (true)
|
||||
{
|
||||
// Windows 9x
|
||||
OSVERSIONINFO os;
|
||||
Zero(&os, sizeof(os));
|
||||
os.dwOSVersionInfoSize = sizeof(os);
|
||||
GetVersionEx(&os);
|
||||
|
||||
v->Build = LOWORD(os.dwBuildNumber);
|
||||
v->VerMajor = os.dwMajorVersion;
|
||||
v->VerMinor = os.dwMinorVersion;
|
||||
|
||||
Format(v->Title, sizeof(v->Title), "%s %s",
|
||||
GetOsInfo()->OsProductName,
|
||||
GetOsInfo()->OsVersion);
|
||||
Trim(v->Title);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows NT 4.0 SP6 or later
|
||||
OSVERSIONINFOEX os;
|
||||
Zero(&os, sizeof(os));
|
||||
os.dwOSVersionInfoSize = sizeof(os);
|
||||
@ -93,31 +75,6 @@ void Win32GetWinVer(RPC_WINVER *v)
|
||||
}
|
||||
}
|
||||
|
||||
// Release the DHCP addresses of all virtual LAN cards
|
||||
void Win32ReleaseAllDhcp9x(bool wait)
|
||||
{
|
||||
TOKEN_LIST *t;
|
||||
UINT i;
|
||||
|
||||
t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD);
|
||||
if (t == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0;i < t->NumTokens;i++)
|
||||
{
|
||||
char *name = t->Token[i];
|
||||
UINT id = GetInstanceId(name);
|
||||
if (id != 0)
|
||||
{
|
||||
Win32ReleaseDhcp9x(id, wait);
|
||||
}
|
||||
}
|
||||
|
||||
FreeToken(t);
|
||||
}
|
||||
|
||||
// Routing table tracking main
|
||||
void RouteTrackingMain(SESSION *s)
|
||||
{
|
||||
@ -311,7 +268,7 @@ void RouteTrackingMain(SESSION *s)
|
||||
if (other_if_default_gateway_metric_min > e->Metric)
|
||||
{
|
||||
// Ignore the metric value of all PPP connection in the case of Windows Vista
|
||||
if (MsIsVista() == false || e->PPPConnection == false)
|
||||
if (e->PPPConnection == false)
|
||||
{
|
||||
other_if_default_gateway_metric_min = e->Metric;
|
||||
}
|
||||
@ -513,12 +470,9 @@ void RouteTrackingStart(SESSION *s)
|
||||
if_id = GetInstanceId(v->InstanceName);
|
||||
Debug("[InstanceId of %s] = 0x%x\n", v->InstanceName, if_id);
|
||||
|
||||
if (MsIsVista())
|
||||
{
|
||||
// The routing table by the virtual LAN card body should be
|
||||
// excluded explicitly in Windows Vista
|
||||
exclude_if_id = if_id;
|
||||
}
|
||||
|
||||
// Get the route to the server
|
||||
e = GetBestRouteEntryEx(&s->ServerIP, exclude_if_id);
|
||||
@ -532,10 +486,8 @@ void RouteTrackingStart(SESSION *s)
|
||||
Debug("GetBestRouteEntry() Succeed. [Gateway: %s]\n", tmp);
|
||||
|
||||
// Add a route
|
||||
if (MsIsVista())
|
||||
{
|
||||
e->Metric = e->OldIfMetric;
|
||||
}
|
||||
|
||||
if (AddRouteEntryEx(e, &already_exists) == false)
|
||||
{
|
||||
FreeRouteEntry(e);
|
||||
@ -597,8 +549,6 @@ void RouteTrackingStart(SESSION *s)
|
||||
else
|
||||
{
|
||||
// Add a route
|
||||
if (MsIsVista())
|
||||
{
|
||||
dns->Metric = dns->OldIfMetric;
|
||||
|
||||
if (AddRouteEntry(dns) == false)
|
||||
@ -609,7 +559,6 @@ void RouteTrackingStart(SESSION *s)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (s->IsAzureSession && IsZeroIP(&s->AzureRealServerGlobalIp) == false)
|
||||
{
|
||||
@ -619,11 +568,8 @@ void RouteTrackingStart(SESSION *s)
|
||||
route_to_real_server_global = GetBestRouteEntryEx(&s->AzureRealServerGlobalIp, exclude_if_id);
|
||||
|
||||
if (route_to_real_server_global != NULL)
|
||||
{
|
||||
if (MsIsVista())
|
||||
{
|
||||
route_to_real_server_global->Metric = route_to_real_server_global->OldIfMetric;
|
||||
}
|
||||
|
||||
if (AddRouteEntry(route_to_real_server_global) == false)
|
||||
{
|
||||
@ -717,21 +663,6 @@ void RouteTrackingStop(SESSION *s, ROUTE_TRACKING *t)
|
||||
|
||||
Zero(&dns_ip, sizeof(dns_ip));
|
||||
|
||||
// Remove the default gateway added by the virtual LAN card
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
if (t->DefaultGatewayByVLan != NULL)
|
||||
{
|
||||
Debug("Default Gateway by VLAN was deleted.\n");
|
||||
DeleteRouteEntry(t->DefaultGatewayByVLan);
|
||||
}
|
||||
|
||||
if (t->VistaOldDefaultGatewayByVLan != NULL)
|
||||
{
|
||||
FreeRouteEntry(t->VistaOldDefaultGatewayByVLan);
|
||||
}
|
||||
}
|
||||
|
||||
if (t->DefaultGatewayByVLan != NULL)
|
||||
{
|
||||
FreeRouteEntry(t->DefaultGatewayByVLan);
|
||||
@ -748,12 +679,6 @@ void RouteTrackingStop(SESSION *s, ROUTE_TRACKING *t)
|
||||
FreeRouteEntry(t->VistaDefaultGateway2);
|
||||
}
|
||||
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
// Only in the case of Windows 9x, release the DHCP address of the virtual LAN card
|
||||
Win32ReleaseDhcp9x(t->VLanInterfaceId, false);
|
||||
}
|
||||
|
||||
// Clear the DNS cache
|
||||
Win32FlushDnsCache();
|
||||
|
||||
@ -1129,13 +1054,10 @@ bool VLanPaInit(SESSION *s)
|
||||
|
||||
// Normalize the setting of interface metric of the default gateway
|
||||
if (s->ClientModeAndUseVLan)
|
||||
{
|
||||
if (MsIsVista())
|
||||
{
|
||||
MsNormalizeInterfaceDefaultGatewaySettings(VLAN_ADAPTER_NAME_TAG, s->ClientOption->DeviceName);
|
||||
MsNormalizeInterfaceDefaultGatewaySettings(VLAN_ADAPTER_NAME_TAG_OLD, s->ClientOption->DeviceName);
|
||||
}
|
||||
}
|
||||
|
||||
// Connect to the driver
|
||||
v = NewVLan(s->ClientOption->DeviceName, NULL);
|
||||
@ -1288,9 +1210,6 @@ bool VLanPutPacketsToDriver(VLAN *v)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (v->Win9xMode == false)
|
||||
{
|
||||
// Windows NT
|
||||
PROBE_STR("VLanPutPacketsToDriver: WriteFile");
|
||||
if (WriteFile(v->Handle, v->PutBuffer, NEO_EXCHANGE_BUFFER_SIZE, &write_size,
|
||||
NULL) == false)
|
||||
@ -1305,17 +1224,6 @@ bool VLanPutPacketsToDriver(VLAN *v)
|
||||
v->Halt = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows 9x
|
||||
if (DeviceIoControl(v->Handle, NEO_IOCTL_PUT_PACKET, v->PutBuffer,
|
||||
NEO_EXCHANGE_BUFFER_SIZE, NULL, 0, &write_size, NULL) == false)
|
||||
{
|
||||
v->Halt = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1334,9 +1242,6 @@ bool VLanGetPacketsFromDriver(VLAN *v)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (v->Win9xMode == false)
|
||||
{
|
||||
// Windows NT
|
||||
PROBE_STR("VLanGetPacketsFromDriver: ReadFile");
|
||||
if (ReadFile(v->Handle, v->GetBuffer, NEO_EXCHANGE_BUFFER_SIZE,
|
||||
&read_size, NULL) == false)
|
||||
@ -1344,17 +1249,6 @@ bool VLanGetPacketsFromDriver(VLAN *v)
|
||||
v->Halt = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows 9x
|
||||
if (DeviceIoControl(v->Handle, NEO_IOCTL_GET_PACKET, NULL, 0,
|
||||
v->GetBuffer, NEO_EXCHANGE_BUFFER_SIZE, &read_size, NULL) == false)
|
||||
{
|
||||
v->Halt = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (read_size != NEO_EXCHANGE_BUFFER_SIZE)
|
||||
{
|
||||
@ -1423,23 +1317,14 @@ VLAN *NewVLan(char *instance_name, VLAN_PARAM *param)
|
||||
|
||||
v = ZeroMalloc(sizeof(VLAN));
|
||||
|
||||
if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType))
|
||||
{
|
||||
v->Win9xMode = true;
|
||||
}
|
||||
|
||||
// Initialize the name
|
||||
Format(name_upper, sizeof(name_upper), "%s", instance_name);
|
||||
StrUpper(name_upper);
|
||||
v->InstanceName = CopyStr(name_upper);
|
||||
Format(tmp, sizeof(tmp), NDIS_NEO_DEVICE_FILE_NAME, v->InstanceName);
|
||||
v->DeviceNameWin32 = CopyStr(tmp);
|
||||
|
||||
if (v->Win9xMode == false)
|
||||
{
|
||||
Format(tmp, sizeof(tmp), NDIS_NEO_EVENT_NAME_WIN32, v->InstanceName);
|
||||
v->EventNameWin32 = CopyStr(tmp);
|
||||
}
|
||||
|
||||
// Connect to the device
|
||||
h = CreateFile(v->DeviceNameWin32,
|
||||
@ -1455,8 +1340,6 @@ VLAN *NewVLan(char *instance_name, VLAN_PARAM *param)
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
if (v->Win9xMode == false)
|
||||
{
|
||||
// Connect to the event
|
||||
e = OpenEvent(SYNCHRONIZE, FALSE, v->EventNameWin32);
|
||||
if (e == INVALID_HANDLE_VALUE)
|
||||
@ -1464,23 +1347,6 @@ VLAN *NewVLan(char *instance_name, VLAN_PARAM *param)
|
||||
// Connection failure
|
||||
goto CLEANUP;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPENVXDHANDLE OpenVxDHandle;
|
||||
DWORD vxd_handle;
|
||||
UINT bytes_returned;
|
||||
|
||||
OpenVxDHandle = (OPENVXDHANDLE)GetProcAddress(GetModuleHandle("KERNEL32"),
|
||||
"OpenVxDHandle");
|
||||
|
||||
// Deliver to the driver by creating an event
|
||||
e = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
vxd_handle = (DWORD)OpenVxDHandle(e);
|
||||
|
||||
DeviceIoControl(h, NEO_IOCTL_SET_EVENT, &vxd_handle, sizeof(DWORD),
|
||||
NULL, 0, &bytes_returned, NULL);
|
||||
}
|
||||
|
||||
v->Event = e;
|
||||
v->Handle = h;
|
||||
|
@ -44,7 +44,6 @@ struct ROUTE_TRACKING
|
||||
struct VLAN
|
||||
{
|
||||
volatile bool Halt; // Halting flag
|
||||
bool Win9xMode; // Windows 9x
|
||||
char *InstanceName; // Instance name
|
||||
char *DeviceNameWin32; // Win32 device name
|
||||
char *EventNameWin32; // Win32 event name
|
||||
@ -87,7 +86,6 @@ UINT GetInstanceId(char *name);
|
||||
void RouteTrackingStart(SESSION *s);
|
||||
void RouteTrackingStop(SESSION *s, ROUTE_TRACKING *t);
|
||||
void RouteTrackingMain(SESSION *s);
|
||||
void Win32ReleaseAllDhcp9x(bool wait);
|
||||
|
||||
void Win32GetWinVer(RPC_WINVER *v);
|
||||
|
||||
|
@ -10309,12 +10309,9 @@ VH *NewVirtualHostEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, VH_
|
||||
}
|
||||
|
||||
if (v->IcmpRawSocketOk == false)
|
||||
{
|
||||
if (IsIcmpApiSupported())
|
||||
{
|
||||
v->IcmpApiOk = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the options
|
||||
SetVirtualHostOption(v, vh_option);
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
#define _WIN32_DCOM
|
||||
|
||||
//#define _WIN32_WINNT 0x0502
|
||||
//#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
@ -856,32 +856,9 @@ bool CreateLinkInner(wchar_t *filename, wchar_t *target, wchar_t *workdir, wchar
|
||||
wchar_t *comment, wchar_t *icon, UINT icon_index)
|
||||
{
|
||||
HRESULT r;
|
||||
bool ret;
|
||||
IShellLinkW* pShellLink;
|
||||
IPersistFile* pPersistFile;
|
||||
|
||||
if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType))
|
||||
{
|
||||
char *a1, *a2, *a3, *a4, *a5, *a6;
|
||||
a1 = CopyUniToStr(filename);
|
||||
a2 = CopyUniToStr(target);
|
||||
a3 = CopyUniToStr(workdir);
|
||||
a4 = CopyUniToStr(args);
|
||||
a5 = CopyUniToStr(icon);
|
||||
a6 = CopyUniToStr(comment);
|
||||
|
||||
ret = CreateLinkInnerA(a1, a2, a3, a4, a6, a5, icon_index);
|
||||
|
||||
Free(a1);
|
||||
Free(a2);
|
||||
Free(a3);
|
||||
Free(a4);
|
||||
Free(a5);
|
||||
Free(a6);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
r = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void **)&pShellLink);
|
||||
if (FAILED(r))
|
||||
{
|
||||
@ -966,31 +943,11 @@ extern "C"
|
||||
// Show the folder selection dialog
|
||||
wchar_t *FolderDlgW(HWND hWnd, wchar_t *title, wchar_t *default_dir)
|
||||
{
|
||||
wchar_t *ret;
|
||||
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
char *default_dir_a = CopyUniToStr(default_dir);
|
||||
char *ret_a = FolderDlgA(hWnd, title, default_dir_a);
|
||||
|
||||
ret = CopyStrToUni(ret_a);
|
||||
Free(ret_a);
|
||||
Free(default_dir_a);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = FolderDlgInnerW(hWnd, title, default_dir);
|
||||
|
||||
return ret;
|
||||
return FolderDlgInnerW(hWnd, title, default_dir);
|
||||
}
|
||||
char *FolderDlgA(HWND hWnd, wchar_t *title, char *default_dir)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
ret = FolderDlgInnerA(hWnd, title, default_dir);
|
||||
|
||||
return ret;
|
||||
return FolderDlgInnerA(hWnd, title, default_dir);
|
||||
}
|
||||
|
||||
// Create a shortcut
|
||||
|
@ -35,8 +35,8 @@
|
||||
#undef StrCmp
|
||||
#endif
|
||||
|
||||
//#define _WIN32_WINNT 0x0502
|
||||
//#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -287,12 +287,6 @@ typedef struct WINUI_ABOUT
|
||||
UINT AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void AboutDlgInit(HWND hWnd, WINUI_ABOUT *a);
|
||||
|
||||
typedef struct WIN9X_REBOOT_DLG
|
||||
{
|
||||
UINT64 StartTime;
|
||||
UINT TotalTime;
|
||||
} WIN9X_REBOOT_DLG;
|
||||
|
||||
#define LED_WIDTH 96
|
||||
#define LED_HEIGHT 16
|
||||
#define LED_FORCE_UPDATE 60000
|
||||
@ -354,15 +348,6 @@ HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_
|
||||
|
||||
#endif // WINUI_C
|
||||
|
||||
// Kakushi
|
||||
typedef struct KAKUSHI
|
||||
{
|
||||
HWND hWnd;
|
||||
THREAD *Thread;
|
||||
volatile bool Halt;
|
||||
UINT64 StartTick, Span;
|
||||
} KAKUSHI;
|
||||
|
||||
// The information screen about the free version
|
||||
typedef struct FREEINFO
|
||||
{
|
||||
@ -695,9 +680,6 @@ bool IpIsFilled(HWND hWnd, UINT id);
|
||||
UINT IpGetFilledNum(HWND hWnd, UINT id);
|
||||
void About(HWND hWnd, CEDAR *cedar, wchar_t *product_name);
|
||||
void AboutEx(HWND hWnd, CEDAR *cedar, wchar_t *product_name, WINUI_UPDATE *u);
|
||||
void Win9xReboot(HWND hWnd);
|
||||
void Win9xRebootThread(THREAD *t, void *p);
|
||||
UINT Win9xRebootDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
wchar_t *StringDlg(HWND hWnd, wchar_t *title, wchar_t *info, wchar_t *def, UINT icon, bool allow_empty, bool allow_unsafe);
|
||||
char *StringDlgA(HWND hWnd, wchar_t *title, wchar_t *info, char *def, UINT icon, bool allow_empty, bool allow_unsafe);
|
||||
UINT StringDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
@ -715,10 +697,6 @@ UINT TcpIpDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param
|
||||
void TcpIpDlgInit(HWND hWnd);
|
||||
void TcpIpDlgUpdate(HWND hWnd);
|
||||
UINT TcpMsgDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
UINT KakushiDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
|
||||
void KakushiThread(THREAD *thread, void *param);
|
||||
KAKUSHI *InitKakushi();
|
||||
void FreeKakushi(KAKUSHI *k);
|
||||
void ShowEasterEgg(HWND hWnd);
|
||||
bool Win32CnCheckAlreadyExists(bool lock);
|
||||
void RegistWindowsFirewallAll();
|
||||
|
@ -28,7 +28,18 @@ if(WIN32)
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
|
||||
)
|
||||
|
||||
target_link_libraries(mayaqua PRIVATE setupapi.lib winmm.lib)
|
||||
target_link_libraries(mayaqua
|
||||
PRIVATE
|
||||
"DbgHelp.Lib"
|
||||
"dwmapi.lib"
|
||||
"iphlpapi.lib"
|
||||
"newdev.lib"
|
||||
"Psapi.Lib"
|
||||
"Secur32.Lib"
|
||||
"setupapi.lib"
|
||||
"winmm.lib"
|
||||
"WtsApi32.Lib"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
|
@ -612,16 +612,9 @@ void HashInstanceName(char *name, UINT size, char *instance_name)
|
||||
|
||||
Format(name, size, "VPN-%s", key);
|
||||
|
||||
if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType))
|
||||
{
|
||||
if (GET_KETA(GetOsInfo()->OsType, 100) >= 2 ||
|
||||
GetOsInfo()->OsType == OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER)
|
||||
{
|
||||
StrCpy(tmp, sizeof(tmp), name);
|
||||
Format(name, size, "Global\\%s", tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
void HashInstanceNameLocal(char *name, UINT size, char *instance_name)
|
||||
{
|
||||
char tmp[MAX_SIZE];
|
||||
@ -643,16 +636,9 @@ void HashInstanceNameLocal(char *name, UINT size, char *instance_name)
|
||||
|
||||
Format(name, size, "VPN-%s", key);
|
||||
|
||||
if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType))
|
||||
{
|
||||
if (GET_KETA(GetOsInfo()->OsType, 100) >= 2 ||
|
||||
GetOsInfo()->OsType == OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER)
|
||||
{
|
||||
StrCpy(tmp, sizeof(tmp), name);
|
||||
Format(name, size, "Local\\%s", tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run the process
|
||||
bool Run(char *filename, char *arg, bool hide, bool wait)
|
||||
|
@ -252,11 +252,9 @@ typedef unsigned int SOCKET;
|
||||
|
||||
// OS discrimination macro
|
||||
#define GET_KETA(t, i) (((t) % (i * 10)) / i)
|
||||
#define OS_IS_WINDOWS_9X(t) (GET_KETA(t, 1000) == 1)
|
||||
#define OS_IS_WINDOWS_NT(t) (GET_KETA(t, 1000) == 2)
|
||||
#define OS_IS_WINDOWS(t) (OS_IS_WINDOWS_9X(t) || OS_IS_WINDOWS_NT(t))
|
||||
#define OS_IS_SERVER(t) (OS_IS_WINDOWS_NT(t) && GET_KETA(t, 10))
|
||||
#define OS_IS_WORKSTATION(t) ((OS_IS_WINDOWS_NT(t) && (!(GET_KETA(t, 10)))) || OS_IS_WINDOWS_9X(t))
|
||||
#define OS_IS_WINDOWS(t) ((GET_KETA(t, 1000) == 1) || (GET_KETA(t, 1000) == 2))
|
||||
#define OS_IS_SERVER(t) (OS_IS_WINDOWS(t) && GET_KETA(t, 10))
|
||||
#define OS_IS_WORKSTATION(t) (OS_IS_WINDOWS(t) && !(GET_KETA(t, 10))
|
||||
#define OS_IS_UNIX(t) (GET_KETA(t, 1000) == 3)
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -47,9 +47,6 @@ typedef unsigned long DWORD;
|
||||
#define SVC_ARG_SERVICE "/service"
|
||||
#define SVC_ARG_SETUP_INSTALL "/setup_install"
|
||||
#define SVC_ARG_SETUP_UNINSTALL "/setup_uninstall"
|
||||
#define SVC_ARG_WIN9X_SERVICE "/win9x_service"
|
||||
#define SVC_ARG_WIN9X_INSTALL "/win9x_install"
|
||||
#define SVC_ARG_WIN9X_UNINSTALL "/win9x_uninstall"
|
||||
#define SVC_ARG_TCP "/tcp"
|
||||
#define SVC_ARG_TCP_UAC "/tcp_uac"
|
||||
#define SVC_ARG_TCP_UAC_W L"/tcp_uac"
|
||||
@ -92,19 +89,12 @@ typedef unsigned long DWORD;
|
||||
#define SVC_MODE_SERVICE 7
|
||||
#define SVC_MODE_SETUP_INSTALL 8
|
||||
#define SVC_MODE_SETUP_UNINSTALL 9
|
||||
#define SVC_MODE_WIN9X_SERVICE 10
|
||||
#define SVC_MODE_WIN9X_INSTALL 11
|
||||
#define SVC_MODE_WIN9X_UNINSTALL 12
|
||||
#define SVC_MODE_TCP 13
|
||||
#define SVC_MODE_TCPSETUP 14
|
||||
#define SVC_MODE_TRAFFIC 15
|
||||
#define SVC_MODE_UIHELP 16
|
||||
#define SVC_MODE_TCP_UAC 17
|
||||
|
||||
|
||||
#define WIN9X_SVC_REGKEY_1 "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices"
|
||||
#define WIN9X_SVC_REGKEY_2 "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
|
||||
|
||||
#define VISTA_MMCSS_KEYNAME "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Multimedia\\SystemProfile\\Tasks"
|
||||
#define VISTA_MMCSS_FILENAME "mmcss_backup.dat"
|
||||
|
||||
@ -138,52 +128,6 @@ typedef unsigned long DWORD;
|
||||
|
||||
#define DRIVER_DEVICE_ID_TAG "NeoAdapter_%s"
|
||||
|
||||
|
||||
#if (defined(MICROSOFT_C) || defined(NETWORK_C)) && (defined(OS_WIN32))
|
||||
|
||||
typedef enum __TCP_TABLE_CLASS {
|
||||
_TCP_TABLE_BASIC_LISTENER,
|
||||
_TCP_TABLE_BASIC_CONNECTIONS,
|
||||
_TCP_TABLE_BASIC_ALL,
|
||||
_TCP_TABLE_OWNER_PID_LISTENER,
|
||||
_TCP_TABLE_OWNER_PID_CONNECTIONS,
|
||||
_TCP_TABLE_OWNER_PID_ALL,
|
||||
_TCP_TABLE_OWNER_MODULE_LISTENER,
|
||||
_TCP_TABLE_OWNER_MODULE_CONNECTIONS,
|
||||
_TCP_TABLE_OWNER_MODULE_ALL
|
||||
} _TCP_TABLE_CLASS, *_PTCP_TABLE_CLASS;
|
||||
|
||||
// A pointer to the network related Win32 API function
|
||||
typedef struct NETWORK_WIN32_FUNCTIONS
|
||||
{
|
||||
HINSTANCE hIpHlpApi32;
|
||||
HINSTANCE hIcmp;
|
||||
DWORD (WINAPI *DeleteIpForwardEntry)(PMIB_IPFORWARDROW);
|
||||
DWORD (WINAPI *CreateIpForwardEntry)(PMIB_IPFORWARDROW);
|
||||
DWORD (WINAPI *GetIpForwardTable)(PMIB_IPFORWARDTABLE, PULONG, BOOL);
|
||||
DWORD (WINAPI *GetNetworkParams)(PFIXED_INFO, PULONG);
|
||||
ULONG (WINAPI *GetAdaptersAddresses)(ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG);
|
||||
DWORD (WINAPI *GetIfTable)(PMIB_IFTABLE, PULONG, BOOL);
|
||||
DWORD (WINAPI *GetIfTable2)(void **);
|
||||
void (WINAPI *FreeMibTable)(PVOID);
|
||||
DWORD (WINAPI *IpRenewAddress)(PIP_ADAPTER_INDEX_MAP);
|
||||
DWORD (WINAPI *IpReleaseAddress)(PIP_ADAPTER_INDEX_MAP);
|
||||
DWORD (WINAPI *GetInterfaceInfo)(PIP_INTERFACE_INFO, PULONG);
|
||||
DWORD (WINAPI *GetAdaptersInfo)(PIP_ADAPTER_INFO, PULONG);
|
||||
DWORD (WINAPI *GetExtendedTcpTable)(PVOID, PDWORD, BOOL, ULONG, _TCP_TABLE_CLASS, ULONG);
|
||||
DWORD (WINAPI *AllocateAndGetTcpExTableFromStack)(PVOID *, BOOL, HANDLE, DWORD, DWORD);
|
||||
DWORD (WINAPI *GetTcpTable)(PMIB_TCPTABLE, PULONG, BOOL);
|
||||
DWORD (WINAPI *NotifyRouteChange)(PHANDLE, LPOVERLAPPED);
|
||||
BOOL (WINAPI *CancelIPChangeNotify)(LPOVERLAPPED);
|
||||
DWORD (WINAPI *NhpAllocateAndGetInterfaceInfoFromStack)(IP_INTERFACE_NAME_INFO **,
|
||||
PDWORD, BOOL, HANDLE, DWORD);
|
||||
HANDLE (WINAPI *IcmpCreateFile)();
|
||||
BOOL (WINAPI *IcmpCloseHandle)(HANDLE);
|
||||
DWORD (WINAPI *IcmpSendEcho)(HANDLE, IPAddr, LPVOID, WORD, PIP_OPTION_INFORMATION,
|
||||
LPVOID, DWORD, DWORD);
|
||||
} NETWORK_WIN32_FUNCTIONS;
|
||||
#endif
|
||||
|
||||
#ifdef MICROSOFT_C
|
||||
// WCM related code on Windows 8
|
||||
typedef enum _MS_WCM_PROPERTY
|
||||
@ -227,7 +171,6 @@ typedef struct _MS_WCM_PROFILE_INFO_LIST {
|
||||
|
||||
} MS_WCM_PROFILE_INFO_LIST, * MS_PWCM_PROFILE_INFO_LIST;
|
||||
|
||||
|
||||
// Internal structure
|
||||
typedef struct MS
|
||||
{
|
||||
@ -235,7 +178,6 @@ typedef struct MS
|
||||
HINSTANCE hKernel32;
|
||||
bool IsNt;
|
||||
bool IsAdmin;
|
||||
struct NT_API *nt;
|
||||
HANDLE hCurrentProcess;
|
||||
UINT CurrentProcessId;
|
||||
bool MiniDumpEnabled;
|
||||
@ -294,112 +236,11 @@ typedef struct MS
|
||||
bool IsWine;
|
||||
} MS;
|
||||
|
||||
// For Windows NT API
|
||||
typedef struct NT_API
|
||||
{
|
||||
HINSTANCE hAdvapi32;
|
||||
HINSTANCE hShell32;
|
||||
HINSTANCE hNewDev;
|
||||
HINSTANCE hSetupApi;
|
||||
HINSTANCE hWtsApi32;
|
||||
HINSTANCE hPsApi;
|
||||
HINSTANCE hKernel32;
|
||||
HINSTANCE hSecur32;
|
||||
HINSTANCE hUser32;
|
||||
HINSTANCE hDbgHelp;
|
||||
HINSTANCE hWcmapi;
|
||||
HINSTANCE hDwmapi;
|
||||
BOOL (WINAPI *OpenProcessToken)(HANDLE, DWORD, PHANDLE);
|
||||
BOOL (WINAPI *LookupPrivilegeValue)(char *, char *, PLUID);
|
||||
BOOL (WINAPI *AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD);
|
||||
BOOL (WINAPI *InitiateSystemShutdown)(LPTSTR, LPTSTR, DWORD, BOOL, BOOL);
|
||||
BOOL (WINAPI *LogonUserW)(wchar_t *, wchar_t *, wchar_t *, DWORD, DWORD, HANDLE *);
|
||||
BOOL (WINAPI *LogonUserA)(char *, char *, char *, DWORD, DWORD, HANDLE *);
|
||||
BOOL (WINAPI *UpdateDriverForPlugAndPlayDevicesW)(HWND hWnd, LPCWSTR hardware_id, LPCWSTR inf_path, DWORD flag, PBOOL need_reboot);
|
||||
DWORD (WINAPI *CM_Get_DevNode_Status_Ex)(PULONG, PULONG, DWORD, ULONG, HANDLE);
|
||||
DWORD (WINAPI *CM_Get_Device_ID_ExA)(DWORD, LPSTR, ULONG, ULONG, HANDLE);
|
||||
BOOL (WINAPI *WTSQuerySessionInformation)(HANDLE, DWORD, WTS_INFO_CLASS, wchar_t *, DWORD *);
|
||||
void (WINAPI *WTSFreeMemory)(void *);
|
||||
BOOL (WINAPI *WTSDisconnectSession)(HANDLE, DWORD, BOOL);
|
||||
BOOL (WINAPI *WTSEnumerateSessions)(HANDLE, DWORD, DWORD, PWTS_SESSION_INFO *, DWORD *);
|
||||
BOOL (WINAPI *WTSRegisterSessionNotification)(HWND, DWORD);
|
||||
BOOL (WINAPI *WTSUnRegisterSessionNotification)(HWND);
|
||||
SC_HANDLE (WINAPI *OpenSCManager)(LPCTSTR, LPCTSTR, DWORD);
|
||||
SC_HANDLE (WINAPI *CreateServiceA)(SC_HANDLE, LPCTSTR, LPCTSTR, DWORD, DWORD, DWORD, DWORD, LPCTSTR, LPCTSTR, LPDWORD, LPCTSTR, LPCTSTR, LPCTSTR);
|
||||
SC_HANDLE (WINAPI *CreateServiceW)(SC_HANDLE, LPCWSTR, LPCWSTR, DWORD, DWORD, DWORD, DWORD, LPCWSTR, LPCWSTR, LPDWORD, LPCWSTR, LPCWSTR, LPCWSTR);
|
||||
BOOL (WINAPI *ChangeServiceConfig2)(SC_HANDLE, DWORD, LPVOID);
|
||||
BOOL (WINAPI *CloseServiceHandle)(SC_HANDLE);
|
||||
SC_HANDLE (WINAPI *OpenService)(SC_HANDLE, LPCTSTR, DWORD);
|
||||
BOOL (WINAPI *QueryServiceStatus)(SC_HANDLE, LPSERVICE_STATUS);
|
||||
BOOL (WINAPI *StartService)(SC_HANDLE, DWORD, LPCTSTR);
|
||||
BOOL (WINAPI *ControlService)(SC_HANDLE, DWORD, LPSERVICE_STATUS);
|
||||
BOOL (WINAPI *SetServiceStatus)(SERVICE_STATUS_HANDLE, LPSERVICE_STATUS);
|
||||
SERVICE_STATUS_HANDLE (WINAPI *RegisterServiceCtrlHandler)(LPCTSTR, LPHANDLER_FUNCTION);
|
||||
BOOL (WINAPI *StartServiceCtrlDispatcher)(CONST LPSERVICE_TABLE_ENTRY);
|
||||
BOOL (WINAPI *DeleteService)(SC_HANDLE);
|
||||
BOOL (WINAPI *EnumProcesses)(DWORD *, DWORD, DWORD *);
|
||||
BOOL (WINAPI *EnumProcessModules)(HANDLE, HMODULE *, DWORD, DWORD *);
|
||||
DWORD (WINAPI *GetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, DWORD);
|
||||
DWORD (WINAPI *GetModuleFileNameExW)(HANDLE, HMODULE, LPWSTR, DWORD);
|
||||
DWORD (WINAPI *GetProcessImageFileNameA)(HANDLE, LPSTR, DWORD);
|
||||
DWORD (WINAPI *GetProcessImageFileNameW)(HANDLE, LPWSTR, DWORD);
|
||||
BOOL (WINAPI *QueryFullProcessImageNameA)(HANDLE, DWORD, LPSTR, PDWORD);
|
||||
BOOL (WINAPI *QueryFullProcessImageNameW)(HANDLE, DWORD, LPWSTR, PDWORD);
|
||||
LONG (WINAPI *RegDeleteKeyExA)(HKEY, LPCTSTR, REGSAM, DWORD);
|
||||
BOOL (WINAPI *IsWow64Process)(HANDLE, BOOL *);
|
||||
void (WINAPI *GetNativeSystemInfo)(SYSTEM_INFO *);
|
||||
BOOL (WINAPI *DuplicateTokenEx)(HANDLE, DWORD, SECURITY_ATTRIBUTES *, SECURITY_IMPERSONATION_LEVEL, TOKEN_TYPE, HANDLE *);
|
||||
BOOL (WINAPI *ConvertStringSidToSidA)(LPCSTR, PSID *);
|
||||
BOOL (WINAPI *SetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, DWORD);
|
||||
BOOL (WINAPI *GetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, DWORD, PDWORD);
|
||||
BOOL (WINAPI *CreateProcessAsUserA)(HANDLE, LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, void *, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION);
|
||||
BOOL (WINAPI *CreateProcessAsUserW)(HANDLE, LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, void *, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION);
|
||||
BOOL (WINAPI *LookupAccountSidA)(LPCSTR,PSID,LPSTR,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE);
|
||||
BOOL (WINAPI *LookupAccountNameA)(LPCSTR,LPCSTR,PSID,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE);
|
||||
BOOL (WINAPI *GetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
|
||||
BOOL (WINAPI *GetUserNameExW)(EXTENDED_NAME_FORMAT, LPWSTR, PULONG);
|
||||
BOOL (WINAPI *SwitchDesktop)(HDESK);
|
||||
HDESK (WINAPI *OpenDesktopA)(LPTSTR, DWORD, BOOL, ACCESS_MASK);
|
||||
BOOL (WINAPI *CloseDesktop)(HDESK);
|
||||
BOOL (WINAPI *SetProcessShutdownParameters)(DWORD, DWORD);
|
||||
HANDLE (WINAPI *RegisterEventSourceW)(LPCWSTR, LPCWSTR);
|
||||
BOOL (WINAPI *ReportEventW)(HANDLE, WORD, WORD, DWORD, PSID, WORD, DWORD, LPCWSTR *, LPVOID);
|
||||
BOOL (WINAPI *DeregisterEventSource)(HANDLE);
|
||||
BOOL (WINAPI *Wow64DisableWow64FsRedirection)(void **);
|
||||
BOOLEAN (WINAPI *Wow64EnableWow64FsRedirection)(BOOLEAN);
|
||||
BOOL (WINAPI *Wow64RevertWow64FsRedirection)(void *);
|
||||
BOOL (WINAPI *GetFileInformationByHandle)(HANDLE, LPBY_HANDLE_FILE_INFORMATION);
|
||||
HANDLE (WINAPI *GetProcessHeap)();
|
||||
BOOL (WINAPI *MiniDumpWriteDump)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE,
|
||||
PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION,
|
||||
PMINIDUMP_CALLBACK_INFORMATION);
|
||||
BOOL (WINAPI *AllocateLocallyUniqueId)(PLUID);
|
||||
NTSTATUS (NTAPI *LsaConnectUntrusted)(PHANDLE);
|
||||
NTSTATUS (NTAPI *LsaLookupAuthenticationPackage)(HANDLE, PLSA_STRING, PULONG);
|
||||
NTSTATUS (NTAPI *LsaLogonUser)(HANDLE, PLSA_STRING, SECURITY_LOGON_TYPE, ULONG,
|
||||
PVOID, ULONG, PTOKEN_GROUPS, PTOKEN_SOURCE, PVOID, PULONG, PLUID, PHANDLE,
|
||||
PQUOTA_LIMITS, PNTSTATUS);
|
||||
NTSTATUS (NTAPI *LsaDeregisterLogonProcess)(HANDLE);
|
||||
NTSTATUS (NTAPI *LsaFreeReturnBuffer)(PVOID);
|
||||
DWORD (WINAPI *WcmQueryProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, PDWORD, PBYTE *);
|
||||
DWORD (WINAPI *WcmSetProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, DWORD, const BYTE *);
|
||||
void (WINAPI *WcmFreeMemory)(PVOID);
|
||||
DWORD (WINAPI *WcmGetProfileList)(PVOID, MS_WCM_PROFILE_INFO_LIST **ppProfileList);
|
||||
DWORD (WINAPI *SetNamedSecurityInfoW)(LPWSTR, DWORD, SECURITY_INFORMATION, PSID, PSID, PACL, PACL);
|
||||
BOOL (WINAPI *AddAccessAllowedAceEx)(PACL, DWORD, DWORD, DWORD, PSID);
|
||||
HRESULT (WINAPI *DwmIsCompositionEnabled)(BOOL *);
|
||||
BOOL (WINAPI *GetComputerNameExW)(COMPUTER_NAME_FORMAT, LPWSTR, LPDWORD);
|
||||
LONG (WINAPI *RegLoadKeyW)(HKEY, LPCWSTR, LPCWSTR);
|
||||
LONG (WINAPI *RegUnLoadKeyW)(HKEY, LPCWSTR);
|
||||
} NT_API;
|
||||
|
||||
typedef struct MS_EVENTLOG
|
||||
{
|
||||
HANDLE hEventLog;
|
||||
} MS_EVENTLOG;
|
||||
|
||||
extern NETWORK_WIN32_FUNCTIONS *w32net;
|
||||
|
||||
typedef struct MS_USERMODE_SVC_PULSE_THREAD_PARAM
|
||||
{
|
||||
void *hWnd;
|
||||
@ -613,7 +454,6 @@ bool MsRegDeleteValueEx2(UINT root, char *keyname, char *valuename, bool force32
|
||||
bool MsRegLoadHive(UINT root, wchar_t *keyname, wchar_t *filename);
|
||||
bool MsRegUnloadHive(UINT root, wchar_t *keyname);
|
||||
|
||||
bool MsIsNt();
|
||||
bool MsIsAdmin();
|
||||
bool MsIsWine();
|
||||
bool MsEnablePrivilege(char *name, bool enable);
|
||||
@ -740,10 +580,7 @@ bool MsIsUserMode();
|
||||
void MsTestOnly();
|
||||
void MsPlaySound(char *name);
|
||||
void MsSetThreadSingleCpu();
|
||||
void MsWin9xTest();
|
||||
bool MsCheckVLanDeviceIdFromRootEnum(char *name);
|
||||
bool MsInstallVLan9x(char *instance_name, MS_DRIVER_VER *ver);
|
||||
void MsUpdateCompatibleIDs(char *instance_name);
|
||||
LIST *MsGetProcessList();
|
||||
LIST *MsGetProcessList9x();
|
||||
LIST *MsGetProcessListNt();
|
||||
@ -825,9 +662,6 @@ LIST *EnumAllChildWindowEx(HWND hWnd, bool no_recursion, bool include_ipcontrol,
|
||||
LIST *EnumAllTopWindow();
|
||||
|
||||
bool MsExecDriverInstaller(char *arg);
|
||||
bool MsIsVista();
|
||||
bool MsIsWin2000OrGreater();
|
||||
bool MsIsWinXPOrGreater();
|
||||
void MsRegistWindowsFirewallEx(char *title, char *exe);
|
||||
void MsRegistWindowsFirewallEx2(char *title, char *exe, char *dir);
|
||||
bool MsIs64BitWindows();
|
||||
@ -937,8 +771,6 @@ UINT64 MsGetSuspendModeBeginTick();
|
||||
|
||||
LONG CALLBACK MsExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo);
|
||||
HKEY MsGetRootKeyFromInt(UINT root);
|
||||
NT_API *MsLoadNtApiFunctions();
|
||||
void MsFreeNtApiFunctions(NT_API *nt);
|
||||
void MsDestroyDevInfo(HDEVINFO info);
|
||||
HDEVINFO MsGetDevInfoFromDeviceId(SP_DEVINFO_DATA *dev_info_data, char *device_id);
|
||||
bool MsStartDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data);
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
#ifdef WIN32
|
||||
// Include windows.h for Socket API
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <Ws2tcpip.h>
|
||||
#include <Wspiapi.h>
|
||||
#include <winsock2.h>
|
||||
@ -49,14 +49,13 @@
|
||||
#endif // UNIX_MACOS
|
||||
|
||||
#ifdef OS_WIN32
|
||||
NETWORK_WIN32_FUNCTIONS *w32net;
|
||||
struct ROUTE_CHANGE_DATA
|
||||
{
|
||||
OVERLAPPED Overlapped;
|
||||
HANDLE Handle;
|
||||
UINT NumCalled;
|
||||
};
|
||||
#endif // OS_WIN32
|
||||
#endif
|
||||
|
||||
// Whether the blocking occurs in SSL
|
||||
#if defined(UNIX_BSD) || defined(UNIX_MACOS)
|
||||
@ -6042,7 +6041,7 @@ ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UIN
|
||||
ttl = 127;
|
||||
}
|
||||
|
||||
if (IsIcmpApiSupported())
|
||||
if (true)
|
||||
{
|
||||
HANDLE h;
|
||||
DWORD dw;
|
||||
@ -6052,7 +6051,7 @@ ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UIN
|
||||
ICMP_RESULT *ret = NULL;
|
||||
IP_OPTION_INFORMATION opt;
|
||||
|
||||
h = w32net->IcmpCreateFile();
|
||||
h = IcmpCreateFile();
|
||||
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
@ -6067,7 +6066,7 @@ ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UIN
|
||||
reply_size = sizeof(*reply) + size + 64;
|
||||
reply = ZeroMalloc(reply_size);
|
||||
|
||||
dw = w32net->IcmpSendEcho(h, dest_addr, data, size, &opt, reply, reply_size, timeout);
|
||||
dw = IcmpSendEcho(h, dest_addr, data, size, &opt, reply, reply_size, timeout);
|
||||
|
||||
ret = ZeroMalloc(sizeof(ICMP_RESULT));
|
||||
|
||||
@ -6130,7 +6129,7 @@ ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UIN
|
||||
|
||||
Free(reply);
|
||||
|
||||
w32net->IcmpCloseHandle(h);
|
||||
IcmpCloseHandle(h);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -6144,21 +6143,6 @@ ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UIN
|
||||
#endif // OS_WIN32
|
||||
}
|
||||
|
||||
// Detect whether the ICMP API is supported
|
||||
bool IsIcmpApiSupported()
|
||||
{
|
||||
#ifdef OS_WIN32
|
||||
if (w32net->IcmpCloseHandle != NULL &&
|
||||
w32net->IcmpCreateFile != NULL &&
|
||||
w32net->IcmpSendEcho != NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif // OS_WIN32
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize the routing table change detector
|
||||
ROUTE_CHANGE *NewRouteChange()
|
||||
{
|
||||
@ -6194,24 +6178,13 @@ ROUTE_CHANGE *Win32NewRouteChange()
|
||||
ROUTE_CHANGE *r;
|
||||
BOOL ret;
|
||||
|
||||
if (MsIsNt() == false)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (w32net->CancelIPChangeNotify == NULL ||
|
||||
w32net->NotifyRouteChange == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
r = ZeroMalloc(sizeof(ROUTE_CHANGE));
|
||||
|
||||
r->Data = ZeroMalloc(sizeof(ROUTE_CHANGE_DATA));
|
||||
|
||||
r->Data->Overlapped.hEvent = CreateEventA(NULL, false, true, NULL);
|
||||
|
||||
ret = w32net->NotifyRouteChange(&r->Data->Handle, &r->Data->Overlapped);
|
||||
ret = NotifyRouteChange(&r->Data->Handle, &r->Data->Overlapped);
|
||||
if (!(ret == NO_ERROR || ret == WSA_IO_PENDING || WSAGetLastError() == WSA_IO_PENDING))
|
||||
{
|
||||
Free(r->Data);
|
||||
@ -6231,7 +6204,7 @@ void Win32FreeRouteChange(ROUTE_CHANGE *r)
|
||||
return;
|
||||
}
|
||||
|
||||
w32net->CancelIPChangeNotify(&r->Data->Overlapped);
|
||||
CancelIPChangeNotify(&r->Data->Overlapped);
|
||||
CloseHandle(r->Data->Overlapped.hEvent);
|
||||
|
||||
Free(r->Data);
|
||||
@ -6253,7 +6226,7 @@ bool Win32IsRouteChanged(ROUTE_CHANGE *r)
|
||||
|
||||
if (WaitForSingleObject(r->Data->Overlapped.hEvent, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
w32net->NotifyRouteChange(&r->Data->Handle, &r->Data->Overlapped);
|
||||
NotifyRouteChange(&r->Data->Handle, &r->Data->Overlapped);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -8781,8 +8754,6 @@ void UnixFreeSocketLibrary()
|
||||
|
||||
#ifdef OS_WIN32 // Code for Windows
|
||||
|
||||
NETWORK_WIN32_FUNCTIONS *w32net;
|
||||
|
||||
// Comparison of IP_ADAPTER_INDEX_MAP
|
||||
int CompareIpAdapterIndexMap(void *p1, void *p2)
|
||||
{
|
||||
@ -8838,12 +8809,8 @@ bool Win32RenewAddress(void *a)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (w32net->IpRenewAddress == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = w32net->IpRenewAddress(a);
|
||||
ret = IpRenewAddress(a);
|
||||
|
||||
if (ret == NO_ERROR)
|
||||
{
|
||||
@ -8865,12 +8832,12 @@ bool Win32ReleaseAddress(void *a)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (w32net->IpReleaseAddress == NULL)
|
||||
if (IpReleaseAddress == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = w32net->IpReleaseAddress(a);
|
||||
ret = IpReleaseAddress(a);
|
||||
|
||||
if (ret == NO_ERROR)
|
||||
{
|
||||
@ -9025,23 +8992,19 @@ bool Win32GetAdapterFromGuid(void *a, char *guid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (w32net->GetInterfaceInfo == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UniFormat(tmp, sizeof(tmp), L"\\DEVICE\\TCPIP_%S", guid);
|
||||
|
||||
size = sizeof(IP_INTERFACE_INFO);
|
||||
info = ZeroMallocFast(size);
|
||||
|
||||
if (w32net->GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER)
|
||||
if (GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
Free(info);
|
||||
info = ZeroMallocFast(size);
|
||||
}
|
||||
|
||||
if (w32net->GetInterfaceInfo(info, &size) != NO_ERROR)
|
||||
if (GetInterfaceInfo(info, &size) != NO_ERROR)
|
||||
{
|
||||
Free(info);
|
||||
return false;
|
||||
@ -9099,13 +9062,13 @@ void Win32RenewDhcp9x(UINT if_id)
|
||||
size = sizeof(IP_INTERFACE_INFO);
|
||||
info = ZeroMallocFast(size);
|
||||
|
||||
if (w32net->GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER)
|
||||
if (GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
Free(info);
|
||||
info = ZeroMallocFast(size);
|
||||
}
|
||||
|
||||
if (w32net->GetInterfaceInfo(info, &size) != NO_ERROR)
|
||||
if (GetInterfaceInfo(info, &size) != NO_ERROR)
|
||||
{
|
||||
Free(info);
|
||||
return;
|
||||
@ -9155,13 +9118,13 @@ void Win32ReleaseDhcp9x(UINT if_id, bool wait)
|
||||
size = sizeof(IP_INTERFACE_INFO);
|
||||
info = ZeroMallocFast(size);
|
||||
|
||||
if (w32net->GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER)
|
||||
if (GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
Free(info);
|
||||
info = ZeroMallocFast(size);
|
||||
}
|
||||
|
||||
if (w32net->GetInterfaceInfo(info, &size) != NO_ERROR)
|
||||
if (GetInterfaceInfo(info, &size) != NO_ERROR)
|
||||
{
|
||||
Free(info);
|
||||
return;
|
||||
@ -9216,7 +9179,7 @@ RETRY:
|
||||
size_needed = 0;
|
||||
|
||||
// Examine the needed size
|
||||
ret = w32net->GetIfTable(p, &size_needed, 0);
|
||||
ret = GetIfTable(p, &size_needed, 0);
|
||||
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
// Re-allocate the memory block of the needed size
|
||||
@ -9232,7 +9195,7 @@ FAILED:
|
||||
}
|
||||
|
||||
// Actually get
|
||||
ret = w32net->GetIfTable(p, &size_needed, FALSE);
|
||||
ret = GetIfTable(p, &size_needed, FALSE);
|
||||
if (ret != NO_ERROR)
|
||||
{
|
||||
// Acquisition failure
|
||||
@ -9297,7 +9260,7 @@ RETRY:
|
||||
size_needed = 0;
|
||||
|
||||
// Examine the needed size
|
||||
ret = w32net->GetIfTable(p, &size_needed, 0);
|
||||
ret = GetIfTable(p, &size_needed, 0);
|
||||
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
// Re-allocate the memory block of the needed size
|
||||
@ -9314,7 +9277,7 @@ FAILED:
|
||||
}
|
||||
|
||||
// Actually get
|
||||
ret = w32net->GetIfTable(p, &size_needed, FALSE);
|
||||
ret = GetIfTable(p, &size_needed, FALSE);
|
||||
if (ret != NO_ERROR)
|
||||
{
|
||||
// Acquisition failure
|
||||
@ -9379,19 +9342,15 @@ bool Win32GetDnsSuffix(char *domain, UINT size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (w32net->GetAdaptersAddresses == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
info_size = 0;
|
||||
info = ZeroMalloc(sizeof(IP_ADAPTER_ADDRESSES_XP));
|
||||
if (w32net->GetAdaptersAddresses(AF_INET, 0, NULL, info, &info_size) == ERROR_BUFFER_OVERFLOW)
|
||||
if (GetAdaptersAddresses(AF_INET, 0, NULL, info, &info_size) == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
Free(info);
|
||||
info = ZeroMalloc(info_size);
|
||||
}
|
||||
if (w32net->GetAdaptersAddresses(AF_INET, 0, NULL, info, &info_size) != NO_ERROR)
|
||||
if (GetAdaptersAddresses(AF_INET, 0, NULL, info, &info_size) != NO_ERROR)
|
||||
{
|
||||
Free(info);
|
||||
return false;
|
||||
@ -9429,18 +9388,15 @@ bool Win32GetDefaultDns(IP *ip, char *domain, UINT size)
|
||||
return false;
|
||||
}
|
||||
Zero(ip, sizeof(IP));
|
||||
if (w32net->GetNetworkParams == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
info_size = 0;
|
||||
info = ZeroMallocFast(sizeof(FIXED_INFO));
|
||||
if (w32net->GetNetworkParams(info, &info_size) == ERROR_BUFFER_OVERFLOW)
|
||||
if (GetNetworkParams(info, &info_size) == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
Free(info);
|
||||
info = ZeroMallocFast(info_size);
|
||||
}
|
||||
if (w32net->GetNetworkParams(info, &info_size) != NO_ERROR)
|
||||
if (GetNetworkParams(info, &info_size) != NO_ERROR)
|
||||
{
|
||||
Free(info);
|
||||
return false;
|
||||
@ -9485,9 +9441,7 @@ void Win32DeleteRouteEntry(ROUTE_ENTRY *e)
|
||||
p = ZeroMallocFast(sizeof(MIB_IPFORWARDROW));
|
||||
Win32RouteEntryToIpForwardRow(p, e);
|
||||
|
||||
// Delete
|
||||
w32net->DeleteIpForwardEntry(p);
|
||||
|
||||
DeleteIpForwardEntry(p);
|
||||
Free(p);
|
||||
}
|
||||
|
||||
@ -9513,8 +9467,7 @@ bool Win32AddRouteEntry(ROUTE_ENTRY *e, bool *already_exists)
|
||||
p = ZeroMallocFast(sizeof(MIB_IPFORWARDROW));
|
||||
Win32RouteEntryToIpForwardRow(p, e);
|
||||
|
||||
// Adding
|
||||
err = w32net->CreateIpForwardEntry(p);
|
||||
err = CreateIpForwardEntry(p);
|
||||
if (err != 0)
|
||||
{
|
||||
if (err == ERROR_OBJECT_ALREADY_EXISTS)
|
||||
@ -9556,7 +9509,7 @@ RETRY:
|
||||
size_needed = 0;
|
||||
|
||||
// Examine the needed size
|
||||
ret = w32net->GetIpForwardTable(p, &size_needed, 0);
|
||||
ret = GetIpForwardTable(p, &size_needed, 0);
|
||||
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
// Re-allocate the memory block of the needed size
|
||||
@ -9573,7 +9526,7 @@ FAILED:
|
||||
}
|
||||
|
||||
// Actually get
|
||||
ret = w32net->GetIpForwardTable(p, &size_needed, FALSE);
|
||||
ret = GetIpForwardTable(p, &size_needed, FALSE);
|
||||
if (ret != NO_ERROR)
|
||||
{
|
||||
// Acquisition failure
|
||||
@ -9676,16 +9629,8 @@ void Win32RouteEntryToIpForwardRow(void *ip_forward_row, ROUTE_ENTRY *entry)
|
||||
}
|
||||
// Metric
|
||||
r->dwForwardMetric1 = entry->Metric;
|
||||
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
r->dwForwardMetric2 = r->dwForwardMetric3 = r->dwForwardMetric4 = r->dwForwardMetric5 = INFINITE;
|
||||
}
|
||||
else
|
||||
{
|
||||
r->dwForwardMetric2 = r->dwForwardMetric3 = r->dwForwardMetric4 = r->dwForwardMetric5 = 0;
|
||||
r->dwForwardAge = 163240;
|
||||
}
|
||||
|
||||
// Interface ID
|
||||
r->dwForwardIfIndex = entry->InterfaceID;
|
||||
@ -9746,144 +9691,11 @@ void Win32InitSocketLibrary()
|
||||
WSADATA data;
|
||||
Zero(&data, sizeof(data));
|
||||
WSAStartup(MAKEWORD(2, 2), &data);
|
||||
|
||||
// Load the DLL functions
|
||||
w32net = ZeroMalloc(sizeof(NETWORK_WIN32_FUNCTIONS));
|
||||
w32net->hIpHlpApi32 = LoadLibrary("iphlpapi.dll");
|
||||
w32net->hIcmp = LoadLibrary("icmp.dll");
|
||||
|
||||
if (w32net->hIpHlpApi32 != NULL)
|
||||
{
|
||||
w32net->CreateIpForwardEntry =
|
||||
(DWORD (__stdcall *)(PMIB_IPFORWARDROW))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "CreateIpForwardEntry");
|
||||
|
||||
w32net->DeleteIpForwardEntry =
|
||||
(DWORD (__stdcall *)(PMIB_IPFORWARDROW))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "DeleteIpForwardEntry");
|
||||
|
||||
w32net->GetIfTable =
|
||||
(DWORD (__stdcall *)(PMIB_IFTABLE, PULONG, BOOL))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "GetIfTable");
|
||||
|
||||
w32net->GetIfTable2 =
|
||||
(DWORD (__stdcall *)(void **))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "GetIfTable2");
|
||||
|
||||
w32net->FreeMibTable =
|
||||
(void (__stdcall *)(PVOID))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "FreeMibTable");
|
||||
|
||||
w32net->GetIpForwardTable =
|
||||
(DWORD (__stdcall *)(PMIB_IPFORWARDTABLE, PULONG, BOOL))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "GetIpForwardTable");
|
||||
|
||||
w32net->GetNetworkParams =
|
||||
(DWORD (__stdcall *)(PFIXED_INFO,PULONG))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "GetNetworkParams");
|
||||
|
||||
w32net->GetAdaptersAddresses =
|
||||
(ULONG (__stdcall *)(ULONG,ULONG,PVOID,PIP_ADAPTER_ADDRESSES,PULONG))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "GetAdaptersAddresses");
|
||||
|
||||
w32net->IpRenewAddress =
|
||||
(DWORD (__stdcall *)(PIP_ADAPTER_INDEX_MAP))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "IpRenewAddress");
|
||||
|
||||
w32net->IpReleaseAddress =
|
||||
(DWORD (__stdcall *)(PIP_ADAPTER_INDEX_MAP))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "IpReleaseAddress");
|
||||
|
||||
w32net->GetInterfaceInfo =
|
||||
(DWORD (__stdcall *)(PIP_INTERFACE_INFO, PULONG))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "GetInterfaceInfo");
|
||||
|
||||
w32net->GetAdaptersInfo =
|
||||
(DWORD (__stdcall *)(PIP_ADAPTER_INFO, PULONG))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "GetAdaptersInfo");
|
||||
|
||||
w32net->GetExtendedTcpTable =
|
||||
(DWORD (__stdcall *)(PVOID,PDWORD,BOOL,ULONG,_TCP_TABLE_CLASS,ULONG))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "GetExtendedTcpTable");
|
||||
|
||||
w32net->AllocateAndGetTcpExTableFromStack =
|
||||
(DWORD (__stdcall *)(PVOID *,BOOL,HANDLE,DWORD,DWORD))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "AllocateAndGetTcpExTableFromStack");
|
||||
|
||||
w32net->GetTcpTable =
|
||||
(DWORD (__stdcall *)(PMIB_TCPTABLE,PDWORD,BOOL))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "GetTcpTable");
|
||||
|
||||
w32net->NotifyRouteChange =
|
||||
(DWORD (__stdcall *)(PHANDLE,LPOVERLAPPED))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "NotifyRouteChange");
|
||||
|
||||
w32net->CancelIPChangeNotify =
|
||||
(BOOL (__stdcall *)(LPOVERLAPPED))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "CancelIPChangeNotify");
|
||||
|
||||
w32net->NhpAllocateAndGetInterfaceInfoFromStack =
|
||||
(DWORD (__stdcall *)(IP_INTERFACE_NAME_INFO **,PDWORD,BOOL,HANDLE,DWORD))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "NhpAllocateAndGetInterfaceInfoFromStack");
|
||||
|
||||
w32net->IcmpCreateFile =
|
||||
(HANDLE (__stdcall *)())
|
||||
GetProcAddress(w32net->hIpHlpApi32, "IcmpCreateFile");
|
||||
|
||||
w32net->IcmpCloseHandle =
|
||||
(BOOL (__stdcall *)(HANDLE))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "IcmpCloseHandle");
|
||||
|
||||
w32net->IcmpSendEcho =
|
||||
(DWORD (__stdcall *)(HANDLE,IPAddr,LPVOID,WORD,PIP_OPTION_INFORMATION,LPVOID,DWORD,DWORD))
|
||||
GetProcAddress(w32net->hIpHlpApi32, "IcmpSendEcho");
|
||||
}
|
||||
|
||||
if (w32net->hIcmp != NULL)
|
||||
{
|
||||
if (w32net->IcmpCreateFile == NULL || w32net->IcmpCloseHandle == NULL || w32net->IcmpSendEcho == NULL)
|
||||
{
|
||||
w32net->IcmpCreateFile =
|
||||
(HANDLE (__stdcall *)())
|
||||
GetProcAddress(w32net->hIcmp, "IcmpCreateFile");
|
||||
|
||||
w32net->IcmpCloseHandle =
|
||||
(BOOL (__stdcall *)(HANDLE))
|
||||
GetProcAddress(w32net->hIcmp, "IcmpCloseHandle");
|
||||
|
||||
w32net->IcmpSendEcho =
|
||||
(DWORD (__stdcall *)(HANDLE,IPAddr,LPVOID,WORD,PIP_OPTION_INFORMATION,LPVOID,DWORD,DWORD))
|
||||
GetProcAddress(w32net->hIcmp, "IcmpSendEcho");
|
||||
}
|
||||
}
|
||||
|
||||
if (w32net->IcmpCreateFile == NULL || w32net->IcmpCloseHandle == NULL || w32net->IcmpSendEcho == NULL)
|
||||
{
|
||||
w32net->IcmpCreateFile = NULL;
|
||||
w32net->IcmpCloseHandle = NULL;
|
||||
w32net->IcmpSendEcho = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Release of the socket library
|
||||
void Win32FreeSocketLibrary()
|
||||
{
|
||||
if (w32net != NULL)
|
||||
{
|
||||
if (w32net->hIpHlpApi32 != NULL)
|
||||
{
|
||||
FreeLibrary(w32net->hIpHlpApi32);
|
||||
}
|
||||
|
||||
if (w32net->hIcmp != NULL)
|
||||
{
|
||||
FreeLibrary(w32net->hIcmp);
|
||||
}
|
||||
|
||||
Free(w32net);
|
||||
w32net = NULL;
|
||||
}
|
||||
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
@ -10715,16 +10527,6 @@ ROUTE_ENTRY *GetBestRouteEntryFromRouteTableEx(ROUTE_TABLE *table, IP *ip, UINT
|
||||
dest = IPToUINT(&tmp->DestIP);
|
||||
gateway = IPToUINT(&tmp->GatewayIP);
|
||||
mask = IPToUINT(&tmp->DestMask);
|
||||
if ((dest & mask) == (gateway & mask))
|
||||
{
|
||||
#ifdef OS_WIN32
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
// Adjust for Windows
|
||||
ret->PPPConnection = true;
|
||||
}
|
||||
#endif // OS_WIN32
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -13277,14 +13079,6 @@ SOCK *ListenEx62(UINT port, bool local_only, bool enable_ca)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef OS_WIN32
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
// Disable the Conditional Accept due to a bug in Windows
|
||||
enable_ca = false;
|
||||
}
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Initialization
|
||||
Zero(&addr, sizeof(addr));
|
||||
Zero(&in, sizeof(in));
|
||||
@ -13325,15 +13119,11 @@ SOCK *ListenEx62(UINT port, bool local_only, bool enable_ca)
|
||||
|
||||
#ifdef OS_WIN32
|
||||
if (enable_ca)
|
||||
{
|
||||
if (MsIsWinXPOrGreater())
|
||||
{
|
||||
setsockopt(s, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char *)&true_flag, sizeof(bool));
|
||||
|
||||
backlog = 1;
|
||||
}
|
||||
}
|
||||
#endif // OS_WIN32
|
||||
#endif
|
||||
|
||||
if (listen(s, backlog))
|
||||
{
|
||||
@ -13382,14 +13172,6 @@ SOCK *ListenEx2(UINT port, bool local_only, bool enable_ca, IP *listen_ip)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef OS_WIN32
|
||||
if (MsIsVista() == false)
|
||||
{
|
||||
// Disable the Conditional Accept due to a bug in Windows
|
||||
enable_ca = false;
|
||||
}
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Initialization
|
||||
Zero(&addr, sizeof(addr));
|
||||
Zero(&in, sizeof(in));
|
||||
@ -13436,14 +13218,10 @@ SOCK *ListenEx2(UINT port, bool local_only, bool enable_ca, IP *listen_ip)
|
||||
|
||||
#ifdef OS_WIN32
|
||||
if (enable_ca)
|
||||
{
|
||||
if (MsIsWinXPOrGreater())
|
||||
{
|
||||
setsockopt(s, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char *)&true_flag, sizeof(bool));
|
||||
|
||||
backlog = 1;
|
||||
}
|
||||
}
|
||||
#endif // OS_WIN32
|
||||
|
||||
if (listen(s, backlog))
|
||||
@ -13874,7 +13652,6 @@ int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool
|
||||
UINT zero = 0;
|
||||
UINT tmp = 0;
|
||||
DWORD ret_size = 0;
|
||||
bool is_nt = false;
|
||||
// Validate arguments
|
||||
if (s == INVALID_SOCKET || addr == NULL)
|
||||
{
|
||||
@ -13885,8 +13662,6 @@ int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool
|
||||
timeout = TIMEOUT_TCP_PORT_CHECK;
|
||||
}
|
||||
|
||||
is_nt = OS_IS_WINDOWS_NT(GetOsInfo()->OsType);
|
||||
|
||||
// Create an event
|
||||
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
|
||||
@ -13911,7 +13686,7 @@ int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool
|
||||
int err = WSAGetLastError();
|
||||
//Debug("err=%u\n", err);
|
||||
//Debug("cancel_flag=%u\n", *cancel_flag);
|
||||
if (timeouted && ((err == WSAEALREADY) || (err == WSAEWOULDBLOCK && !is_nt)))
|
||||
if (timeouted && err == WSAEALREADY)
|
||||
{
|
||||
// Time-out
|
||||
ok = false;
|
||||
@ -13923,12 +13698,12 @@ int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
if (err == WSAEISCONN || (err == WSAEINVAL && is_nt))
|
||||
if (err == WSAEISCONN || err == WSAEINVAL)
|
||||
{
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
if (((start_time + (UINT64)timeout) <= Tick64()) || (err != WSAEWOULDBLOCK && err != WSAEALREADY && (is_nt || err != WSAEINVAL)))
|
||||
if (((start_time + (UINT64)timeout) <= Tick64()) || (err != WSAEWOULDBLOCK && err != WSAEALREADY))
|
||||
{
|
||||
// Failure (timeout)
|
||||
break;
|
||||
|
@ -1004,7 +1004,6 @@ void Win32CleanupSockEvent(SOCK_EVENT *event);
|
||||
bool Win32WaitSockEvent(SOCK_EVENT *event, UINT timeout);
|
||||
bool Win32GetDefaultDns(IP *ip, char *domain, UINT size);
|
||||
bool Win32GetDnsSuffix(char *domain, UINT size);
|
||||
void Win32RenewDhcp9x(UINT if_id);
|
||||
void Win32ReleaseDhcp9x(UINT if_id, bool wait);
|
||||
void Win32FlushDnsCache();
|
||||
int CompareIpAdapterIndexMap(void *p1, void *p2);
|
||||
@ -1403,7 +1402,6 @@ void InjectNewReverseSocketToAccept(SOCK *listen_sock, SOCK *s, IP *client_ip, U
|
||||
bool NewTcpPair(SOCK **s1, SOCK **s2);
|
||||
SOCK *ListenAnyPortEx2(bool local_only, bool disable_ca);
|
||||
|
||||
bool IsIcmpApiSupported();
|
||||
ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UINT timeout);
|
||||
void IcmpApiFreeResult(ICMP_RESULT *ret);
|
||||
|
||||
|
@ -630,22 +630,6 @@ char *GetTableStr(char *name)
|
||||
return "";
|
||||
}
|
||||
|
||||
#ifdef OS_WIN32
|
||||
if (StrCmpi(name, "DEFAULT_FONT") == 0)
|
||||
{
|
||||
if (_II("LANG") == 2)
|
||||
{
|
||||
UINT os_type = GetOsType();
|
||||
if (OS_IS_WINDOWS_9X(os_type) ||
|
||||
GET_KETA(os_type, 100) <= 4)
|
||||
{
|
||||
// Use the SimSun font in Windows 9x, Windows NT 4.0, Windows 2000, Windows XP, and Windows Server 2003
|
||||
return "SimSun";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Search
|
||||
t = FindTable(name);
|
||||
if (t == NULL)
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define WINVER 0x0502
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <Dbghelp.h>
|
||||
@ -501,7 +501,7 @@ DIRLIST *Win32EnumDirExW(wchar_t *dirname, COMPARE *compare)
|
||||
CombinePathW(fullpath, sizeof(fullpath), dirname2, f->FileNameW);
|
||||
|
||||
// Attempt to get the file information
|
||||
if (MsIsNt())
|
||||
if (true)
|
||||
{
|
||||
HANDLE h = CreateFileW(fullpath, 0,
|
||||
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
@ -913,7 +913,7 @@ void Win32GetOsInfo(OS_INFO *info)
|
||||
|
||||
info->OsType = Win32GetOsType();
|
||||
info->OsServicePack = os.wServicePackMajor;
|
||||
if (OS_IS_WINDOWS_NT(info->OsType))
|
||||
if (true)
|
||||
{
|
||||
char *s;
|
||||
char *keyname = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
||||
@ -951,19 +951,6 @@ void Win32GetOsInfo(OS_INFO *info)
|
||||
}
|
||||
info->KernelVersion = CopyStr(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
OSVERSIONINFO os;
|
||||
Zero(&os, sizeof(os));
|
||||
os.dwOSVersionInfoSize = sizeof(os);
|
||||
GetVersionEx(&os);
|
||||
Format(tmp, sizeof(tmp), "Build %u %s", LOWORD(os.dwBuildNumber), os.szCSDVersion);
|
||||
Trim(tmp);
|
||||
info->OsVersion = CopyStr(tmp);
|
||||
info->OsSystemName = CopyStr("Windows");
|
||||
info->KernelName = CopyStr("Windows 9x Kernel");
|
||||
info->KernelVersion = CopyStr(tmp);
|
||||
}
|
||||
|
||||
info->OsProductName = CopyStr(OsTypeToStr(info->OsType));
|
||||
info->OsVendorName = CopyStr("Microsoft Corporation");
|
||||
|
Loading…
Reference in New Issue
Block a user