( Index )

Brief Information about the January '11 CSIG Meeting

HostShell - A Shell Program to Manipulate the HOSTS Virus and Spyware Protection   by B. Arnold

Host Shell Image    Warning Message

Welcome to the CSIG, a Special Interest Group of the ACGNJ. This is an exciting time for the C Language programming since Microsoft now has 4 different language compilers: C++, C++ Express, C-Sharp, and C-Sharp Express. These are all capable of creating Windows (tm) programs. (Some are FREE!)

New for this month is the following application. In addition to normal .Net code, we will be addressing "SECURITY ISSUES" since the program accesses protected system files and requires a MANIFEST file.

Object: To provide extra user features for the HOSTS file obtained from

The HOSTS file is part of the Internet software on all computers, but the standard file provides no extra protection. From Wikipedia: Specially crafted entries in the hosts file may be used to block online advertising, or the domains of known malicious resources and servers that contain spyware, adware, and other malware.

The above web site provides a system that blocks approximately 20,000 bad web sites. It blocks parasites, hijackers and unwanted Adware/Spyware programs. Browsing the Internet is thus a more secure activity with less risk of viruses and malware infections. HOSTS and Hostshell may be used in conjunction with other anti-virus, etc. programs to make your computer bullet-proof.

Occasionally, one of the black-listed sites is needed by the user. For example, many shopping networks are bad but there are a few good ones. A case in point was a user who wanted to download a particular discount coupon and was blocked. This HOSTSHELL provides a means of editing the database or renaming the database to effectively disable the security that it provides. Rename back to the original afterward. (Note: Clear the DNS cache after making changes.)

Additional: Sophisticated malware/virus programs may try to change your Hosts file. This utility displays the modification date of the Hosts file every 3 seconds to help you combat this issue.

Installation: Go to the reference web site and follow instructions to download and install. Thereafter, use this application to modify and control.

The program uses some of the most sophisticated Dot Net Library functions including the following:

Dialog Box Functions and Objects, Process(), MessageBox::Show(), RedirectStandardOutput, WorkingDirectory, SystemDirectory, and others.

There are a number of ways to refer to Microsoft's latest compilers and code. Here's what Wikipedia says: The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft .NET Framework. The specification defines an environment that allows multiple high-level languages to be used on different computer platforms without being rewritten for specific architectures.

Microsoft .Net Framework 3.5
C++ 9.0, etc.
.Net 3.5, etc.
Common Language Infrastructure

Sample Code

// Edit the HOSTS file using Notepad.
private: System::Void EditButton_Click(System::Object^ sender, System::EventArgs^ e) 
if (!File::Exists(System::Environment::SystemDirectory + "\\drivers\\etc\\HOSTS."))
	MessageBox::Show("Can't find HOSTS.", "Abort"); return;
Process ^ mEdit = gcnew Process();

mEdit->StartInfo->WorkingDirectory = System::Environment::SystemDirectory + "\\drivers\\etc";
mEdit->StartInfo->FileName = "notepad.exe";
mEdit->StartInfo->Arguments = "HOSTS.";
this->Enabled = false;
	mEdit->Start(); // Launch the program
	mEdit->WaitForExit(); // and wait for it to be closed.
catch (Exception ^ex)
	MessageBox::Show(ex->Message, "Application Launch Error" );
this->Enabled = true;


Source Code Files

For help, email me at b a r n o l d @ i e e e . o r g
Back to C++ Main Page