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. a map Resizing a map file;

a map Resizing a map file;

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
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.
  • H Offline
    H Offline
    hatemtalbi
    wrote on last edited by
    #1

    Hi all, I created a map file like this : HANDLE hMap=CreateFileMapping(hFile, NULL, _dwProtect, 0, _dwSize, _strMapName); but now I need to increase its size and create a new view on it!! does someone know how to to that the right way?? Thank you so much :)

    D 1 Reply Last reply
    0
    • H hatemtalbi

      Hi all, I created a map file like this : HANDLE hMap=CreateFileMapping(hFile, NULL, _dwProtect, 0, _dwSize, _strMapName); but now I need to increase its size and create a new view on it!! does someone know how to to that the right way?? Thank you so much :)

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      hatemtalbi wrote:

      but now I need to...create a new view on it!!

      To start over, can't you just call UnmapViewOfFile() followed by CloseHandle()?


      "The largest fire starts but with the smallest spark." - David Crow

      "Judge not by the eye but by the heart." - Native American Proverb

      H 1 Reply Last reply
      0
      • D David Crow

        hatemtalbi wrote:

        but now I need to...create a new view on it!!

        To start over, can't you just call UnmapViewOfFile() followed by CloseHandle()?


        "The largest fire starts but with the smallest spark." - David Crow

        "Judge not by the eye but by the heart." - Native American Proverb

        H Offline
        H Offline
        hatemtalbi
        wrote on last edited by
        #3

        Yes, I did all that. But when I call mapViewOfFile() the secon time the whole size of the maapped file !!!

        D 1 Reply Last reply
        0
        • H hatemtalbi

          Yes, I did all that. But when I call mapViewOfFile() the secon time the whole size of the maapped file !!!

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          hatemtalbi wrote:

          But when I call mapViewOfFile() the secon time the whole size of the maapped file !!!

          Your sentence is incomplete. What happens when you call MapViewOfFile() the second time?


          "The largest fire starts but with the smallest spark." - David Crow

          "Judge not by the eye but by the heart." - Native American Proverb

          H 1 Reply Last reply
          0
          • D David Crow

            hatemtalbi wrote:

            But when I call mapViewOfFile() the secon time the whole size of the maapped file !!!

            Your sentence is incomplete. What happens when you call MapViewOfFile() the second time?


            "The largest fire starts but with the smallest spark." - David Crow

            "Judge not by the eye but by the heart." - Native American Proverb

            H Offline
            H Offline
            hatemtalbi
            wrote on last edited by
            #5

            for example when I resize the file from 4KB to 8KB, I expect that MapViewOfFile() return a buffer size of 8KB but I get only 4KB !!!

            J 1 Reply Last reply
            0
            • H hatemtalbi

              for example when I resize the file from 4KB to 8KB, I expect that MapViewOfFile() return a buffer size of 8KB but I get only 4KB !!!

              J Offline
              J Offline
              James Brown
              wrote on last edited by
              #6

              This is to be expected - that is how file-mapping objects work. You should use the ZwResizeSection native-API if you want to resize the file-mapping object. Lots of info on google about this. James
              http://www.catch22.net

              H 1 Reply Last reply
              0
              • J James Brown

                This is to be expected - that is how file-mapping objects work. You should use the ZwResizeSection native-API if you want to resize the file-mapping object. Lots of info on google about this. James
                http://www.catch22.net

                H Offline
                H Offline
                hatemtalbi
                wrote on last edited by
                #7

                Sorry, I typed ZwResizeSection in google but I didn't get any results !! please could you check the word orthography thank you

                J 1 Reply Last reply
                0
                • H hatemtalbi

                  Sorry, I typed ZwResizeSection in google but I didn't get any results !! please could you check the word orthography thank you

                  J Offline
                  J Offline
                  James Brown
                  wrote on last edited by
                  #8

                  my mistake. try: ZwExtendSection
                  http://www.catch22.net

                  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