﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>A1VBCode Forums / Classic Visual Basic (VB 6 or earlier) / API  / sector copy / Latest Posts</title><generator>InstantForum.NET v4.1.1</generator><description>A1VBCode Forums</description><link>http://www.a1vbcode.com/vbforums/</link><webMaster>forums@a1vbcode.com</webMaster><lastBuildDate>Thu, 29 Jul 2010 18:57:12 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: sector copy</title><link>http://www.a1vbcode.com/vbforums/Topic27610-5-1.aspx</link><description>&lt;FONT color=#111111&gt;With code... no as I have destroyed my fair share of hard drives and that I have never tried this method before but I can say that when you read from the disk, your buffer size needs to be the size of the sector. I think this is one of those things that I think you will have to do yourself by trial and error.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;&lt;/FONT&gt; &lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;Good Luck&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;&lt;/FONT&gt; </description><pubDate>Thu, 07 May 2009 00:59:48 GMT</pubDate><dc:creator>vb5prgrmr</dc:creator></item><item><title>RE: sector copy</title><link>http://www.a1vbcode.com/vbforums/Topic27610-5-1.aspx</link><description>Yes, I have already done those disk analysis part. I, now wanted to read the hard disk by sector and copy it. Can you help me out with some of the examples code.. Thanks</description><pubDate>Wed, 06 May 2009 07:27:21 GMT</pubDate><dc:creator>Shreeti_Tula</dc:creator></item><item><title>RE: sector copy</title><link>http://www.a1vbcode.com/vbforums/Topic27610-5-1.aspx</link><description>&lt;FONT color=#111111&gt;Whoa...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;div class="Quote"&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Disk Devices&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Windows NT:&lt;/B&gt; You can use the &lt;B&gt;CreateFile&lt;/B&gt; function to open a disk drive or a partition on a disk drive. The function returns a handle to the disk device; that handle can be used with the &lt;A href="mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VS\1033\winbase.chm::/devdoc/live/pdwbase/devio_9quk.htm"&gt;&lt;B&gt;DeviceIOControl&lt;/B&gt;&lt;/A&gt; function. The following requirements must be met in order for such a call to succeed: &lt;UL&gt;&lt;LI&gt;The caller must have administrative privileges for the operation to succeed on a hard disk drive. &lt;LI&gt;The &lt;I&gt;lpFileName&lt;/I&gt; string should be of the form &lt;B&gt;\\.\PHYSICALDRIVE&lt;I&gt;x&lt;/I&gt;&lt;/B&gt; to open the hard disk &lt;I&gt;x&lt;/I&gt;. Hard disk numbers start at zero. For example: &lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;TABLE cellSpacing=4 cols=2&gt;&lt;TBODY&gt;&lt;TR vAlign=top&gt;&lt;TH align=left width="36%"&gt;String&lt;/TH&gt;&lt;TH align=left width="64%"&gt;Meaning&lt;/TH&gt;&lt;/TR&gt;&lt;TR vAlign=top&gt;&lt;TD width="36%"&gt;&lt;B&gt;\\.\PHYSICALDRIVE2&lt;/B&gt;&lt;/TD&gt;&lt;TD width="64%"&gt;Obtains a handle to the third physical drive on the user's computer.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The &lt;I&gt;lpFileName&lt;/I&gt; string should be &lt;B&gt;\\.\&lt;I&gt;x&lt;/I&gt;:&lt;/B&gt; to open a floppy drive &lt;I&gt;x&lt;/I&gt; or a partition &lt;I&gt;x&lt;/I&gt; on a hard disk. For example: &lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;TABLE cellSpacing=4 cols=2&gt;&lt;TBODY&gt;&lt;TR vAlign=top&gt;&lt;TH align=left width="17%"&gt;String&lt;/TH&gt;&lt;TH align=left width="83%"&gt;Meaning&lt;/TH&gt;&lt;/TR&gt;&lt;TR vAlign=top&gt;&lt;TD width="17%"&gt;\\&lt;B&gt;.&lt;/B&gt;\&lt;B&gt;A:&lt;/B&gt;&lt;/TD&gt;&lt;TD width="83%"&gt;Obtains a handle to drive A on the user's computer.&lt;/TD&gt;&lt;/TR&gt;&lt;TR vAlign=top&gt;&lt;TD width="17%"&gt;\\&lt;B&gt;.&lt;/B&gt;\&lt;B&gt;C:&lt;/B&gt;&lt;/TD&gt;&lt;TD width="83%"&gt;Obtains a handle to drive C on the user's computer.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#dd3333&gt;Note that all I/O buffers must be sector aligned (aligned on addresses in memory that are integer multiples of the volume's sector size), even if the disk device is opened without the FILE_FLAG_NO_BUFFERING flag.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Windows 95:&lt;/B&gt; This technique does not work for opening a logical drive. In Windows 95, specifying a string in this form causes &lt;B&gt;CreateFile&lt;/B&gt; to return an error. &lt;UL&gt;&lt;LI&gt;The &lt;I&gt;dwCreationDisposition&lt;/I&gt; parameter must have the OPEN_EXISTING value. &lt;LI&gt;When opening a floppy disk or a partition on a hard disk, you must set the FILE_SHARE_WRITE flag in the &lt;I&gt;dwShareMode&lt;/I&gt; parameter. &lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/div&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;You are going to have to do a whole lot more work if you really want to do this. Start with the GetDiskFreeSpace API.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;&lt;/FONT&gt; &lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;Good Luck&lt;/FONT&gt;</description><pubDate>Sun, 03 May 2009 04:47:01 GMT</pubDate><dc:creator>vb5prgrmr</dc:creator></item><item><title>RE: sector copy</title><link>http://www.a1vbcode.com/vbforums/Topic27610-5-1.aspx</link><description>Thanks. I am not very familiar with the file handling operator.Actually, I want to read and copy the hard disk by sector. I am trying to use this function.&lt;br&gt;DrvHndl=CreateFile ("\\.\C:", GENERIC_READ + GENERIC_WRITE, FILE_SHARE_READ + FILE_SHARE_WRITE, lpSecurityAttributes, OPEN_EXISTING, ByVal FILE_FLAG_NO_BUFFERING, 0&amp;). Does this function helps to read and copy the hard disk. I don't have much idea about these function. Please help....</description><pubDate>Sat, 02 May 2009 18:20:05 GMT</pubDate><dc:creator>Shreeti_Tula</dc:creator></item><item><title>RE: sector copy</title><link>http://www.a1vbcode.com/vbforums/Topic27610-5-1.aspx</link><description>Yes it is possible but not via the API. You would have to do this yourself via the open command. (Open yourfile for input as #FileNumber) then to output...(Open NewFile for output as #DifferentFileNumber). check out the freefile function while your are at it.&lt;/P&gt;&lt;P&gt;Good Luck</description><pubDate>Sat, 02 May 2009 15:32:32 GMT</pubDate><dc:creator>vb5prgrmr</dc:creator></item><item><title>sector copy</title><link>http://www.a1vbcode.com/vbforums/Topic27610-5-1.aspx</link><description>Hi,  I wanted to know, is it possible to copy sector by sector instead of file copy in VB? Is there  certain windows function for that? Please help&lt;br&gt;Shree</description><pubDate>Fri, 01 May 2009 07:14:49 GMT</pubDate><dc:creator>Shreeti_Tula</dc:creator></item></channel></rss>