Showing posts with label system files. Show all posts
Showing posts with label system files. Show all posts

What are .INF files ??


INF file

An INF file (or Setup Information file) is a plain text file used by Microsoft Windows for installation of software and drivers. INF files are most commonly used for installing device drivers for hardware components. Windows includes IExpress.exe for the creation of INF-based installations. INF files are part of the Windows Setup API.

Structure of an INF file

The structure of an INF file is very similar to that of an INI file; it contains various sections that specify the files to be copied, changes to the registry etc. All INF files contain a [version] section with a Signature value specifying the version of Windows that the INF file is meant for. The signature is commonly $CHICAGO$ (for Windows 9x) or $WINDOWS NT$ (for Windows NT/2K/XP) Most of the remaining sections are user-defined and contain information specific to the component being installed.

Purpose of .INF Files

Ask just about any device driver writer, "What is the worst part of writing Windows device drivers?" and most will reply, "Writing .INF files!" The reason for this is that the documentation on .INF files in the DDK has not provided a procedural approach to describing .INF files, such as, "If you want to accomplish X, then do Y followed by Z".

This article will describe the basics of .INF files and how they are used in the installation of a device driver.

An .INF file can do many things; however, 97% of all .INF files really only perform three tasks:

1.)Identify the driver for a particular device. This is done using one or more Hardware IDs or Compatible IDs. The system device installer will take the Hardware IDs and Compatible IDs that were reported for a device (by its bus driver), and try and find an exact character for character match in an .INF file. When a match is found, then the system device installer knows that the .INF file describes the driver(s) for the device.

2.)Copy files from the installation medium to the system. In addition to the driver binary (the .SYS file), driver packages may also include DLLs, co-installers, applications, or any other type of file.

3.)Add entries to the registry. This describes the device and its relationship to other devices, provides for device or driver specific configuration information, and describes the driver "service" to the service control manager.

Thats it. Sounds simple, doesnt it? Actually, it is pretty simple (no, Im not kidding!).

"Youre right", replied the little bear, "even a Bear of Little Brain understands that"

The two most confusing aspects of .INF files are usually:

1.)The .INF file is not 'run from the beginning to the end; individual sections in the .INF file are 'run based upon the phase of the installation process.

2.)Most of the sections in the .INF file are actually part of a well-defined hierarchy. This fact is obscured by the squashing of the hierarchy into a flat text file.


Creating International INF Files

An INF that will be used in an international market should use %strkey% tokens for all user-viewable text. The string tokens are defined in a [Strings] section, which is typically at the end of the INF file.

To create a single international INF file, the INF can have a set of locale-specific Strings.LanguageID sections, as described in the reference page for the INF Strings Section in the Windows 2000 DDK documentation.

Alternatively, you can create a separate INF for each locale. To reduce duplication and ease maintenance, you can create a main INF file with all the necessary sections and entries, except for the Strings section. Then create a second set of files, where each file contains just the Strings section for a supported locale. Concatenate the main file with each strings file to generate the locale-specific INF files.

If an INF contains characters outside the ASCII range (outside the range 0-127), the INF should be in Unicode format. To create such a file, for example, save the INF as a Unicode file from an application like Notepad. If the INF is not in Unicode format, Setup uses the current locale to translate characters. If the INF is in Unicode format, Setup uses the full character set.

commonly used sections


General Syntax Rules for INF Files

An INF file is a text file organized into named sections. Some sections have system-defined names and some sections have names determined by the writer of the INF file.

Each section contains section-specific entries, which are interpreted by Setup software (class installers, co-installers, SetupAPI). Some entries begin with a predefined keyword. These entries are called directives.

Some INF file entries are essentially pointers from one section to another, for a specific purpose. For example, an INF AddReg directive identifies a section containing entries that instruct Setup to modify the registry. These entries sometimes include additional arguments (required or optional) for Setup to interpret during installation.

Other INF file entries do not point to other sections, but simply supply information that Setup uses during installation, such as file names, registry values, hardware configuration information, flags, and so on. For example, an INF DriverVer directive supplies driver version information.

