File location in disk

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

Hi,
I want to write a program to copy a file that this file is in-use.
Is it possible to know the real file location(mabye on specific sector)
in disk? Thanks.

Brian
 
(e-mail address removed) wrote:

|>
|>|>Hi,
|>|> I want to write a program to copy a file that this file is in-use.
|>|>Is it possible to know the real file location(mabye on specific sector)
|>|>in disk? Thanks.
|>
|>It's been done
|>http://www.bleepingcomputer.com/files/killbox.php

Misread your question, that just deletes a file.

I don't think XP OS will let you get that comfy with the hard drive.
 
Hi Pennywise,
Thanks for reply.
That's also my question. But if this is right, what mechanize of
file-based backup software to copy file-in-use? Do you have any idea?

Brian


(e-mail address removed) 寫é“:
 
|>Hi Pennywise,
|> Thanks for reply.
|> That's also my question. But if this is right, what mechanize of
|>file-based backup software to copy file-in-use? Do you have any idea?

Google'd this
http://www.itefix.no/phpws/index.php?module=faq&FAQ_op=view&FAQ_id=81

Claims it's only for 2003 server but you might find it of some help.
Best I can do...

|>[email protected] ???
|>
|>> (e-mail address removed) wrote:
|>>
|>> |>
|>> |>|>Hi,
|>> |>|> I want to write a program to copy a file that this file is in-use.
|>> |>|>Is it possible to know the real file location(mabye on specific sector)
|>> |>|>in disk? Thanks.
|>> |>
|>> |>It's been done
|>> |>http://www.bleepingcomputer.com/files/killbox.php
|>>
|>> Misread your question, that just deletes a file.
|>>
|>> I don't think XP OS will let you get that comfy with the hard drive.
|>>
|>>
|>> --
|>>
 
Brian said:
Hi,
I want to write a program to copy a file that this file is in-use.
Is it possible to know the real file location(mabye on specific
sector) in disk? Thanks.

Brian

The file may be spread around on 5,000 sectors. If the file is in use with
read-write permissions, you should be able to copy it (else how would
separate programs, on different computers, access the same file?).

You may have to copy it under program control record-by-record. I know ZIP
can't grap a file that's in use, but an application program can copy the
file (record-by-record) to an alternate name, then ZIP can access the copy.
 
Hi HeyBub,
Thanks for reply.

HeyBub 寫é“:
The file may be spread around on 5,000 sectors. If the file is in use with
read-write permissions, you should be able to copy it (else how would
separate programs, on different computers, access the same file?).
I write as following code.

HANDLE hFile = CreateFile(L"C:\\Documents and
Settings\\brianliu\\Local Settings\\Application
Data\\Microsoft\\Windows\\UsrClass.dat",
0,
FILE_SHARE_READ ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);

if(hFile == INVALID_HANDLE_VALUE)
{
OutputDebugString(_T("\nFail"));
return;
}

result = ReadFile(hFile, (LPVOID)&buffer,
sizeof(buffer),
&BytesReturned,
NULL);
if(!result) OutputDebugString(L"\nread fail");

It's ok to open file UsrClass.dat, but fail to ReadFile(). :(

You may have to copy it under program control record-by-record. I know ZIP
can't grap a file that's in use, but an application program can copy the
file (record-by-record) to an alternate name, then ZIP can access the copy.
Could you explain more detail about record-by-record? or Where I can
download related documents?

Thanks again. :)
 
Back
Top