Article View: borland.public.cppbuilder.nativeapi
Article #15506Re: write a long word on the hard disk
From: Andrue Cope
Date: Wed, 02 Jul 2003 11:51
Date: Wed, 02 Jul 2003 11:51
47 lines
2937 bytes
2937 bytes
Marcello Scala, > How can i do it? > If you want to write your own data to a specific sector on the disk then roughly the process would be: 1)Open the device using CreateFile() 2)Read the target sector into a buffer using SPTI (SCSI Pass Through Interface) 3)Modify the buffer contents to include your data 4)Write the buffer back to the disk 5)Close the device. Notes: a)If you don't pick your sector carefully you could overwrite file system structures and corrupt your disk. Worse case scenario is that you could render your disk innaccessible. Actually no. The worse case scenario is that you render your customer's disk innaccessible. Aside from being poor PR (Public Relations) you should consider that some of our customers have been prepared to pay six figure sums to get their data back. If you are culpable you could end up being passed that kind of bill. b)SPTI is documented but is very convoluted. c)SPTI only works under WinNT or higher. For Win9x you need something completely different. d)Sector are addressed by number (zero based) not Cylinder/Header/Sector. If you have a C:H:S address to write to then you'll have fun and games trying to convert it into the PSN you need. I develop data recovery and computer forensic software and 'grew up' as a data recovery engineer. I understand the design and layout of over a dozen file systems and write/maintain file system driver code for our own utilities. I WOULD DO EVERYTHING POSSIBLE TO AVOID WRITING MY OWN DATA DIRECT TO A DISK. The risks are appalling and the work required to guard against corruption is extensive. -- Andrue Cope [Bicester, UK]
Technical Details
Message-ID:
<VA.00001da4.09f0b3ad@email.address.sorry>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f01de25@newsgroups.borland.com> <3f01e80d.936206@forums.borland.com> <3f01fadf@newsgroups.borland.com> <VA.00001da1.09274f33@email.address.sorry> <3f029922@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,ec39b487fac24c91 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-02 05:25:00 PST Date: Wed, 02 Jul 2003 12:51:58 +0100 Newsgroups: borland.public.cppbuilder.nativeapi Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: Virtual Access by Atlantic Coast PLC, http://www.atlantic-coast.com/va Message-ID: <VA.00001da4.09f0b3ad@email.address.sorry> Subject: Re: write a long word on the hard disk From: Andrue Cope <not.a.valid@email.address.sorry> Reply-To: not.a.valid@email.address.sorry References: <3f01de25@newsgroups.borland.com> <3f01e80d.936206@forums.borland.com> <3f01fadf@newsgroups.borland.com> <VA.00001da1.09274f33@email.address.sorry> <3f029922@newsgroups.borland.com> NNTP-Posting-Host: 217.207.223.34 X-Trace: newsgroups.borland.com 1057146756 217.207.223.34 (2 Jul 2003 04:52:36 -0700) Lines: 48 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail