Click here to Skip to main content
11,641,708 members (57,058 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#2.0
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 saini6.3K
Edited 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 at 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 at 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 at 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 at 28-Jan-11 7:03am
Oops, slip of the tongue fingers. Corrected!
SAKryukov at 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
0 Mika Wendelius 260
1 DamithSL 248
2 Afzaal Ahmad Zeeshan 129
3 OriginalGriff 120
4 Sergey Alexandrovich Kryukov 80
0 Mika Wendelius 460
1 OriginalGriff 265
2 DamithSL 258
3 CPallini 169
4 Afzaal Ahmad Zeeshan 149

Advertise | Privacy | Mobile
Web02 | 2.8.150731.1 | Last Updated 28 Jan 2011
Copyright © CodeProject, 1999-2015
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