When Setup begins an installation, it first looks for an INF Version section to verify the validity of the INF file and to determine where installation files are located. It then starts the installation by finding an INF Manufacturer section, which will contain directives to INF Models sections, which in turn provide directives leading to various INF DDInstall sections, based on the hardware ID of the device being installed.

The following syntax rules govern the required and optional contents of INF files, the format of section names by using string tokens, and line format, continuation, and comments.

Sample INF File


The following is a sample INF file that demonstrates the syntax understood by the Internet Component Download service.

_________________________


;Sample INF file for CIRC3.OCX
[Add.Code]
circ3.ocx=circ3.ocx
random.dll=random.dll
mfc40.dll=mfc40.dll
example.ocx=example.ocx

[circ3.ocx]
; Lines below specify that the specified circ3.ocx (clsid, version)
; needs to be installed on the system. If it doesn't exist already,
; it can be downloaded from the given location (a .cab file).
; Note: if "thiscab" is specified instead of the file location,
; it is assumed that the desired file is present in the same .cab
; cabinet that the INF originated from. Otherwise, if the location
; pointed to is a different .cab, the new cabinet is also downloaded
; and unpacked in order to extract the desired file.
file=http://www.code.com/circ3/circ3.cab
clsid={9DBAFCCF-592F-101B-85CE-00608CEC297B}
; Note that the {}s are required when entering a in the INF file.
; This is slightly different from the HTML syntax for inserting CLSIDs
; in an tag.
FileVersion=1,0,0,143

[random.dll]
; Lines below specify that the random.dll needs to be installed in
; the system.
; If this doesn't exist already, it can be downloaded from the given
; location.
file=http:// www.code.com/circ3/random.dll
; Note that the FileVersion is optional, and it can also be left
; empty, meaning that any version is ok.
FileVersion=
DestDir=10

; DestDir can be set to 10 or 11 ( LDID_WIN or LDID_SYS by INF
; convention).
; This places files in \Windows or \Windows\System, respectively.
; If no dest dir is specified (typical case), code is installed in
; the occache directory.

[mfc40.dll]
; Leaving the file location empty specifies that the installation
; needs mfc40 (version 4,0,0,5), but it should not be downloaded.
; If this file is not already present on the client machine, component
; download fails.
file=
FileVersion=4,0,0,5

[example.ocx]
; Leaving the file location empty specifies that the installation
; needs the specified example.ocx (clsid, version), but it should not
; be downloaded.
; If this file is not already present on the client machine, component
; download fails.
file=clsid={DEADBEEF-592F-101B-85CE-00608CEC297B}
FileVersion=1,0,0,143

_______________________

Order of Processing and Execution of INF Files

The [Add.Code] section is processed in the order listed, but the files are installed and set up in reverse order. This means that typically you would list the main OCX file first in the INF file, followed by dependent DLLs. The dependent DLLs are guaranteed to be installed and available at registration time of the main OCX.

Unconditional hooks, those hooks in the [Setup Hooks] section in the INF file, are executed in the order listed in that section (Hook1 executes before Hook2). Conditional hooks, those hooks in the file sections referenced by file names in the [Add.Code] section, are executed in the order of the [Add.Code] section. Between conditional hooks and file section installation/setup, conditional hooks always get executed before file section installations/setups in the same .cab file. Between two file section installations/setups, the order of file installation and setup is the reverse of the listing in the [Add.Code] section. Between two conditional hooks, the order is the same as that listed in the [Add.Code] section. Note this different ordering rule between conditional hooks and file section installation and setup.


INF Size Limits

* A Windows 9x/Me INF file cannot be larger than 64 kilobytes. There is no practical limit to the size of an INF file for NT-based systems.
* The maximum length, in characters, of an INF file field, before string substitution and including a terminating NULL character, is 4096 (Windows Vista and later versions of Windows) and 512 (Windows Server 2003, Windows XP, and Windows 2000).
* After string substitution, the maximum length, in characters, of an INF file string is 4096, including a terminating NULL character.
* Note, however, that Plug and Play may impose a more restrictive limit for certain INF file fields that it recognizes or uses, such as device description, driver provider, and device manufacturer.

