Esempio n. 1
0
void CI8DeskSvr::AddWindowFireWall()
{
	WinXPSP2FireWall Fw;
	BOOL bOn = FALSE;
	Fw.IsWindowsFirewallOn(bOn);
	if (bOn)
	{
		wchar_t path[MAX_PATH] = {0};
		GetModuleFileNameW(NULL, path, MAX_PATH);
		Fw.AddApplication(path, L"I8DeskSvr");

		PathRemoveFileSpecW(path);
		lstrcatW(path, L"\\I8VDiskSvr.exe");
		Fw.AddApplication(path, L"I8VDiskSvr");

		PathRemoveFileSpecW(path);
		lstrcatW(path, L"\\DNAService\\DNAService.exe");
		Fw.AddApplication(path, L"DNAS");

		GetModuleFileNameW(NULL, path, MAX_PATH);
		PathRemoveFileSpecW(path);
		lstrcatW(path, L"\\SafeSvr\\KHPrtSvr.exe");
		Fw.AddApplication(path, L"I8DeskSafeSvr");

		GetModuleFileNameW(NULL, path, MAX_PATH);
		PathRemoveFileSpecW(path);
		lstrcatW(path, L"\\SafeSvr\\Server\\UndiskSafe.exe");
		Fw.AddApplication(path, L"I8DeskDisklessSafeSvr");
	}
}
Esempio n. 2
0
BOOL FireWallAddApplication(LPCWSTR lpszProcessImageFileName, LPCWSTR lpszRegisterName)
{
	try
	{
		COM _Com;

		if (GetOSMajorVersion() >= 6)
		{
			// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa366418(v=vs.85).aspx
			Win7FireWall fireWall;

			return fireWall.AddApplication(
					lpszProcessImageFileName, 
					lpszRegisterName);
		}
		else
		{
			WinXPSP2FireWall fireWall;
			if (FW_NOERROR == fireWall.Initialize())
			{
				if (FW_NOERROR == fireWall.AddApplication(
					lpszProcessImageFileName, 
					lpszRegisterName))
				{
					return TRUE;
				}
			}

			return FALSE;
		}
	}
	catch (...) 
	{
		return FALSE;
	}
}
Esempio n. 3
0
	void AddWindowFireWall()
	{
		WinXPSP2FireWall Fw;
		BOOL bOn = FALSE;
		Fw.Initialize();
		Fw.IsWindowsFirewallOn(bOn);
		if (bOn)
		{
			wchar_t path[MAX_PATH] = {0};
			GetModuleFileNameW(NULL, path, MAX_PATH);
			Fw.AddApplication(path, L"I8VDiskSvr");

			PathRemoveFileSpecW(path);
			lstrcatW(path, L"\\I8DeskSvr.exe");
			Fw.AddApplication(path, L"I8DeskSvr");

			PathRemoveFileSpecW(path);
			lstrcatW(path, L"\\DNAService\\DNAService.exe");
			Fw.AddApplication(path, L"DNAS");
		}
		Fw.Uninitialize();
	}