Techcone - Your Daily Dose Of Technology


Playing With Autorun.inf

USB drives are today's small nifty devices which prove very useful for day to day work. But this small device also proves to be havoc in case of viruses. So I have devoted this post towards the tutorial of the file that initiates this virus that is autorun.inf.

Autorun.inf is that file which is responsible to perform certain actions automatically and customize its look in My Computer. This post will deal with various aspects of autorun.inf and the process by which you can yourself create your custom autorun.inf.


Autorun.inf File Structure

The autorun.inf file is a simple text file that can be opened up in any text editor (e.g. notepad). It always starts with a section header of:

[autorun]

Below this header is a list of different options. Each of these options is in the following format:

option=value

where option is the option that you want to set and value is the value that you are setting for that option.

That is all there really is to understand about the structure of an autorun.inf file. Now we will move on and do some cool stuff with option.

Creating Custom Name For Your USB Drive

If you would like your USB drive to display a specific name other than the drive label created when it is formatted, use the label option. For example, if I wanted to call my drive TechCone Drive, I would add this to my autorun.inf file:

label=TechCone Drive

Now, when you look at your USB drive in My Computer, it will say TechCone Drive by the drive letter.

Setting a Custom Icon

To create a custom icon for your USB drive, use the icon option. Set it to the name of the icon file.

For example, if you had an icon on the root of the USB drive called TechCone.ico and you wanted this to be the icon that showed up for the USB drive, you would enter:

icon=TechCone.ico

If you have an executable with a nice icon, you can specify it as the icon file. For example:

icon=TechCone.exe

This is valid as long as TechCone.exe is available on the root of the USB drive.

Note: Since drive letters can change for USB drives, the file path is relative to the root of the drive. This means that if your USB drive is presently mounted on U: and your icon is located at U:\Icons\MyIcon.ico, then you would enter \Icons\MyIcon.ico for the value of this option.

Opening a File

If you wanted to view a file on your USB drive in the default application instead of running a program on the drive, you can substitute the open option for the shellexecute option. For example, if you wanted to open up a website called, oh, I don’t know, say http://techcone.blogspot.com in the default web browser, you could user the following:

shellexecute=http://techcone.blogspot.com

This will work for any file. This is the equivalent of using Start - Run… and then typing in a file name and clicking OK.

Adding Context Menu Items

When you right click your USB drive , options such as Open and Explore are available but you can also add your own. Cool ah!!

The first thing that we need to do is create an action, give it a name, and a message. We do all of this using the shell\verb option. For example, let’s say that we would like to create an action called cool. It does not matter what the action is called. It can be anything you want. We would also like to show the message Cool! I’m Drunk! in the context menu. We would simply add this line to autorun.inf:

shell\cool=Cool! I'm Drunk!

This will display Cool! I'm Drunk! in the context menu so that you can click on it. But, it doesn’t know what to do when you click on it. Tell the system by using shell\verb\command option. In our example, we want to run the drunk.exe application. Adding this line will do the trick:

shell\cool\command=drunk.exe

You can add as many of these line pairs as you want to make the context menu as custom as you want.

In The End

By now you should have got some idea about the working of the file and how it is boon for viruses. You can shoot your queries and comments.


Everything I post will be in your Inbox, Subscribe via email below:


Related Entries