Autorun.inf, What is it?

Autorun.inf is the primary instruction file associated with the Autorun function. Autorun.inf itself is a simple text-based configuration file that tells the operating system which executable to start, which icon to use, and which additional menu commands to make available. In other words, autorun.inf Windows how to deal open the presentation and treat the contents of the CD.

The entire sequence is initiated when the "disk change notifcation" polling discovers a new disk in the CD or DVD ROM drive. Then, if the "Auto insert notification" feature is enabled (it is by default), Windows checks in the new disk's root directory for the existence of an "autorun.inf" file. If found, Windows then reads and follows the specific instructions this file defines. If no autorun.inf file is found, then Windows refers to the new disk by its serial number and executes the default actions associated with the (data or audio) content on the disk.


Autorun.inf Defines the following:


**The process or application that will automatically run when a disk is inserted Automatically run when CD is inserted
**Optionally, one can define the process or application that will run for specific Operating environments. Icon Representing CD or DVD
**The icon that will represent your application's CD or DVD when the drive is viewed with My Computer or Explorer.
**Menu Commands when CD-ROM is clicked Menu commands displayed when the user right-clicks the CD-ROM icon from My Computer or Explorer.


A simple Autorun.inf example:

[autorun]
open=autorun.exe
icon=autorun.ico

A complex Autorun.inf example:

This example is used in the following section for complete definition and descriptions.
________________________________________

[autorun]
open=filename.exe /argument1
icon=\foldername\filename.dll,5
[autorun.mips]
open=filenam2.exe
icon=filename.ico
[autorun.alpha]
open=filenam3.exe
icon=filename.ico
[autorun.ppc]
open=filenam4.exe
icon=filename.ico
shell\install = &Install
shell\install\command = setup.exe
shell\uninstall = &UnInstall
shell\uninstall\command = Uninstall.exe
shell\readme = &Read Me
shell\readme\command = notepad readme.txt
shell\help = &Help
shell\help\command = helpfilename.hlp


_________________________________________

Example Autorun File: Description:

[autorun] [autorun] is the primary, required section name.
open=filename.exe /argument1

Open is the keyword to determine what action to take upon insert notification.

filename.exe is the value defining the application that will be automatically started.
/argument1 is the argument, parameter or switch passed to the application being run. Logically, any command line parameters used must be supported by the application.
icon=\foldername\filename.dll,5

Icon is the keyword to determine the icon used for the disk.

filename.dll is the value defining the file containing the icon.
,5 is the argument to the icon resource defining which icon to display.



Note: By default, the system looks for the file in the root directory of the inserted disk. If you want to access a file located in a specific folder or subdirectory, specify a path relative to the root.

Example: open = foldername\filename.exe This will not change the current directory.

Although AutoPlay is the default menu item, you can define a different command to be the default by including the following line. shell = verb

When the user double-clicks on the icon, the command associated with this entry will be carried out.
Note: a more common method of defining the icon resouce is an explicit reference to a .ico file. Example: icon=autorun.ico

Note: The icon defined representing your application's CD or DVD is the drive icon as viewed with My Computer or Explorer. Valid file types containing icons include .ICO .BMP .EXE .DLL If the file includes more than one icon, by default, the second icon in the files icon resource will be displayed.


Example Autorun File: Description:
[autorun.mips] Defining the autorun items for a mips machine
open=filenam2.exe The platform specific application to run
icon=filename2.ico The platform specific autorun icon
[autorun.alpha] Defining the autorun items for a DEC Alphamachine
open=filenam3.exe The platform specific application to run
icon=filename3.ico The platform specific autorun icon
[autorun.ppc] Defining the autorun items for a Power PC
open=filenam4.exe The platform specific application to run
icon=filename4.ico The platform specific autorun icon
shell\install = &Install The Keyword defining a menu item and the Hot key for that item
shell\install\command = setup.exe The keyword defining the operation to perform when the user selects this item
shell\uninstall = &UnInstall Additional menu item example
shell\uninstall\command = Uninstall.exe Additional menu item example
shell\readme = &Read Me Additional menu item example
shell\readme\command = notepad readme.txt Additional menu item example
shell\help = &Help Additional menu item example
shell\help\command = helpfilename.hlp Additional menu item example


