Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Extend vloume using FSCTL_EXTEND_VOLUME

Extend vloume using FSCTL_EXTEND_VOLUME

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Madan Chauhan
    wrote on last edited by
    #1

    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.

    R C 3 Replies Last reply
    0
    • M Madan Chauhan

      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.

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • M Madan Chauhan

        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.

        C Offline
        C Offline
        C myLife
        wrote on last edited by
        #3

        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

        M 1 Reply Last reply
        0
        • R Rajesh R Subramanian

          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

          M Offline
          M Offline
          Madan Chauhan
          wrote on last edited by
          #4

          Thanks for the reply. Yes all the parameters are correct. Is there some extra job need to do before executing this function?

          1 Reply Last reply
          0
          • C C myLife

            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

            M Offline
            M Offline
            Madan Chauhan
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • M Madan Chauhan

              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.

              C Offline
              C Offline
              C myLife
              wrote on last edited by
              #6

              Go through this article http://msdn.microsoft.com/en-us/library/aa365181(VS.85).aspx[^] :-D

              M 1 Reply Last reply
              0
              • C C myLife

                Go through this article http://msdn.microsoft.com/en-us/library/aa365181(VS.85).aspx[^] :-D

                M Offline
                M Offline
                Madan Chauhan
                wrote on last edited by
                #7

                Thanks for ur support CmyLife I done it.

                C 1 Reply Last reply
                0
                • M Madan Chauhan

                  Thanks for ur support CmyLife I done it.

                  C Offline
                  C Offline
                  C myLife
                  wrote on last edited by
                  #8

                  Hey madan tats gud.I did this same thing few years back, anyways enjoy. :-D

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups