When your OS is turned on,as soon as you plug any devices in,it detects them automatically.The reason is simple.The OS is programmed that way so it detects all the new devices and automatically installs the proper drivers that Microsoft included in the OS itself.All those error messages,information messages,warning messages,balloon tips....blabla....which you get while connecting the hardware to your computer you get again for the same reason....Microsoft programmed the OS that way and when you make the hardware change,the programmed code from the OS is executed in order to make what it should make wether if it installs the simple USB stick,new HDD,new monitor and so on......Some OS components even use the timer so they can scan for hardware changes every second or every 10 seconds or every minute or however they decided to make it.
In short...EVERY SINGLE thing that you use and see in your OS contains the programming code which executes when needed and therefore makes what it should make.Here is a small example:
You have a window with bunch of options.You adjust all those options just the way you want them and then you click the OK button which APPLIES ALL THOSE OPTIONS and also CLOSES the window.Now...that OK button seems very simple.You KNOW you must click it and after you do,the window is closed immediately.BUT what you do not see is the HUGE programmed code behind that button.By clicking that OK button,a LOT of programming code is executed and it makes what it should make.Wether if it saves some text,check box state,radio button state,all their functions and so on.In short...there is A LOT of code that one OS contains.A LOT...
As for the keyboard and the monitor,as soon as the BIOS has fully loaded,it automatically points to the BOOT SECTOR on the HDD which tells the BIOS what to start loading.Wether should he start loading some OS such as XP,Vista,some DOS program or whatever you are trying to load...
Your monitor and the keyboard WORK because the OS automatically starts loading their drivers as soon as it starts booting.So while the OS is booting up,during the boot up process they load ALL the neccessary drivers so that your devices could work properly after the OS is fully loaded.Wether if its the monitor,keyboard,mouse and so on...
Usually the drivers are located under the: "C:\WINDOWS\system32\drivers\"
There are few more places where the drivers are located.It depends of course on the driver itself and where that driver has installed its neccessary files.
One more important thing is the REGISTRY.EVERY SINGLE installed hardware and its drivers writes their informations into the Windows registry.This is very important so that the OS KNOWS that you have those hardware drivers installed and therefore it can start loading them on the boot up process...
If you just have the drivers,but their informations are NOT written into the Windows registry,the hardware drivers will not work then because the OS will not know that you have those hardware drivers at all and of course it wont use them and the OS will act like you dont have that hardware devices plugged into your computer...
The registry file called "system" contains most of the hardware drivers informations and it can be located under the: "C:\WINDOWS\system32\config\system"
Cheers and happy new 2010. year everyone!!!