Thread: [Dev-C++] How to read/write directly a track/sector in a hard disk or CD
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <rc...@bi...> - 2005-08-29 15:55:27
|
<p>Dear sir,</p><p /><p style="">I see how to read/write to files using C. But I need to to define a track/sector that I can read and write to it under my control. Could you help me pointing out documents/sites with this information or teatching me how to do this.</p><p /><p>Thanks for your help</p><p /><p style="">Roger</p> |
|
From: Per W. <pw...@ia...> - 2005-08-29 18:19:13
|
Since reading/wringing directly to the drive requires access to the physical hardware, I have to ask exactly why you have this need. What are you trying to do? /Per W On Mon, 29 Aug 2005, rc...@bi... wrote: > > Dear sir, > > I see how to read/write to files using C. But I need to to define a track= /sector that I can read and write to it under my control. Could > you help me pointing out=A0documents/sites with this information or teatc= hing me how to do this. > > Thanks for your help > > Roger > > ------------------------------------------------------- SF.Net email is S= ponsored by the Better Software Conference & EXPO September > 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile &= Plan-Driven Development * Managing Projects & Teams * Testing & > QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce= 5sf _______________________________________________ > Dev-cpp-users mailing list Dev...@li... TO UNSUBSC= RIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Alfred P. R. <al...@ya...> - 2005-08-29 19:06:37
|
IMHO, there are many reasons for doing such, including security, data recovery, etc. However, I've never seen this done in C/C++. As you have to access low level IO functions, this is preferentially done is assembly, as I don't believe C/C++ have this capability. At least, I've never found the need to research it. I would recommend Googling for low level disk IO. If you're really diligent, you can find out that there are undocumented features to disk controllers that significantly enhance data security. Per Westermark <pw...@ia...> wrote: Since reading/wringing directly to the drive requires access to the physical hardware, I have to ask exactly why you have this need. What are you trying to do? /Per W On Mon, 29 Aug 2005, rc...@bi... wrote: > > Dear sir, > > I see how to read/write to files using C. But I need to to define a track/sector that I can read and write to it under my control. Could > you help me pointing out documents/sites with this information or teatching me how to do this. > > Thanks for your help > > Roger <snip> Alfred P. Reaud |
|
From: Per W. <pw...@ia...> - 2005-08-29 19:45:07
|
Security from snooping? That is done by strong encryption. Security from data loss? That is done by journaling or similar for power failures and mirrored or check-summed data to handle hardware failures. Data recovery? Journaling, ECC, check-sum, mirroring or similar.. Reasons for thinking about direct access - or for intercepting driver accesses might be: - extremely high-end database using custom-optimized file system. - cryptographic layer doing sector-by-sector encryption. - routing layer for faking a local harddrive over the network. - storage manager layer for glueing multiple drives dynamically or statically into larger drives. - software RAID. - support for foreign file systems natively or in "user mode". - repartitioning drives, growing/shrinking/converting file systems. - media rotation layer for supporting media with limited write counts. - repair of broken file system. - ... Most of above cases exists for free or almost free, or are so very out of scope for real use that it isn't economical to develop a solution unless the target application can be sold for _big_ sums of money. www.sysinternals.com have some nice articles about file systems and how to build your own disk defragger for example. Anyway, to be able to give reasonable help/recommendations it very much helps to know the why. A lot of people ask very specific questions about problems that are not relevant. What use is it to help them to fix a bug in an incorrectly chosen algorithm instead of telling them which algorithm they should have used? The quality of expected answers very much depends on the quality of the question. /Per W On Mon, 29 Aug 2005, Alfred P. Reaud wrote: > IMHO, there are many reasons for doing such, including security, data recovery, etc. However, I've never seen this done in C/C++. As you have to access low level IO functions, this is preferentially done is assembly, as I don't believe C/C++ have this capability. At least, I've never found the need to research it. > > I would recommend Googling for low level disk IO. If you're really diligent, you can find out that there are undocumented features to disk controllers that significantly enhance data security. > > Per Westermark <pw...@ia...> wrote: > Since reading/wringing directly to the drive requires access to the > physical hardware, I have to ask exactly why you have this need. What are > you trying to do? > > /Per W > > On Mon, 29 Aug 2005, rc...@bi... wrote: > > > > > Dear sir, > > > > I see how to read/write to files using C. But I need to to define a track/sector that I can read and write to it under my control. Could > > you help me pointing out documents/sites with this information or teatching me how to do this. > > > > Thanks for your help > > > > Roger > <snip> > > > > > Alfred P. Reaud > > > |
|
From: Alfred P. R. <al...@ya...> - 2005-08-29 21:04:36
|
All true Per. Regardless my point was that low level IO isn't usually done in high level languages, and Google should be a powerful tool in the search for knowledge, especially at the instructional level. You seem to have taken umbrage, Per, when no offense was intended, or at least that is how I take the tone of your response. If that is the case, then my humble apologies. Per Westermark <pw...@ia...> wrote: Security from snooping? That is done by strong encryption. <snip> Anyway, to be able to give reasonable help/recommendations it very much helps to know the why. A lot of people ask very specific questions about problems that are not relevant. What use is it to help them to fix a bug in an incorrectly chosen algorithm instead of telling them which algorithm they should have used? The quality of expected answers very much depends on the quality of the question. /Per W <snip> Alfred P. Reaud |
|
From: Per W. <pw...@ia...> - 2005-08-29 22:24:45
|
Remember that just about all drivers (most OS) are written in C (which is also the most common language for operating systems), so they are more or less normal code with the exception that they might have a bit more clutter because of synchronization, hot-plug etc. /Per W On Mon, 29 Aug 2005, Alfred P. Reaud wrote: > All true Per. Regardless my point was that low level IO isn't usually done in high level languages, and Google should be a powerful tool in the search for knowledge, especially at the instructional level. You seem to have taken umbrage, Per, when no offense was intended, or at least that is how I take the tone of your response. If that is the case, then my humble apologies. |