What is Operating System [O.S] and how it works ??



various operating systems use in today's computers



When you turn on your computer, it's nice to think that you're in control. There's the trusty computer mouse, which you can move anywhere on the screen, summoning up your music library or Internet browser at the slightest whim. Although it's easy to feel like a director in front of your desktop or laptop, there's a lot going on inside, and the real man behind the curtain handling the necessary tasks is the operating system.
­Most desktop or laptop PCs come pre -loaded with Microsoft Windows. Macintosh computers come pre-loaded with Mac OS X. Many corporate servers use the Linux or UNIX operating systems. The operating system (OS) is the first thing loaded onto the computer -- without the operating system, a computer is useless.

More recently, operating systems have started to pop up in smaller computers as well. If you like to tinker with electronic devices, you're probably pleased that operating systems can now be found on many of the devices we use every day, from cell phones to wireless access points. The computers used in these little devices have gotten so powerful that they can now actually run an operating system and applications. The computer in a typical modern cell phone is now more powerful than a desktop computer from 20 years ago, so this progression makes sense and is a natural development.
The purpose of an operating system is to organize and control hardware and software so that the device it lives in behaves in a flexible but predictable way. In this article, we'll tell you what a piece of software must do to be called an operating system, show you how the operating system in your desktop computer works and give you some examples of how to take control of the other operating systems around you.

What is an Operating System?

Not all computers have operating systems. The computer that controls the microwave oven in your kitchen, for example, doesn't need an operating system. It has one set of tasks to perform, very straightforward input to expect (a numbered keypad and a few pre-set buttons) and simple, never-changing hardware to control. For a computer like this, an operating system would be unnecessary baggage, driving up the development and manufacturing costs significantly and adding complexity where none is required. Instead, the computer in a microwave oven simply runs a single hard-wired program all the time.


For other devices, an operating system creates the ability to:

* serve a variety of purposes
* interact with users in more complicated ways
* keep up with needs that change over time

All desktop computers have operating systems. The most common are the Windows family of operating systems developed by Microsoft, the Macintosh operating systems developed by Apple and the UNIX family of operating systems (which have been developed by a whole history of individuals, corporations and collaborators). There are hundreds of other operating systems available for special-purpose applications, including specializations for mainframes, robotics, manufacturing, real-time control systems and so on.

In any device that has an operating system, there's usually a way to make changes to how the device works. This is far from a happy accident; one of the reasons operating systems are made out of portable code rather than permanent physical circuits is so that they can be changed or modified without having to scrap the whole device.
For a desktop computer user, this means you can add a new security update, system patch, new application or even an entirely new operating system rather than junk your computer and start again with a new one when you need to make a change. As long as you understand how an operating system works and how to get at it, in many cases you can change some of the ways it behaves. The same thing goes for your phone, too.

Regardless of what device an operating system runs, what exactly can it do?

Operating System Functions

At the simplest level, an operating system does two things:

1. It manages the hardware and software resources of the system. In a desktop computer, these resources include such things as the processor, memory, disk space and more (On a cell phone, they include the keypad, the screen, the address book, the phone dialer, the battery and the network connection).

2. It provides a stable, consistent way for applications to deal with the hardware without having to know all the details of the hardware.

The first task, managing the hardware and software resources, is very important, as various programs and input methods compete for the attention of the central processing unit (CPU)

The operating system controls every task
your computer
carries out and manages
system resources.

and demand memory, storage and input/output (I/O) bandwidth for their own purposes. In this capacity, the operating system plays the role of the good parent, making sure that each application gets the necessary resources while playing nicely with all the other applications, as well as husbanding the limited capacity of the system to the greatest good of all the users and applications.

