Click here to Skip to main content
13,148,427 members (62,383 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Is it possible to access Master Boot Record (MBR) of a system. Can we store our file/data in MBR through c# coding? Please explain.
Posted 27-Jan-11 0:11am
sk saini7.9K
Updated 27-Jan-11 0:24am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Why do you want to store your file on MBR? It is not file storage location. There are plenty other locations to store your files. Assuming that you are not asking for malicious activity, you can not read/write directly using C#. That would be very high level language with no API, but it is doable using P/Invoke.
sk saini 27-Jan-11 6:29am
I want to keep some inportant data/file on my client system that should not be corrupted/mishandeled by him or any one else there.
sk saini 27-Jan-11 6:32am
My purpose is to keep security of my software on client systems. The file/data size can be of 100-150 kb (max.).
SAKryukov 27-Jan-11 22:46pm
It would be all correct if you did not mention "language". This is merely a matter or API, languages -- in traditional meaning of this term in programming -- are irrelevant.
Thank you.
Yusuf 28-Jan-11 7:03am
Oops, slip of the tongue fingers. Corrected!
SAKryukov 28-Jan-11 12:03pm
Nice pun! (Oh, I do understand -- unintended :-)
Be careful, also has some sexual connotation -- well, your understand... :-)
I just voted "5".
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

This is possible; Yusuf is right. As to your purpose, this looks like a children Hide-and-Seek game.

If you need security, do yourself a favor, learn about security. I hint? Security is not based on secret hidden techniques; if one person knows, another person can learn it. Security is based on commonly known open algorithms. You think open and secret is a contradiction? This is because you did not learn about security.

Thank you and good luck,
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

It's a big task.

First try to make a function using VC++ (as a dll project) to write to MBR.

To do so look for the windows API in MSDN such as

Then using C# pInvoke signature use LoadLibrary(), GetProcAddress() call your function which writes to MBR

But you will also face security problem, hence I recommend you to visit this link
Understanding .NET Code Access Security[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

I think this is what you need - it was featured today.
Driver to Hide Processes and Files[^]

Much better than messing with the MBR, which will probably kill the OS (or vice versa) anyway.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170924.2 | Last Updated 28 Jan 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100