Windows Loopback Alternative
It is a well known fact that Windows doesn't support loopback devices but there is an alternative available for Windows 7 users. Windows 7 has a support for so called Virtual Hard Disks which are just plain bin files with data. Windows 7 also includes the interface for creation and management of those VHD files.
Creating a VHD
Attaching a VHD
By right clicking Disk Management, and selecting Attach VHD, you can attach any VHD ( Possibly any binary file) and mount it to a specific drive.
You can setup your IDE ( I have used Visual Studio) to automatically detach a VHD after compilation and run the OS in a emulator, such as QEMU. Here is how you can achieve such behavior.
Windows contains a command line program called diskpart which is used for mounting of the VHDs, but you need to supply a script for it in order to work.
c:\os\harddrive.vhd shows the location of the VHD file used.
Script for attaching (Saved as VHDScriptAttach.txt) :
select vdisk file=c:\os\harddrive.vhd attach vdisk
Script for detaching (Saved as VHDScriptDetach.txt) :
select vdisk file=c:\os\harddrive.vhd detach vdisk
After that you need to setup your IDE/Compiler to run this batch script after compilation/on debug.
diskpart -s VHDScriptDetach.txt qemu.exe -hda C:\OS\Harddrive.vhd diskpart -s VHDScriptAttach.txt