The second task, providing a consistent application interface, is especially important if there is to be more than one of a particular type of computer using the operating system, or if the hardware making up the computer is ever open to change. A consistent application program interface (API) allows a software developer to write an application on one computer and have a high level of confidence that it will run on another computer of the same type, even if the amount of memory or the quantity of storage is different on the two machines.

Even if a particular computer is unique, an operating system can ensure that applications continue to run when hardware upgrades and updates occur. This is because the operating system -- not the application -- is charged with managing the hardware and the distribution of its resources. One of the challenges facing developers is keeping their operating systems flexible enough to run hardware from the thousands of vendors manufacturing computer equipment. Today's systems can accommodate thousands of different printers, disk drives and special peripherals in any possible combination.

Types of Operating Systems

Within the broad family of operating systems, there are generally four types, categorized based on the types of computers they control and the sort of applications they support. The categories are:

* Real-time operating system (RTOS) - Real-time operating systems are used to control machinery, scientific instruments and industrial systems. An RTOS typically has very little user-interface capability, and no end-user utilities, since the system will be a "sealed box" when delivered for use. A very important part of an RTOS is managing the resources of the computer so that a particular operation executes in precisely the same amount of time, every time it occurs. In a complex machine, having a part move more quickly just because system resources are available may be just as catastrophic as having it not move at all because the system is busy.

* Single-user, single task - As the name implies, this operating system is designed to manage the computer so that one user can effectively do one thing at a time. The Palm OS for Palm handheld computers is a good example of a modern single-user, single-task operating system.

* Single-user, multi-tasking - This is the type of operating system most people use on their desktop and laptop computers today. Microsoft's Windows and Apple's MacOS platforms are both examples of operating systems that will let a single user have several programs in operation at the same time. For example, it's entirely possible for a Windows user to be writing a note in a word processor while downloading a file from the Internet while printing the text of an e-mail message.

* Multi-user - A multi-user operating system allows many different users to take advantage of the computer's resources simultaneously. The operating system must make sure that the requirements of the various users are balanced, and that each of the programs they are using has sufficient and separate resources so that a problem with one user doesn't affect the entire community of users. Unix, VMS and mainframe operating systems, such as MVS, are examples of multi-user operating systems.

It's important to differentiate between multi-user operating systems and single-user operating systems that support networking. Windows 2000 and Novell Netware can each support hundreds or thousands of networked users, but the operating systems themselves aren't true multi-user operating systems. The system administrator is the only "user" for Windows 2000 or Netware. The network support and all of the remote user logins the network enables are, in the overall plan of the operating system, a program being run by the administrative user.

With the different types of operating systems in mind, it's time to look at the basic functions provided by an operating system.



Computer Operating Systems

When you turn on the power to a computer, the first program that runs is usually a set of instructions kept in the computer's read-only memory (ROM). This code examines the system hardware to make sure everything is functioning properly. This power-on self test (POST) checks the CPU, memory, and basic input-output systems (BIOS) for errors and stores the result in a special memory location. Once the POST has successfully completed, the software loaded in ROM (sometimes called the BIOS or firmware) will begin to activate the computer's disk drives. In most modern computers, when the computer activates the hard disk drive, it finds the first piece of the operating system: the bootstrap loader.


The bootstrap loader is a small program that has a single function: It loads the operating system into memory and allows it to begin operation. In the most basic form, the bootstrap loader sets up the small driver programs that interface with and control the various hardware subsystems of the computer. It sets up the divisions of memory that hold the operating system, user information and applications. It establishes the data structures that will hold the myriad signals, flags and semaphores that are used to communicate within and between the subsystems and applications of the computer. Then it turns control of the computer over to the operating system.

The operating system's tasks, in the most general sense, fall into six categories:

* Processor management
* Memory management
* Device management
* Storage management
* Application interface
* User interface

While there are some who argue that an operating system should do more than these six tasks, and some operating-system vendors do build many more utility programs and auxiliary functions into their operating systems, these six tasks define the core of nearly all operating systems. Next, let's look at the tools the operating system uses to perform each of these functions.

