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.
