Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


sector copy


sector copy

Author
Message
Shreeti_Tula
Shreeti_Tula
Forum God
Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)

Group: Forum Members
Posts: 7, Visits: 18
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

Shree
Edited
5/2/2009 by Shreeti_Tula
vb5prgrmr
vb5prgrmr
Forum God
Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)

Group: Forum Members
Posts: 167, Visits: 786
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.

Good Luck

Shreeti_Tula
Shreeti_Tula
Forum God
Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)

Group: Forum Members
Posts: 7, Visits: 18
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.

DrvHndl=CreateFile ("\\.\C:", GENERIC_READ + GENERIC_WRITE, FILE_SHARE_READ + FILE_SHARE_WRITE, lpSecurityAttributes, OPEN_EXISTING, ByVal FILE_FLAG_NO_BUFFERING, 0&). Does this function helps to read and copy the hard disk. I don't have much idea about these function. Please help....
vb5prgrmr
vb5prgrmr
Forum God
Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)

Group: Forum Members
Posts: 167, Visits: 786
Whoa...

Disk Devices

Windows NT: You can use the CreateFile 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 DeviceIOControl function. The following requirements must be met in order for such a call to succeed:

  • The caller must have administrative privileges for the operation to succeed on a hard disk drive.
  • The lpFileName string should be of the form \\.\PHYSICALDRIVEx to open the hard disk x. Hard disk numbers start at zero. For example:

StringMeaning
\\.\PHYSICALDRIVE2Obtains a handle to the third physical drive on the user's computer.

  • The lpFileName string should be \\.\x: to open a floppy drive x or a partition x on a hard disk. For example:

StringMeaning
\\.\A:Obtains a handle to drive A on the user's computer.
\\.\C:Obtains a handle to drive C on the user's computer.

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.

Windows 95: This technique does not work for opening a logical drive. In Windows 95, specifying a string in this form causes CreateFile to return an error.

  • The dwCreationDisposition parameter must have the OPEN_EXISTING value.
  • When opening a floppy disk or a partition on a hard disk, you must set the FILE_SHARE_WRITE flag in the dwShareMode parameter.

You are going to have to do a whole lot more work if you really want to do this. Start with the GetDiskFreeSpace API.

 

Good Luck

Shreeti_Tula
Shreeti_Tula
Forum God
Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)Forum God (3K reputation)

Group: Forum Members
Posts: 7, Visits: 18
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
vb5prgrmr
vb5prgrmr
Forum God
Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)Forum God (39K reputation)

Group: Forum Members
Posts: 167, Visits: 786
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.

 

Good Luck

 

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search