Extend vloume using FSCTL_EXTEND_VOLUME
-
Hi all, I am trying to extend a NTFS partition using FSCTL_EXTEND_VOLUME. The code is HANDLE hVolume = CreateFile(L"\\\\.\\E:", GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,OPEN_EXISTING,0,NULL); LONGLONG liBuffer = 20971520; // size in sectors to be increase DWORD dwReturnedBytes = NULL; DeviceIoControl(hVolume,FSCTL_EXTEND_VOLUME,&liBuffer,sizeof(liBuffer),NULL,0,dwReturnedBytes,NULL); But the function fail with #error 87. Someone please help me out with your suggestions. Thanks.
-
Hi all, I am trying to extend a NTFS partition using FSCTL_EXTEND_VOLUME. The code is HANDLE hVolume = CreateFile(L"\\\\.\\E:", GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,OPEN_EXISTING,0,NULL); LONGLONG liBuffer = 20971520; // size in sectors to be increase DWORD dwReturnedBytes = NULL; DeviceIoControl(hVolume,FSCTL_EXTEND_VOLUME,&liBuffer,sizeof(liBuffer),NULL,0,dwReturnedBytes,NULL); But the function fail with #error 87. Someone please help me out with your suggestions. Thanks.
Madan Chauhan wrote:
But the function fail with #error 87.
FormatMessage()[^] says: "The parameter is incorrect". So, you could check if all the parameters are valid before you pass it to the function. You could as well use the Error lookup utility which comes with VS to get the error description for an error number.
It is a crappy thing, but it's life -^ Carlo Pallini
-
Hi all, I am trying to extend a NTFS partition using FSCTL_EXTEND_VOLUME. The code is HANDLE hVolume = CreateFile(L"\\\\.\\E:", GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,OPEN_EXISTING,0,NULL); LONGLONG liBuffer = 20971520; // size in sectors to be increase DWORD dwReturnedBytes = NULL; DeviceIoControl(hVolume,FSCTL_EXTEND_VOLUME,&liBuffer,sizeof(liBuffer),NULL,0,dwReturnedBytes,NULL); But the function fail with #error 87. Someone please help me out with your suggestions. Thanks.
-
Madan Chauhan wrote:
But the function fail with #error 87.
FormatMessage()[^] says: "The parameter is incorrect". So, you could check if all the parameters are valid before you pass it to the function. You could as well use the Error lookup utility which comes with VS to get the error description for an error number.
It is a crappy thing, but it's life -^ Carlo Pallini
Thanks for the reply. Yes all the parameters are correct. Is there some extra job need to do before executing this function?
-
Hi Madan Chauhan, Only FSCTL_EXTEND_VOLUME is not sufficient to extend any NTFS volume. You need to first extend its boundry then use this control code. thanks CmyLife :-D
Thanks for your guidance. I dont have any idea which API or function extend the boundary of partition. Please tell me if you know that one. thanks.
-
Hi all, I am trying to extend a NTFS partition using FSCTL_EXTEND_VOLUME. The code is HANDLE hVolume = CreateFile(L"\\\\.\\E:", GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,OPEN_EXISTING,0,NULL); LONGLONG liBuffer = 20971520; // size in sectors to be increase DWORD dwReturnedBytes = NULL; DeviceIoControl(hVolume,FSCTL_EXTEND_VOLUME,&liBuffer,sizeof(liBuffer),NULL,0,dwReturnedBytes,NULL); But the function fail with #error 87. Someone please help me out with your suggestions. Thanks.
-
Go through this article http://msdn.microsoft.com/en-us/library/aa365181(VS.85).aspx[^] :-D
Thanks for ur support CmyLife I done it.
-
Thanks for ur support CmyLife I done it.