this question is according to this topic : creating a huge dummy file in a matter of seconds in c#
I just checked the fsutil.exe in xp/vista/seven to write a huge amount of dummy data into storage disk and it takes less time to write such a big file in comparison to programmatically way.
when I'm trying to do the same thing with the help of .net it will take considerably more time than fsutil.exe
note : I know that .net don't use native code bcuz of that I just checked this issue with native api too like following :
long int size = DiskFree('L' - 64);
const char* full = "fulldisk.dsk";
__try{
Application->ProcessMessages();
HANDLE hf = CreateFile(full,
GENERIC_WRITE,
0,
0,
CREATE_ALWAYS,
0,
0);
SetFilePointer(hf, size, 0, FILE_BEGIN);
SetEndOfFile(hf);
CloseHandle(hf);
}__finally{
ShowMessage("Finished");
exit(0);
and the answer was as equal as .net results.
but with the help of fsutil.exe it only takes less duration than above or .net approaches say it is 2 times faster example : for writting 400mb with .net it will take ~40 secs the same amount with fsutil.exe will take around 20secs or less.
is there any explanation about that? or which function fsutil.exe does use which has this significance speed to write?