There are so many operating systems in this worldz of computers ,but the main are :

  • Microsoft Windows[88.6%]
  • Linux[0.60]
  • Apple Mac osx[7.0%]
  • Dell
  • Solaris
and even more......

The overall use percentage of Operating systems through out the world is shown in the following figure:

What are DLL files (.dll)



DLL Files in Windows- What Are They?


Dynamic Link Library (DLL) files are an essential part of the Windows operating system. Although they are ubiquitous, most PC users neither know nor care what these files do. Nonetheless, a little understanding of the role that DLL files play can make the computer a little less of a mystery box. Only programmers and computer technicians need to know any of the gory details of the structure and function of a DLL, but these files are so important that all of us should know a few simple facts about them. Here is some information for the non-technical PC user.


What Do DLL Files Do?


A DLL file is indicated by the extension DLL in its name. Microsoft gives several definitions of a DLL but the one that I think has the least jargon is this:
"A Dynamic Link Library (DLL) is a file of code containing functions that can be called from other executable code (either an application or another DLL). Programmers use DLLs to provide code that they can reuse and to parcel out distinct jobs. Unlike an executable (EXE) file, a DLL cannot be directly run. DLLs must be called from other code that is already executing."
Another way of putting it is that DLL files are like modules that can be plugged into different programs whenever a program needs the particular features that come with the DLL. The original concept behind DLL files was to simplify things. It was recognized that there were many functions common to a lot of software. For example, most programs need to create the graphical interface that appears on the screen. Instead of having to contain the code to create the interface themselves, programs call on a DLL for that function. The idea is to have a central library where everyone can obtain the commonly used functions, as they are needed. This cuts down on code, speeds things up, is more efficient, etc. They are called dynamic links because they are put to use only when a program calls on them and they are run in the program’s own memory space. More than one program can use the functions of a particular DLL at the same time.
Parenthetically, I have to say that the software developers (not least of all, Microsoft) have strayed from the path of keeping things simple. A computer today may contain a thousand or more different DLL files. Also, Microsoft seems to tinker endlessly with DLL files, giving rise to many different versions of a file with the same name, not all compatible. Microsoft maintains a database with information about various DLLs to help with version conflicts.
There are several very important DLLs that contain a large number of the basic Windows functions. Since they figure so importantly in the workings of Windows, it is worth noting their names.


Examples of Important DLL files:


COMDLG32.DLL
Controls the dialog boxes
GDI32.DLL
Contains numerous functions for drawing graphics, displaying text, and managing fonts
KERNEL32.DLL
Contains hundreds of functions for the management of memory and various processes
USER32.DLL
Contains numerous user interface functions. Involved in the creation of program windows and their interactions with each other It is the common use of these types of DLLs by most programs that ensures that all applications written for Windows will have a standard appearance and behavior. This standardization was a big factor in the rise of Windows to dominance of the desktop computer. Anyone who was working with computers in the days of DOS will remember that every program had its own interface and menus.
Error Messages involving DLLs
PC users often see DLLs (especially the ones mentioned above) mentioned in error messages. One might conclude, therefore, that something is always going wrong with DLLs. Very often, however, it is not the DLL itself that is at fault. DLL files figure prominently in the error messages when something in the system goes awry because they are involved in the most basic processes of Windows. They are in effect the messenger of trouble, not the actual trouble. It is beyond our scope to discuss any details of error messages but there are substantial references on interpreting them. One is at James Eshelman's site.
Using Regsvr32.exe to Register DLLs
First, let it be clear that the important system file regsvr.exe should not be confused with the file regsrv.exe that is used by certain worms and Trojans.
In order for a DLL to be used, it has to be registered by having appropriate references entered in the Registry. It sometimes happens that a Registry reference gets corrupted and the functions of the DLL cannot be used anymore. The DLL can be re-registered by opening Start-Run and entering the command regsvr32 somefile.dllThis command assumes that somefile.dll is in a directory or folder that is in the path. Otherwise, the full path for the DLL must be used. A DLL file can also be unregistered by using the switch "/u" as shown below.regsvr32 /u somefile.dllThis can be used to toggle a service on and off.