Delphi ntfs数据流文件复制
转自:http://blog.csdn.net/cackeme/article/details/8477878
procedure CopyDataStream(strFileName,strNewFileName:string); var hFile,hNewFile:Cardinal; dwLen,dwRet:DWORD; szBuf:array[0..102400] of char; //100K bRet:Boolean; dwSize:DWORD; begin hFile := CreateFile(PChar(strFileName),GENERIC_ALL,FILE_SHARE_WRITE,nil,OPEN_ALWAYS,0,0); if hFile = INVALID_HANDLE_VALUE then exit; hNewFile := CreateFile(PChar(strNewFileName),GENERIC_ALL,FILE_SHARE_WRITE,nil,CREATE_ALWAYS,0,0); if hNewFile = INVALID_HANDLE_VALUE then begin CloseHandle(hFile); exit; end; repeat bRet := ReadFile(hFile,szBuf,102400,dwRet,nil); if (bRet = False) or (dwRet = 0) then Break; WriteFile(hNewFile,szBuf,dwRet,dwLen,0); until false; CloseHandle(hFile); CloseHandle(hNewFile); end;