Skip to main content

Posts

Showing posts from May, 2013

Locking a physical disk on windows....

In this, I've tried to lock a physical disk using a small Windows C++ program. The steps to follow to achieve this are: 1. Get the Physical Drive and volume mapping. Say, the computer is attached with three physical drives, and we're interested to lock the Physical Drive 1 ("\\\\.\\PhysicalDrive1"). Then we need to figure out how many volumes are there on that physical disk. 2. Then Lock that volume one by one using control code FSCTL_LOCK_VOLUME . 3. Do the stuff we'd like to perform on the disk and then unlock each volume using control code  FSCTL_UNLOCK_VOLUME . 4. Close disk and volume handle(s). Few things to remember here. As per Microsoft documentation, a. The NTFS file system treats a locked volume as a dismounted volume. b. Lock volume call will fail with Access Code 5 (Access Denied) if the volume is in use. If we're not sure who's using the volume, just unmount it once. c. The FSCTL_DISMOUNT_VOLUME control code functions similarl

Starting with Windows Media

I've decided to spend some more time on a few areas which I've learned during my association with my gurus in the software industry. There are few people in the United States and also in India who have helped me to shape myself. Predominantly I'm not an outspoken person, but those seniors understood that I had little hunger for knowledge and provided me that information and helped me to come to this stage. Windows Media Stack, when I started working on it, I was the most nervous person because very soon I realized this is not going to be easy stuff to handle. Indeed, it's the most complex programming world I've ever faced or challenged before. I started my journey on Media Stack for Windows with the help of James Dailey. I can remember those days when he came from the US and delivered his series of lectures. It was amazing. This was an entry towards a world where programming, troubleshooting, debugging, etc isn't an easy task at all but also full of great lear