How to use C to write to flash drive bootsector despite error 'Failed to open file to write.:Permiss

Posted by updateraj on Stack Overflow See other posts from Stack Overflow or by updateraj
Published on 2010-05-05T01:24:15Z Indexed on 2010/05/05 1:28 UTC
Read the original article Hit count: 287

Filed under:
|
|
|
|

My goal is to manipulate the boot-sector in my flashdrive (volume E:) I am using XP.

I am able to read the boot-sector

FILE *fp_read = fopen("\\\\.\\E:", "rb");
/* Able to proceed to read boot sector  */ 

however i am not able to open the file to write using fopen in 'wb' mode.

FILE *fp_read = fopen("\\\\.\\E:", "wb"); 
/* Unable to proceed due to Failed to open file to write.:Permission Denied */

The flash-drive is not in use at the moment of execution.

Hex-editors are able to manipulated boot sector etc, i believe it possible to do so in c.

Any suggestion or insight to overcome the access problem so as to be able to write?

© Stack Overflow or respective owner

Related posts about file

Related posts about drive