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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. INVALID_HANDLE_VALUE

INVALID_HANDLE_VALUE

Scheduled Pinned Locked Moved C / C++ / MFC
helpannouncement
5 Posts 5 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.
  • 3 Offline
    3 Offline
    3bood ghzawi
    wrote on last edited by
    #1

    hi all, i've aproblem with this function, i hope you don't minde to help me CreateFileA(m_pstrAllUsersPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 128, NULL); the m_pstrAllUsersPath value is "C:\Documents and Settings\All Users\Application Data\Avg9\update\download\avginfoavi.ctf". It always return INVALID_HANDLE_VALUE although this file exist. regards

    S CPalliniC L L 4 Replies Last reply
    0
    • 3 3bood ghzawi

      hi all, i've aproblem with this function, i hope you don't minde to help me CreateFileA(m_pstrAllUsersPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 128, NULL); the m_pstrAllUsersPath value is "C:\Documents and Settings\All Users\Application Data\Avg9\update\download\avginfoavi.ctf". It always return INVALID_HANDLE_VALUE although this file exist. regards

      S Offline
      S Offline
      Sauro Viti
      wrote on last edited by
      #2

      Have you the rights required to open that file?

      1 Reply Last reply
      0
      • 3 3bood ghzawi

        hi all, i've aproblem with this function, i hope you don't minde to help me CreateFileA(m_pstrAllUsersPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 128, NULL); the m_pstrAllUsersPath value is "C:\Documents and Settings\All Users\Application Data\Avg9\update\download\avginfoavi.ctf". It always return INVALID_HANDLE_VALUE although this file exist. regards

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        You should properly escape the path string, use:

        "C:\\Documents and Settings\\All Users\\Application Data\\Avg9\\update\\download\\avginfoavi.ctf"

        :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        • 3 3bood ghzawi

          hi all, i've aproblem with this function, i hope you don't minde to help me CreateFileA(m_pstrAllUsersPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 128, NULL); the m_pstrAllUsersPath value is "C:\Documents and Settings\All Users\Application Data\Avg9\update\download\avginfoavi.ctf". It always return INVALID_HANDLE_VALUE although this file exist. regards

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          The file you are trying to open might be held by some other process with "no share" attribute. Or you might be passing a wrong file name. I suspect the first case.

          ...byte till it megahertz... my donation to web rubbish

          1 Reply Last reply
          0
          • 3 3bood ghzawi

            hi all, i've aproblem with this function, i hope you don't minde to help me CreateFileA(m_pstrAllUsersPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 128, NULL); the m_pstrAllUsersPath value is "C:\Documents and Settings\All Users\Application Data\Avg9\update\download\avginfoavi.ctf". It always return INVALID_HANDLE_VALUE although this file exist. regards

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            When in trouble, read the manual. Better yet, read it before you get into trouble. If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError. There is no need for guessing, just call GetLastError() and you will know what gives. :|

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

            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