示例#1
0
UCHAR SeIkeStrToPhase2HashId(char *name)
{
	if (SeStartWith(name, "SHA-1") || SeStartWith("SHA-1", name))
	{
		return SE_IKE_P2_HMAC_SHA1;
	}

	return 0;
}
示例#2
0
// 文字列をアルゴリズム名に変換
UCHAR SeIkeStrToPhase1CryptId(char *name)
{
	if (SeStartWith(name, "3DES") || SeStartWith("3DES", name))
	{
		return SE_IKE_P1_CRYPTO_3DES_CBC;
	}
	else if (SeStartWith(name, "DES") || SeStartWith("DES", name))
	{
		return SE_IKE_P1_CRYPTO_DES_CBC;
	}
	else
	{
		return 0;
	}
}
示例#3
0
UCHAR SeIkeStrToPhase2CryptId(char *name)
{
	if (SeStartWith(name, "3DES") || SeStartWith("3DES", name))
	{
		return SE_IKE_TRANSFORM_ID_P2_ESP_3DES;
	}
	else if (SeStartWith(name, "DES") || SeStartWith("DES", name))
	{
		return SE_IKE_TRANSFORM_ID_P2_ESP_DES;
	}
	else
	{
		return 0;
	}
}
示例#4
0
bool IsWin10PcapFile(char *filename)
{
	char tmp[1024];
	if (filename == NULL)
	{
		return false;
	}

	SeZero(tmp, sizeof(tmp));
	MsGetFileVersion(filename, tmp, sizeof(tmp));

	if (SeStartWith(tmp, "10,"))
	{
		return true;
	}

	return false;
}
示例#5
0
// 文字列をパスワードに変換
SE_BUF *SeIkeStrToPassword(char *str)
{
	SE_BUF *b;
	// 引数チェック
	if (str == NULL)
	{
		return SeNewBuf();
	}

	if (SeStartWith(str, "0x") == false)
	{
		// 文字列をそのまま使用
		b = SeNewBuf();
		SeWriteBuf(b, str, SeStrLen(str));
	}
	else
	{
		// 16 進として解釈
		b = SeStrToBin(str + 2);
	}

	return b;
}
示例#6
0
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{
	bool uninstall_mode = false;
	char exe_name[MAX_PATH];
	char exe_dir[MAX_PATH];
	UINT os_ver = GetWindowsVersion();

	CoInitialize(NULL);

	DisableWow64FsRedirection();

	if (SeStartWith(CmdLine, "/uninstall"))
	{
		uninstall_mode = true;
	}

	GetModuleFileNameA(hInst, exe_name, sizeof(exe_name));
	SeGetDirNameFromFilePath(exe_dir, sizeof(exe_dir), exe_name);

	if (uninstall_mode == false)
	{
		char driver_inf_filename[MAX_PATH] = {0};
		bool install_driver = false;

		// Check the Windows version
		if (os_ver == OS_UNKNOWN)
		{
			MessageBoxA(NULL, "This operating system is not supported by Win10Pcap.\r\n\r\n"
				"Win10Pcap requires Windows 7, Server 2008 R2, Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2 or Windows 10.",
				INSTALLER_TITLE,
				MB_ICONSTOP | MB_SYSTEMMODAL);
			return -1;
		}

		SeStrCpy(driver_inf_filename, sizeof(driver_inf_filename), exe_dir);
		if (os_ver == OS_WIN10)
		{
			SeStrCat(driver_inf_filename, sizeof(driver_inf_filename), "\\drivers\\win10");
		}
		else
		{
			SeStrCat(driver_inf_filename, sizeof(driver_inf_filename), "\\drivers\\win78");
		}
		SeStrCat(driver_inf_filename, sizeof(driver_inf_filename), "\\Win10Pcap.inf");

		// Install the device driver
		if (Is64BitCode())
		{
			// x64
			install_driver = true;
		}
		else if (IsWow64() == false)
		{
			// x86
			install_driver = true;
		}
		else
		{
			// Do nothing.
		}

		if (install_driver)
		{
LABEL_RETRY_INSTALL_DRIVER:

			if (InstallNdisProtocolDriver(driver_inf_filename, L"Win10Pcap", 60 * 1000) == false)
			{
				if (MessageBoxA(NULL, "The install process of the Win10Pcap NDIS device driver failed.", 
					INSTALLER_TITLE,
					MB_ICONEXCLAMATION | MB_SYSTEMMODAL | MB_RETRYCANCEL) == IDRETRY)
				{
					goto LABEL_RETRY_INSTALL_DRIVER;
				}
				else
				{
					return -1;
				}
			}

			MsStartService("Win10Pcap");
		}

		if (InstallDllToSystem32(exe_dir, "Packet.dll", "Packet.dll") == false ||
			InstallDllToSystem32(exe_dir, "wpcap.dll", "wpcap.dll") == false)
		{
			return -1;
		}

		if (Is64BitCode() == false && Is64BitWindows())
		{
			// Run x64
			char x64_exe[MAX_PATH];

			wsprintfA(x64_exe, "%s\\..\\x64\\Installer.exe", exe_dir);

			Win32RunAndWaitProcess(x64_exe, CmdLine, false, false, INFINITE);
		}
	}
	else
	{
		bool uninstall_driver = false;

		UninstallDllFromSystem32("Packet.dll");
		UninstallDllFromSystem32("wpcap.dll");

		// Install the device driver
		if (Is64BitCode())
		{
			// x64
			uninstall_driver = true;
		}
		else if (IsWow64() == false)
		{
			// x86
			uninstall_driver = true;
		}
		else
		{
			// Do nothing.
		}

		if (uninstall_driver)
		{
LABEL_RETRY_UNINSTALL_DRIVER:
			if (UninstallNdisProtocolDriver(L"Win10Pcap", 60 * 1000) == false)
			{
				if (MessageBoxA(NULL, "The uninstall process of the Win10Pcap NDIS device driver failed.", 
					INSTALLER_TITLE,
					MB_ICONEXCLAMATION | MB_SYSTEMMODAL | MB_RETRYCANCEL) == IDRETRY)
				{
					goto LABEL_RETRY_UNINSTALL_DRIVER;
				}
			}
		}

		if (Is64BitCode() == false && Is64BitWindows())
		{
			// Run x64
			char x64_exe[MAX_PATH];

			wsprintfA(x64_exe, "%s\\..\\x64\\Installer.exe", exe_dir);

			Win32RunAndWaitProcess(x64_exe, CmdLine, false, false, INFINITE);
		}
	}

	CoUninitialize();

	return 0;
}